| 281 | } |
| 282 | |
| 283 | void E57XmlParser::init() |
| 284 | { |
| 285 | // Initialize the XML4C2 system |
| 286 | try |
| 287 | { |
| 288 | // NOTE: This is not thread safe for multiple simultaneous E57 readers. |
| 289 | // Ideally we'd do this once, not once per reader. |
| 290 | XMLPlatformUtils::Initialize(); |
| 291 | } |
| 292 | catch ( const XMLException &ex ) |
| 293 | { |
| 294 | // Turn parser exception into E57Exception |
| 295 | throw E57_EXCEPTION2( ErrorXMLParserInit, |
| 296 | "parserMessage=" + ustring( XMLString::transcode( ex.getMessage() ) ) ); |
| 297 | } |
| 298 | |
| 299 | xmlReader = XMLReaderFactory::createXMLReader(); //??? auto_ptr? |
| 300 | |
| 301 | if ( xmlReader == nullptr ) |
| 302 | { |
| 303 | throw E57_EXCEPTION2( ErrorXMLParserInit, "could not create the xml reader" ); |
| 304 | } |
| 305 | |
| 306 | //??? check these are right |
| 307 | xmlReader->setFeature( XMLUni::fgSAX2CoreValidation, true ); |
| 308 | xmlReader->setFeature( XMLUni::fgXercesDynamic, true ); |
| 309 | xmlReader->setFeature( XMLUni::fgSAX2CoreNameSpaces, true ); |
| 310 | xmlReader->setFeature( XMLUni::fgXercesSchema, true ); |
| 311 | xmlReader->setFeature( XMLUni::fgXercesSchemaFullChecking, true ); |
| 312 | xmlReader->setFeature( XMLUni::fgSAX2CoreNameSpacePrefixes, true ); |
| 313 | |
| 314 | xmlReader->setContentHandler( this ); |
| 315 | xmlReader->setErrorHandler( this ); |
| 316 | } |
| 317 | |
| 318 | void E57XmlParser::parse( InputSource &inputSource ) |
| 319 | { |
no outgoing calls
no test coverage detected