xml-copy-editor-code/src/xmlparseschemans.cpp

32 lines
807 B
C++
Raw Normal View History

2007-09-07 23:17:30 +02:00
#include <string>
#include <vector>
#include <stdexcept>
#include <expat.h>
#include "xmlparseschemans.h"
2007-09-08 00:25:30 +02:00
XmlParseSchemaNs::XmlParseSchemaNs() : WrapExpat ( false ), d ( new ParseSchemaNsData() )
2007-09-07 23:17:30 +02:00
{
2007-09-08 00:25:30 +02:00
d->p = p; // set parser for XML_StopParser call
XML_SetUserData ( p, d.get() );
XML_SetStartElementHandler ( p, start );
2007-09-07 23:17:30 +02:00
}
XmlParseSchemaNs::~XmlParseSchemaNs()
2007-09-08 00:25:30 +02:00
{}
2007-09-07 23:17:30 +02:00
2007-09-08 00:25:30 +02:00
void XMLCALL XmlParseSchemaNs::start ( void *data,
const XML_Char *el,
const XML_Char **attr )
2007-09-07 23:17:30 +02:00
{
2007-09-08 00:25:30 +02:00
ParseSchemaNsData *d = ( ParseSchemaNsData * ) data;
if ( !d )
return;
while ( *attr )
{
d->attributeVector.push_back ( make_pair ( *attr, * ( attr + 1 ) ) );
attr += 2;
}
XML_StopParser ( d->p, false );
2007-09-07 23:17:30 +02:00
}