OpenASIP 2.2
Loading...
Searching...
No Matches
XMLSerializer.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2009 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file XMLSerializer.cc
26 *
27 * Implementation of XMLSerializer class.
28 *
29 * @author Lasse Laasonen 2003 (lasse.laasonen-no.spam-tut.fi)
30 * @note reviewed 8 Jun 2004 by tr, jm, am, ll
31 * @note rating: red
32 */
33
34#include <fstream>
35
36#include <xercesc/util/XercesVersion.hpp>
37
38#if XERCES_VERSION_MAJOR >= 3
39#include <xercesc/dom/DOMLSParser.hpp>
40#include <xercesc/dom/DOMLSSerializer.hpp>
41#include <xercesc/dom/DOMDocument.hpp>
42#include <xercesc/dom/DOMLSOutput.hpp>
43#else
44#include <xercesc/dom/DOMWriter.hpp>
45#include <xercesc/dom/DOMBuilder.hpp>
46#endif
47
48#include <xercesc/dom/DOMImplementation.hpp>
49#include <xercesc/dom/DOMElement.hpp>
50#include <xercesc/dom/DOMText.hpp>
51#include <xercesc/dom/DOMNamedNodeMap.hpp>
52#include <xercesc/dom/DOMException.hpp>
53#include <xercesc/framework/LocalFileFormatTarget.hpp>
54#include <xercesc/util/PlatformUtils.hpp>
55#include <xercesc/validators/common/Grammar.hpp>
56#include <xercesc/sax/SAXException.hpp>
57#include <xercesc/dom/DOMException.hpp>
58#include <xercesc/util/XMLException.hpp>
59#include <xercesc/util/PlatformUtils.hpp>
60#include <xercesc/dom/DOMImplementationRegistry.hpp>
61#include <xercesc/framework/MemBufInputSource.hpp>
62#include <xercesc/framework/Wrapper4InputSource.hpp>
63#include <xercesc/framework/MemBufFormatTarget.hpp>
64
65#include "XMLSerializer.hh"
67#include "Conversion.hh"
68#include "FileSystem.hh"
69#include "Application.hh"
70#include "ObjectState.hh"
71
72using std::string;
73using std::ifstream;
74
75/**
76 * Constructor.
77 */
79 Serializer(), sourceFile_(""), destinationFile_(""), schemaFile_(""),
80 useSchema_(false), parser_(NULL), domImplementation_(NULL),
81 sourceString_(NULL), destinationString_(NULL), nsUri_("") {
82
83 XMLPlatformUtils::Initialize();
84
85 const XMLCh gLS[] = {chLatin_L, chLatin_S, chNull};
87 DOMImplementationRegistry::getDOMImplementation(gLS);
88
89#if XERCES_VERSION_MAJOR >= 3
90 parser_ = domImplementation_->createLSParser(
91 DOMImplementationLS::MODE_SYNCHRONOUS, 0);
92#else
93 parser_ = domImplementation_->createDOMBuilder(
94 DOMImplementationLS::MODE_SYNCHRONOUS, 0);
95#endif
96}
97
98/**
99 * Destructor.
100 */
102 delete parser_;
103 XMLPlatformUtils::Terminate();
104}
105
106/**
107 * Sets the source file used when readState is called.
108 *
109 * Previously set source file or string is unset.
110 *
111 * @param fileName Relative or absolute path of the source file, e.g.
112 * /home/openasip/file.xml or ./file.xml.
113 */
114void
115XMLSerializer::setSourceFile(const std::string& fileName) {
116 sourceFile_ = fileName;
117 sourceString_ = NULL;
118}
119
120/**
121 * Sets the source string used when readState is called.
122 *
123 * Previously set source file or string is unset.
124 *
125 * @param source Source string to read.
126 */
127void
128XMLSerializer::setSourceString(const std::string& source) {
129 sourceString_ = &source;
130 sourceFile_ = "";
131}
132
133/**
134 * Sets the destination file used when writeState is called.
135 *
136 * Previously set destination file or string is unset.
137 *
138 * @param fileName Relative or absolute path of the destination file,
139 * e.g. /home/openasip/file.xml or ./file.xml.
140 */
141void
142XMLSerializer::setDestinationFile(const std::string& fileName) {
143 destinationFile_ = fileName;
144 destinationString_ = NULL;
145}
146
147
148/**
149 * Sets the destination string used when writeState is called.
150 *
151 * Previously set destination file or string is unset.
152 *
153 * @param target Target string to write.
154 */
155void
157 destinationString_ = &target;
158 destinationFile_ = "";
159}
160
161/**
162 * Sets the schema file used to validate xml files.
163 *
164 * @param fileName Relative or absolute path of the schema file, e.g.
165 * /home/openasip/schema.xsd or ./schema.xsd.
166 */
167void
168XMLSerializer::setSchemaFile(const std::string& fileName) {
169 schemaFile_ = fileName;
170}
171
172/**
173 * Sets/unsets validation of xml files using xml schema.
174 *
175 * @param useSchema True sets and false unsets validation. Default value is
176 * false.
177 */
178void
180 useSchema_ = useSchema;
181}
182
183/**
184 * Sets the XML namespace URI to be used when creating a DOM document
185 *
186 */
187void
189 nsUri_ = nsUri;
190}
191
192/**
193 * Reads object state from a file or string.
194 *
195 * File is read if a source file is set with setSourceFile().
196 * String is read if a source string is set with setSourceString().
197 * Only the last file/string set will be read.
198 */
201 if (sourceFile_ != "") {
202 return readFile(sourceFile_);
203 } else if (sourceString_ != NULL) {
204 return readString(*sourceString_);
205 } else {
206 string errorMsg = "No Source file or string set.";
207 throw SerializerException(__FILE__, __LINE__, __func__, errorMsg);
208 }
209}
210
211/**
212 * Writes the given object state to a file or string.
213 *
214 * File is written if a destiantion file is set with setDestinationFile().
215 * String is written if a destination string is set with
216 * setDestinationString(). Only the last file/string set will be written.
217 */
218void
220 if (destinationFile_ != "") {
222 } else if (destinationString_ != NULL) {
224 } else {
225 string errorMsg = "No destination file or string set.";
226 throw SerializerException(__FILE__, __LINE__, __func__, errorMsg);
227 }
228}
229
230/**
231 * Initializes the XML parser.
232 */
233void
235
236 if (useSchema_ && schemaFile_ == "") {
237 string errorMsg = "No schema file set.";
238 throw SerializerException(__FILE__, __LINE__, __func__, errorMsg);
239 }
240
241 if (useSchema_) {
242
243 try {
245 } catch (UnreachableStream& exception) {
246 SerializerException error(__FILE__, __LINE__, __func__,
247 exception.errorMessage());
248
249 error.setCause(exception);
250 throw error;
251 }
252
253 string absoluteSchemaFile = schemaFile_;
254
255 // convert the given schemaFile path to absolute path if it isn't
257 absoluteSchemaFile = FileSystem::currentWorkingDir() +
259 }
260
261 XMLCh* filePath = Conversion::toXMLCh(absoluteSchemaFile);
262#if XERCES_VERSION_MAJOR >= 3
263 parser_->getDomConfig()->setParameter(XMLUni::fgXercesSchema, true);
264 parser_->getDomConfig()->setParameter(XMLUni::fgDOMValidate, true);
265 parser_->getDomConfig()->setParameter(XMLUni::fgDOMNamespaces, true);
266 parser_->getDomConfig()->setParameter(
267 XMLUni::fgXercesSchemaFullChecking, true);
268 parser_->getDomConfig()->setParameter(
269 XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation,
270 filePath);
271#else
272 parser_->setFeature(XMLUni::fgXercesSchema, true);
273 parser_->setFeature(XMLUni::fgDOMValidation, true);
274 parser_->setFeature(XMLUni::fgDOMNamespaces, true);
275 parser_->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
276 parser_->setProperty(
277 XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation,
278 filePath);
279#endif
280
281 XMLString::release(&filePath);
282 }
283#if XERCES_VERSION_MAJOR >= 3
284 parser_->getDomConfig()->setParameter(
285 XMLUni::fgDOMElementContentWhitespace, false);
286 parser_->getDomConfig()->setParameter(XMLUni::fgDOMComments, false);
287#else
288 parser_->setFeature(XMLUni::fgDOMWhitespaceInElementContent, false);
289 parser_->setFeature(XMLUni::fgDOMComments, false);
290#endif
291}
292
293/**
294 * Reads object state from an xml string.
295 *
296 * @param XML to read as an string containing the entire xml document.
297 * @return Root node of the created ObjectState tree.
298 * @exception SerializerException If an error occurs while reading.
299 */
301XMLSerializer::readString(const std::string& source) {
303 DOMDocument* dom = NULL;
305#if XERCES_VERSION_MAJOR >= 3
306 parser_->getDomConfig()->setParameter(
307 XMLUni::fgDOMErrorHandler, errHandler);
308#else
309 parser_->setErrorHandler(errHandler);
310#endif
311
312 // build the DOM object
313 try {
314 parser_->resetDocumentPool();
315
316 MemBufInputSource* buf = new MemBufInputSource(
317 (const XMLByte*)source.c_str(),
318 source.length(),
319 "sourceXML",
320 false);
321
322 Wrapper4InputSource* domBuf = new Wrapper4InputSource(buf);
323#if XERCES_VERSION_MAJOR >= 3
324 dom = parser_->parse(domBuf);
325#else
326 dom = parser_->parse(*domBuf);
327#endif
328 delete domBuf;
329 } catch(...) {
330 string errorLog = errHandler->errorLog();
331 delete errHandler;
332 throw SerializerException(__FILE__, __LINE__, __func__, errorLog);
333 }
334
335 int errors(errHandler->errorCount());
336
337 if (errors > 0) {
338 // if there were such errors in xml file or schema file that
339 // exception was not thrown when parseURI was called
340 string errorLog = errHandler->errorLog();
341 delete errHandler;
342 throw SerializerException(__FILE__, __LINE__, __func__, errorLog);
343 }
344
345 if (dom == NULL || dom->getDocumentElement() == NULL) {
346 delete errHandler;
348 __FILE__, __LINE__, __func__, "Illegal file: " + source);
349 }
350 ObjectState* rootState = createState(dom->getDocumentElement());
351 delete errHandler;
352 errHandler = NULL;
353
354 return rootState;
355}
356
357/**
358 * Reads current XML file set and creates an ObjectState tree according to
359 * it.
360 *
361 * The XML file is validated with the current schema file if the setting
362 * is on.
363 *
364 * @return Root node of the created ObjectState tree.
365 * @exception SerializerException If an error occurs while reading.
366 */
368XMLSerializer::readFile(const std::string& sourceFile) {
370 DOMDocument* dom = NULL;
371
372 if (sourceFile == "") {
373 string errorMsg = "No source file set.";
374 throw SerializerException(__FILE__, __LINE__, __func__, errorMsg);
375 }
376
377 // check validity of file stream
378 try {
380 } catch (UnreachableStream& exception) {
381 throw SerializerException(__FILE__, __LINE__, __func__,
382 exception.errorMessage());
383 }
384
386#if XERCES_VERSION_MAJOR >= 3
387 parser_->getDomConfig()->setParameter(
388 XMLUni::fgDOMErrorHandler, errHandler);
389#else
390 parser_->setErrorHandler(errHandler);
391#endif
392
393 try {
394 parser_->resetDocumentPool();
395 dom = parser_->parseURI(sourceFile.c_str());
396 } catch (const ErrorInExternalFile& exception) {
397
398 string errorLog = errHandler->errorLog();
399 delete errHandler;
400
401 throw SerializerException(__FILE__, __LINE__, __func__, errorLog);
402 }
403
404 if (dom == NULL || dom->getDocumentElement() == NULL) {
405 delete errHandler;
407 __FILE__, __LINE__, __func__, "Illegal file: " + sourceFile);
408
409 }
410
411
412 int errors(errHandler->errorCount());
413
414 if (errors > 0) {
415 // if there were such errors in xml file or schema file that
416 // exception was not thrown when parseURI was called
417 string errorLog = errHandler->errorLog();
418 delete errHandler;
419 throw SerializerException(__FILE__, __LINE__, __func__, errorLog);
420 }
421
422 ObjectState* rootState = createState(dom->getDocumentElement());
423
424 delete errHandler;
425 return rootState;
426}
427
428/**
429 * Writes the given ObjectState tree into the current XML file set.
430 *
431 * @param rootState The root object of the ObjectState tree.
432 * @exception SerializerException If the destination file cannot be written.
433 */
434void
436 const std::string& destinationFile, const ObjectState* rootState) {
437#if XERCES_VERSION_MAJOR >= 3
438 DOMLSSerializer* domWriter = domImplementation_->createLSSerializer();
439 domWriter->getDomConfig()->setParameter(
440 XMLUni::fgDOMWRTFormatPrettyPrint, true);
441 DOMLSOutput* lsOutput = domImplementation_->createLSOutput();
442#else
443 DOMWriter* domWriter = domImplementation_->createDOMWriter();
444 domWriter->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
445#endif
446 DOMDocument* document = createDOMDocument(rootState);
447
448 try {
449 if (!FileSystem::fileIsCreatable(destinationFile) &&
450 !FileSystem::fileIsWritable(destinationFile)) {
451 throw "";
452 }
453#if XERCES_VERSION_MAJOR >= 3
454 LocalFileFormatTarget targetFile(destinationFile.c_str());
455 lsOutput->setByteStream(&targetFile);
456 domWriter->write(document, lsOutput);
457 domWriter->release();
458 delete lsOutput;
459#else
460 LocalFileFormatTarget targetFile(destinationFile.c_str());
461 domWriter->writeNode(&targetFile, *document);
462 domWriter->release();
463 delete document;
464#endif
465 } catch (...) {
466#if XERCES_VERSION_MAJOR >= 3
467 domWriter->release();
468 delete lsOutput;
469#else
470 delete document;
471#endif
472 string errorMessage = "Cannot write to " + destinationFile;
473 throw SerializerException(__FILE__, __LINE__, __func__,
474 errorMessage);
475 }
476}
477
478/**
479 * Writes the given ObjectState tree to a target string.
480 *
481 * @param rootState The root object of the ObjectState tree.
482 * @exception SerializerException If the destination file cannot be written.
483 */
484void
485XMLSerializer::writeString(std::string& target, const ObjectState* rootState) {
486#if XERCES_VERSION_MAJOR >= 3
487 DOMLSSerializer* domWriter = domImplementation_->createLSSerializer();
488 domWriter->getDomConfig()->setParameter(
489 XMLUni::fgDOMWRTFormatPrettyPrint, true);
490 DOMLSOutput* lsOutput = domImplementation_->createLSOutput();
491#else
492 DOMWriter* domWriter = domImplementation_->createDOMWriter();
493 domWriter->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
494#endif
495 DOMDocument* document = createDOMDocument(rootState);
496
497 try {
498 target.clear();
499#if XERCES_VERSION_MAJOR >= 3
500 MemBufFormatTarget* buf = new MemBufFormatTarget();
501 lsOutput->setByteStream(buf);
502 domWriter->write(document, lsOutput);
503#else
504 MemBufFormatTarget* buf = new MemBufFormatTarget();
505 domWriter->writeNode(buf, *document);
506#endif
507 target.append((char*)(buf->getRawBuffer()));
508 domWriter->release();
509 delete buf;
510 delete document;
511 } catch (...) {
512 domWriter->release();
513 delete document;
514 string errorMessage = "Error writing xml to a string.";
515 throw SerializerException(__FILE__, __LINE__, __func__,
516 errorMessage);
517 }
518}
519
520/**
521 * Returns the source file that is set.
522 *
523 * @return The source file.
524 */
525std::string
527 return sourceFile_;
528}
529
530/**
531 * Creates a DOM tree according to the given ObjectState tree.
532 *
533 * @param state Root node of the ObjectState tree.
534 * @return The created DOM tree.
535 */
536DOMDocument*
538
539 XMLCh* nsUri = NULL;
540 if (!nsUri_.empty()) {
542 }
543 XMLCh* docName = Conversion::toXMLCh(state->name());
544 DOMDocument* doc = domImplementation_->createDocument(nsUri, docName, 0);
545 XMLString::release(&docName);
546 if (nsUri != NULL) {
547 XMLString::release(&nsUri);
548 nsUri = NULL;
549 }
550 DOMElement* rootElem = doc->getDocumentElement();
551
552 for (int i = 0; i < state->attributeCount(); i++) {
553 ObjectState::Attribute* attribute = state->attribute(i);
554 XMLCh* attribName = Conversion::toXMLCh(attribute->name);
555 XMLCh* attribValue = Conversion::toXMLCh(attribute->value);
556 rootElem->setAttribute(attribName, attribValue);
557 XMLString::release(&attribName);
558 XMLString::release(&attribValue);
559 }
560
561 string value = state->stringValue();
562 if (value != "") {
563 XMLCh* nodeValue = Conversion::toXMLCh(value);
564 DOMText* valueNode = doc->createTextNode(nodeValue);
565 rootElem->appendChild(valueNode);
566 XMLString::release(&nodeValue);
567 }
568
569 for (int i = 0; i < state->childCount(); i++) {
570 ObjectState* childState = state->child(i);
571 DOMElement* childElement = createDOM(childState, doc);
572 rootElem->appendChild(childElement);
573 }
574
575 return doc;
576}
577
578
579
580/**
581 * Checks that the file is OK for reading.
582 *
583 * @param fileName Name of the XML file.
584 * @exception UnreachableStream If the given file cannot be read.
585 */
586void
587XMLSerializer::ensureValidStream(const std::string& fileName) const {
588 ifstream filestream;
589 filestream.open(fileName.c_str());
590 if(!filestream.is_open() || !filestream.good()) {
591 filestream.close();
592 string procName = "XMLSerializer::ensureValidStream";
593 string errorMessage = "Cannot open file \'";
594 errorMessage += fileName;
595 errorMessage += "\'.";
596 throw UnreachableStream(__FILE__, __LINE__, procName, errorMessage);
597 }
598 filestream.close();
599}
600
601/**
602 * Creates DOM tree from the given ObjectState tree.
603 *
604 * @param state Root node of the ObjectState tree.
605 * @param doc The DOMDocument to which the created DOM tree
606 * belongs.
607 */
608DOMElement*
610 ObjectState* state,
611 DOMDocument* doc) const {
612
613 XMLCh* elemName = Conversion::toXMLCh(state->name());
614 DOMElement* rootElem =
615 doc->createElement(elemName);
616 XMLString::release(&elemName);
617
618 for (int i = 0; i < state->attributeCount(); i++) {
619 ObjectState::Attribute* attribute = state->attribute(i);
620 XMLCh* attribName = Conversion::toXMLCh(attribute->name);
621 XMLCh* attribValue = Conversion::toXMLCh(attribute->value);
622 rootElem->setAttribute(attribName, attribValue);
623 XMLString::release(&attribName);
624 XMLString::release(&attribValue);
625 }
626
627 if (state->childCount() == 0) {
628 if (state->stringValue() != "") {
629 XMLCh* text = Conversion::toXMLCh(state->stringValue());
630 DOMText* value = doc->createTextNode(text);
631 rootElem->appendChild(value);
632 XMLString::release(&text);
633 }
634 }
635
636 for (int i = 0; i < state->childCount(); i++) {
637 ObjectState* childState = state->child(i);
638 rootElem->appendChild(createDOM(childState, doc));
639 }
640
641 return rootElem;
642}
643
644
645/**
646 * Creates a one-to-one ObjectState object (tree) according to the given
647 * DOMNode.
648 *
649 * @param node DOMNode from which the ObjectState is created.
650 * @return The created ObjectState instance (tree).
651 */
653XMLSerializer::createState(const DOMNode* node) const {
654 ObjectState* state =
655 new ObjectState(Conversion::XMLChToString(node->getNodeName()));
656 DOMNamedNodeMap* attributes = node->getAttributes();
657
658 // set the attributes
659 if (attributes != NULL) {
660 for (unsigned int i = 0; i < attributes->getLength(); i++) {
661 DOMNode* attribute = attributes->item(i);
662 state->setAttribute(
663 Conversion::XMLChToString(attribute->getNodeName()),
664 Conversion::XMLChToString(attribute->getNodeValue()));
665 }
666 }
667
668 DOMNode* child = node->getFirstChild();
669 while (child != NULL) {
670 if (child->getNodeType() == DOMNode::ELEMENT_NODE) {
671 state->addChild(createState(child));
672 }
673 child = child->getNextSibling();
674 }
675
676 // if node has no child elements, read its value
677 if (!hasChildElementNodes(node)) {
678 if (node->getFirstChild() != NULL) {
679 state->setValue(Conversion::XMLChToString(node->getFirstChild()->
680 getNodeValue()));
681 }
682 }
683
684 return state;
685}
686
687
688/**
689 * Returns true if the given node has child elements.
690 *
691 * @param node Node.
692 * @return True if the node has child elements, otherwise false.
693 */
694bool
695XMLSerializer::hasChildElementNodes(const DOMNode* node) const {
696 DOMNode* child = node->getFirstChild();
697 while (child != NULL) {
698 if (child->getNodeType() == DOMNode::ELEMENT_NODE) {
699 return true;
700 }
701 child = child->getNextSibling();
702 }
703 return false;
704}
#define __func__
find Finds info of the inner loops in the false
static std::string XMLChToString(const XMLCh *source)
static XMLCh * toXMLCh(const std::string &string)
std::string errorMessage() const
Definition Exception.cc:123
void setCause(const Exception &cause)
Definition Exception.cc:75
static bool isRelativePath(const std::string &pathName)
static const std::string DIRECTORY_SEPARATOR
static std::string currentWorkingDir()
static bool fileIsWritable(const std::string fileName)
static bool fileIsCreatable(const std::string fileName)
Attribute * attribute(int index) const
void setAttribute(const std::string &name, const std::string &value)
void setValue(const std::string &value)
int attributeCount() const
ObjectState * child(int index) const
void addChild(ObjectState *child)
std::string stringValue() const
std::string name() const
int childCount() const
DOMImplementation * domImplementation_
Implementation of the DOM.
const std::string * sourceString_
Source string to read.
DOMElement * createDOM(ObjectState *state, DOMDocument *doc) const
void setUseSchema(bool useSchema)
virtual void writeString(std::string &target, const ObjectState *rootState)
std::string schemaFile_
Schema file path.
bool useSchema_
Indicates if xml file is validated using schema.
bool hasChildElementNodes(const DOMNode *node) const
void setSourceString(const std::string &source)
void setSchemaFile(const std::string &fileName)
void ensureValidStream(const std::string &fileName) const
void setXMLNamespace(std::string nsUri)
virtual ObjectState * readString(const std::string &source)
void setSourceFile(const std::string &fileName)
std::string sourceFile() const
virtual ~XMLSerializer()
std::string sourceFile_
Source file path.
DOMDocument * createDOMDocument(const ObjectState *state) const
std::string destinationFile_
Destination file path.
virtual void writeState(const ObjectState *rootState)
void setDestinationFile(const std::string &fileName)
virtual ObjectState * readFile(const std::string &fileName)
DOMBuilder * parser_
The parser that checks the XML file for errors with the Schema.
std::string * destinationString_
Destination string to write.
void initializeParser()
virtual ObjectState * readState()
virtual void writeFile(const std::string &fileName, const ObjectState *rootState)
ObjectState * createState(const DOMNode *node) const
void setDestinationString(std::string &destination)
std::string nsUri_
XML namespace URI.
Struct for describing an attribute of the XML element.
std::string value
Value of the attribute.
std::string name
Name of the attribute.