mbxmlutils  1.3.0
Multi-Body XML Utils
dom.h
1 #ifndef _MBXMLUTILSHELPER_DOM_H_
2 #define _MBXMLUTILSHELPER_DOM_H_
3 
4 #include <fmatvec/atom.h>
5 #include <string>
6 #include <utility>
7 #include <vector>
8 #include <map>
9 #include <set>
10 #include <boost/filesystem.hpp>
11 #include <xercesc/dom/DOMErrorHandler.hpp>
12 #include <xercesc/dom/DOMElement.hpp>
13 #include <xercesc/dom/DOMText.hpp>
14 #include <xercesc/dom/DOMLSParser.hpp>
15 #include <xercesc/dom/DOMLocator.hpp>
16 #include <xercesc/dom/DOMUserDataHandler.hpp>
17 #include <xercesc/dom/DOMDocument.hpp>
18 #include <xercesc/util/TransService.hpp>
19 #include <xercesc/util/XMLEntityResolver.hpp>
20 #include <xercesc/framework/psvi/PSVIHandler.hpp>
21 #include <boost/lexical_cast.hpp>
22 #include <fmatvec/toString.h>
23 
24 namespace XERCES_CPP_NAMESPACE {
25  class DOMProcessingInstruction;
26  class DOMImplementation;
27  class AbstractDOMParser;
28 }
29 
30 namespace boost {
31  template<> std::vector<double> lexical_cast(const std::string& str);
32  template<> std::vector<std::vector<double>> lexical_cast(const std::string& str);
33  template<> std::vector<int> lexical_cast(const std::string& str);
34  template<> std::vector<std::vector<int>> lexical_cast(const std::string& str);
35  template<> bool lexical_cast<bool>(const std::string& arg);
36 }
37 
38 namespace {
39 
40 template<class T>
41 struct CheckSize {
42  static void check(const xercesc::DOMElement *me, const T &value, int r, int c);
43 };
44 template<class T>
45 struct CheckSize<std::vector<T>> {
46  static void check(const xercesc::DOMElement *me, const std::vector<T> &value, int r, int c);
47 };
48 template<class T>
49 struct CheckSize<std::vector<std::vector<T>>> {
50  static void check(const xercesc::DOMElement *me, const std::vector<std::vector<T>> &value, int r, int c);
51 };
52 
53 }
54 
55 namespace MBXMLUtils {
56 
57 // forward declaration
58 template<typename DOMDocumentType>
60 template<typename DOMDocumentType>
61 DOMDocumentWrapper<DOMDocumentType> D(DOMDocumentType *me);
62 template<typename DOMElementType>
64 template<typename DOMElementType>
65 DOMElementWrapper<DOMElementType> E(DOMElementType *me);
66 
68 class InitXerces {
69  public:
70  InitXerces() {
71  xercesc::XMLPlatformUtils::Initialize();
72  }
73  ~InitXerces() {
74  xercesc::XMLPlatformUtils::Terminate();
75  }
76 };
77 
80 class X {
81  public:
82  const XMLCh *operator%(const std::string &str) {
83  if(str.empty())
84  return &xercesc::chNull;
85  const XMLCh *unicode=xercesc::TranscodeFromStr(reinterpret_cast<const XMLByte*>(str.c_str()), str.length(), "UTF8").adopt();
86  store.push_back(std::shared_ptr<const XMLCh>(unicode, &releaseXMLCh));
87  return unicode;
88  }
89  const XMLCh *operator()(const std::string &str) { return operator%(str); }
90  std::string operator%(const XMLCh *unicode) {
91  if(!unicode || unicode[0]==0)
92  return std::string();
93  return reinterpret_cast<const char*>(xercesc::TranscodeToStr(unicode, "UTF8").str());
94  }
95  std::string operator()(const XMLCh *unicode) { return operator%(unicode); }
96  static void releaseXMLCh(const XMLCh *s) { xercesc::XMLPlatformUtils::fgMemoryManager->deallocate(const_cast<XMLCh*>(s)); }
97  private:
98  std::vector<std::shared_ptr<const XMLCh> > store;
99 };
100 
103 class FQN : public std::pair<std::string, std::string> {
104  public:
106  FQN() {}
108  FQN(const std::string &name) : std::pair<std::string, std::string>("", name) {}
110  FQN(const char *name) : std::pair<std::string, std::string>("", name) {}
112  FQN(const std::string &ns, const std::string &name) : std::pair<std::string, std::string>(ns, name) {}
113 };
114 
117  public:
118  NamespaceURI(std::string nsuri_) : nsuri(std::move(nsuri_)) {}
119  FQN operator%(const std::string &localName) const { return FQN(nsuri, localName); }
120  std::string getNamespaceURI() const { return nsuri; }
121  private:
122  std::string nsuri;
123 };
124 
126 const NamespaceURI XINCLUDE("http://www.w3.org/2001/XInclude");
128 const NamespaceURI XMLNS("http://www.w3.org/2000/xmlns/");
130 const NamespaceURI PV("http://www.mbsim-env.de/MBXMLUtils");
131 
134 class EmbedDOMLocator : public xercesc::DOMLocator {
135  public:
136  EmbedDOMLocator(const boost::filesystem::path &file_, int row_, int embedCount_, std::string xpath_) : DOMLocator(),
137  file(x%file_.string()), row(row_), embedCount(embedCount_), xpath(std::move(xpath_)) {}
138  EmbedDOMLocator(const EmbedDOMLocator &src) : DOMLocator(),
139  file(x%(X()%src.file)), row(src.row), embedCount(src.embedCount), xpath(src.xpath) {}
140  EmbedDOMLocator& operator=(const EmbedDOMLocator &src) {
141  file=x%(X()%src.file);
142  row=src.row;
143  embedCount=src.embedCount;
144  xpath=src.xpath;
145  return *this;
146  }
147  ~EmbedDOMLocator() = default;
148  EmbedDOMLocator(const EmbedDOMLocator &&src) = delete;
149  EmbedDOMLocator& operator=(const EmbedDOMLocator &&src) = delete;
150  XMLFileLoc getLineNumber() const override { return row; }
151  XMLFileLoc getColumnNumber() const override { return 0; }
152  XMLFilePos getByteOffset() const override { return ~(XMLFilePos(0)); }
153  XMLFilePos getUtf16Offset() const override { return ~(XMLFilePos(0)); }
154  xercesc::DOMNode *getRelatedNode() const override { return nullptr; }
155  const XMLCh *getURI() const override { return file; }
156  int getEmbedCount() const { return embedCount; }
157  std::string getRootXPathExpression() const { return xpath; }
158  private:
159  X x;
160  const XMLCh *file;
161  int row;
162  int embedCount;
163  std::string xpath;
164 };
165 
166 // Exception wrapping for DOMEvalException.
167 // Rethrow a exception as DOMEvalException with context e, a DOMEvalException is just rethrown unchanged.
168 #define RETHROW_AS_DOMEVALEXCEPTION(e) \
169  catch(MBXMLUtils::DOMEvalException &ex) { \
170  throw; \
171  } \
172  catch(const std::exception &ex) { \
173  throw DOMEvalException(ex.what(), e); \
174  }
175 
178 class DOMEvalException : public std::exception {
179  friend class DOMParser;
180  public:
181  DOMEvalException() = default;
182  DOMEvalException(const std::string &errorMsg_, const xercesc::DOMNode *n);
183  DOMEvalException(const std::string &errorMsg_, const xercesc::DOMLocator &loc);
184  DOMEvalException(const DOMEvalException &src) : errorMsg(src.errorMsg),
185  locationStack(src.locationStack) {}
186  DOMEvalException &operator=(const DOMEvalException &src) {
187  errorMsg=src.errorMsg; locationStack=src.locationStack;
188  return *this;
189  }
190  ~DOMEvalException() noexcept override = default;
191  void appendContext(const xercesc::DOMNode *n, int lineNr=0);
192  const std::string& getMessage() const { return errorMsg; }
193  void setMessage(const std::string& errorMsg_) { errorMsg=errorMsg_; }
194  void setSubsequentError(bool sse) { subsequentError=sse; }
195  const char* what() const noexcept override;
196  private:
219  static std::string convertToString(const EmbedDOMLocator &loc, const std::string &message, bool subsequentError=false);
220 
221  bool subsequentError{false};
222  std::string errorMsg;
223  std::vector<EmbedDOMLocator> locationStack;
224  mutable std::string whatStr;
225 };
226 
228 class DOMErrorPrinter: public xercesc::DOMErrorHandler, virtual public fmatvec::Atom
229 {
230  public:
231  DOMErrorPrinter() = default;
232  bool handleError(const xercesc::DOMError&) override;
233  bool hasError() { return errorSet; }
234  const DOMEvalException& getError() { return error; }
235  void resetError() { errorSet=false; }
236  private:
237  bool errorSet{false};
238  DOMEvalException error;
239 };
240 
242 template<typename DOMElementType>
243 class DOMElementWrapper {
244  public:
246  DOMElementWrapper(DOMElementType *me_) : me(me_) {}
248  FQN getTagName() const { return FQN(X()%me->getNamespaceURI(), X()%me->getLocalName()); }
250  const xercesc::DOMElement *getFirstElementChildNamed(const FQN &name) const;
252  xercesc::DOMElement *getFirstElementChildNamed(const FQN &name);
254  const xercesc::DOMElement *getNextElementSiblingNamed(const FQN &name) const;
256  xercesc::DOMElement *getNextElementSiblingNamed(const FQN &name);
258  const xercesc::DOMProcessingInstruction *getFirstProcessingInstructionChildNamed(const std::string &target) const;
260  xercesc::DOMProcessingInstruction *getFirstProcessingInstructionChildNamed(const std::string &target);
262  const xercesc::DOMText *getFirstTextChild() const;
264  xercesc::DOMText *getFirstTextChild();
266  template<class T> T getText(int r=0, int c=0) const {
267  try {
268  auto ret=boost::lexical_cast<T>(X()%E(me)->getFirstTextChild()->getData());
269  CheckSize<T>::check(me, ret, r, c);
270  return ret;
271  }
272  catch(const boost::bad_lexical_cast &ex) {
273  throw DOMEvalException(ex.what(), me);
274  }
275  catch(const std::exception &ex) {
276  throw DOMEvalException(ex.what(), me);
277  }
278  }
279 
280  template<class T> void addElementText(const FQN &name, const T &value) {
281  xercesc::DOMElement *ele=D(me->getOwnerDocument())->createElement(name);
282  ele->insertBefore(me->getOwnerDocument()->createTextNode(MBXMLUtils::X()%fmatvec::toString(value)), nullptr);
283  me->insertBefore(ele, nullptr);
284  }
287  bool isDerivedFrom(const FQN &baseTypeName) const;
293  boost::filesystem::path getOriginalFilename(bool skipThis=false,
294  const xercesc::DOMElement *&found=DOMElementWrapper<DOMElementType>::dummyArg) const;
298  void setOriginalFilename();
301  boost::filesystem::path convertPath(const boost::filesystem::path &relPath) const;
304  int getLineNumber() const;
307  int getEmbedCountNumber() const;
310  void setEmbedCountNumber(int embedCount);
313  int getEmbedXPathCount() const;
316  void setEmbedXPathCount(int xPathCount);
319  std::string getRootXPathExpression() const;
321  int getOriginalElementLineNumber() const;
323  void setOriginalElementLineNumber(int lineNr);
325  std::string getAttribute(const FQN &name) const;
327  FQN getAttributeQName(const FQN &name) const;
329  const xercesc::DOMAttr* getAttributeNode(const FQN &name) const;
331  xercesc::DOMAttr* getAttributeNode(const FQN &name);
333  template<class T>
334  void setAttribute(const FQN &name, const T &value) {
335  me->setAttributeNS(X()%name.first, X()%name.second, X()%fmatvec::toString(value));
336  }
338  void setAttribute(const FQN &name, const FQN &value);
340  bool hasAttribute(const FQN &name) const;
342  void removeAttribute(const FQN &name);
346  typename std::conditional<std::is_same<DOMElementType, const xercesc::DOMElement>::value,
348  return this;
349  }
350  static const xercesc::DOMElement *dummyArg;
351  private:
352  DOMElementType *me;
353 };
355 template<typename DOMElementType>
356 DOMElementWrapper<DOMElementType> E(DOMElementType *me) { return DOMElementWrapper<DOMElementType>(me); }
358 template<typename DOMElementType>
359 DOMElementWrapper<DOMElementType> E(std::shared_ptr<DOMElementType> me) { return DOMElementWrapper<DOMElementType>(me.get()); }
360 
361 template<> const xercesc::DOMElement *DOMElementWrapper< xercesc::DOMElement>::dummyArg;
362 template<> const xercesc::DOMElement *DOMElementWrapper<const xercesc::DOMElement>::dummyArg;
363 
365 template<typename DOMAttrType>
367  public:
369  DOMAttrWrapper(DOMAttrType *me_) : me(me_) {}
372  bool isDerivedFrom(const FQN &baseTypeName) const;
375  std::string getRootXPathExpression() const;
377  typename std::conditional<std::is_same<DOMAttrType, const xercesc::DOMAttr>::value,
379  return this;
380  }
381  private:
382  DOMAttrType *me;
383 };
385 template<typename DOMAttrType>
386 DOMAttrWrapper<DOMAttrType> A(DOMAttrType *me) { return DOMAttrWrapper<DOMAttrType>(me); }
388 template<typename DOMAttrType>
389 DOMAttrWrapper<DOMAttrType> A(std::shared_ptr<DOMAttrType> me) { return DOMAttrWrapper<DOMAttrType>(me.get()); }
390 
391 class DOMParser;
392 
394 template<typename DOMDocumentType>
395 class DOMDocumentWrapper {
396  public:
398  DOMDocumentWrapper(DOMDocumentType *me_) : me(me_) {}
400  void validate();
403  xercesc::DOMElement* createElement(const FQN &name);
408  boost::filesystem::path getDocumentFilename() const;
412  xercesc::DOMNode* evalRootXPathExpression(std::string xpathExpression, xercesc::DOMElement* context=nullptr);
414  typename std::conditional<std::is_same<DOMDocumentType, const xercesc::DOMDocument>::value,
416  return this;
417  }
418  private:
419  DOMDocumentType *me;
420 };
422 template<typename DOMDocumentType>
423 DOMDocumentWrapper<DOMDocumentType> D(DOMDocumentType *me) { return DOMDocumentWrapper<DOMDocumentType>(me); }
425 template<typename DOMDocumentType>
426 DOMDocumentWrapper<DOMDocumentType> D(std::shared_ptr<DOMDocumentType> me) { return DOMDocumentWrapper<DOMDocumentType>(me.get()); }
427 
428 class LocationInfoFilter : public xercesc::DOMLSParserFilter {
429  public:
430  void setParser(DOMParser *parser_) { parser=parser_; }
431  xercesc::DOMLSParserFilter::FilterAction acceptNode(xercesc::DOMNode *n) override;
432  xercesc::DOMLSParserFilter::FilterAction startElement(xercesc::DOMElement *e) override;
433  xercesc::DOMNodeFilter::ShowType getWhatToShow() const override;
434  private:
435  DOMParser *parser;
436  static const std::string lineNumberKey;
437 };
438 
439 class TypeDerivativeHandler : public xercesc::PSVIHandler, virtual public fmatvec::Atom {
440  public:
441  void setParser(DOMParser *parser_) { parser=parser_; }
442  void handleElementPSVI(const XMLCh *localName, const XMLCh *uri, xercesc::PSVIElement *info) override;
443  void handleAttributesPSVI(const XMLCh *localName, const XMLCh *uri, xercesc::PSVIAttributeList *psviAttributes) override;
444  private:
445  DOMParser *parser;
446 };
447 
448 class DOMParserUserDataHandler : public xercesc::DOMUserDataHandler {
449  public:
450  void handle(DOMOperationType operation, const XMLCh* key, void *data, const xercesc::DOMNode *src, xercesc::DOMNode *dst) override;
451 };
452 
453 class EntityResolver : public xercesc::XMLEntityResolver {
454  public:
455  void setParser(DOMParser *parser_) { parser=parser_; }
456  xercesc::InputSource* resolveEntity(xercesc::XMLResourceIdentifier *resourceIdentifier) override;
457  private:
458  DOMParser *parser;
459 };
460 
462 class DOMParser : public std::enable_shared_from_this<DOMParser> {
463  friend bool isDerivedFrom(const xercesc::DOMNode *me, const FQN &baseTypeName);
464  friend class TypeDerivativeHandler;
465  friend class LocationInfoFilter;
466  friend class DOMParserUserDataHandler;
467  friend class EntityResolver;
468  template<typename> friend class DOMDocumentWrapper;
469  public:
471  static std::shared_ptr<DOMParser> create(const std::set<boost::filesystem::path> &schemas={});
475  std::shared_ptr<xercesc::DOMDocument> parse(const boost::filesystem::path &inputSource,
476  std::vector<boost::filesystem::path> *dependencies=nullptr, bool doXInclude=true);
479  static void serialize(xercesc::DOMNode *n, const boost::filesystem::path &outputSource, bool prettyPrint=true);
482  static void serializeToString(xercesc::DOMNode *n, std::string &outputData, bool prettyPrint=true);
484  void resetCachedGrammarPool();
488  static void handleCDATA(xercesc::DOMElement *e);
489  private:
490  static const std::string domParserKey;
491 
492  // Load XML Schema grammar file: is actually loaded (the main XML Schema file of a XML file must be loaded direclty)
493  void loadGrammar(const boost::filesystem::path &schemaFilename);
494  // Register XML Schema grammar file: is loaded on demand if needed by another XML Schema
495  void registerGrammar(const std::shared_ptr<DOMParser> &nonValParser, const boost::filesystem::path &schemaFilename);
496 
497  xercesc::DOMImplementation *domImpl;
498  DOMParser(const std::set<boost::filesystem::path> &schemas);
500  std::map<FQN, xercesc::XSTypeDefinition*> typeMap;
501  DOMErrorPrinter errorHandler;
502  LocationInfoFilter locationFilter;
503  TypeDerivativeHandler typeDerHandler;
504  EntityResolver entityResolver;
505  static DOMParserUserDataHandler userDataHandler;
506  std::map<std::string, boost::filesystem::path> registeredGrammar;
507 
508  static void handleXInclude(xercesc::DOMElement *&e, std::vector<boost::filesystem::path> *dependencies);
509 };
510 
511 }
512 
513 namespace {
514 
515 template<class T>
516 void CheckSize<T>::check(const xercesc::DOMElement *me, const T &value, int r, int c) {}
517 template<class T>
518 void CheckSize<std::vector<T>>::check(const xercesc::DOMElement *me, const std::vector<T> &value, int r, int c) {
519  if(r!=0 && r!=static_cast<int>(value.size()))
520  throw MBXMLUtils::DOMEvalException("Expected vector of size "+fmatvec::toString(r)+
521  " but got vector of size "+fmatvec::toString(value.size())+".", me);
522 }
523 template<class T>
524 void CheckSize<std::vector<std::vector<T>>>::check(const xercesc::DOMElement *me, const std::vector<std::vector<T>> &value, int r, int c) {
525  if(r!=0 && r!=static_cast<int>(value.size()))
526  throw MBXMLUtils::DOMEvalException("Expected matrix of row-size "+fmatvec::toString(r)+
527  " but got matrix of row-size "+fmatvec::toString(value.size())+".", me);
528  if(!value.empty() && c!=0 && c!=static_cast<int>(value[0].size()))
529  throw MBXMLUtils::DOMEvalException("Expected matrix of col-size "+fmatvec::toString(c)+
530  " but got matrix of col-size "+fmatvec::toString(value[0].size())+".", me);
531 }
532 
533 }
534 
535 #endif
const xercesc::DOMText * getFirstTextChild() const
Get first child text.
Definition: dom.cc:238
xercesc::DOMElement * createElement(const FQN &name)
Definition: dom.cc:554
void validate()
(re)validate the document using the parser this document was created
Definition: dom.cc:523
FQN(const char *name)
Anonymous FQN (required for implicit casting of string literals to anonymous FQNs)
Definition: dom.h:110
int getOriginalElementLineNumber() const
Get the line number of the original element.
Definition: dom.cc:446
std::string getRootXPathExpression() const
Definition: dom.cc:408
Definition: dom.h:103
std::shared_ptr< xercesc::DOMDocument > parse(const boost::filesystem::path &inputSource, std::vector< boost::filesystem::path > *dependencies=nullptr, bool doXInclude=true)
Definition: dom.cc:936
FQN getTagName() const
Get full qualified tag name.
Definition: dom.h:248
void workaroundDefaultAttributesOnImportNode()
Workaround: convert default attributes to normal attributes (must be used before importNode to also i...
Definition: dom.cc:463
xercesc::DOMNode * evalRootXPathExpression(std::string xpathExpression, xercesc::DOMElement *context=nullptr)
Definition: dom.cc:590
void setEmbedCountNumber(int embedCount)
Definition: dom.cc:383
std::conditional< std::is_same< DOMElementType, const xercesc::DOMElement >::value, const DOMElementWrapper *, DOMElementWrapper * >::type operator->()
Treat this object as a pointer (like DOMElement*)
Definition: dom.h:347
Helper class to easily construct full qualified XML names (FQN) using XML namespace prefixes.
Definition: dom.h:116
FQN(const std::string &ns, const std::string &name)
FQN.
Definition: dom.h:112
const xercesc::DOMAttr * getAttributeNode(const FQN &name) const
Get attribute node named name.
Definition: dom.cc:314
FQN(const std::string &name)
Anonymous FQN.
Definition: dom.h:108
Definition: dom.h:453
Definition: dom.h:428
FQN()
Empty FQN.
Definition: dom.h:106
void setAttribute(const FQN &name, const T &value)
Set attribute.
Definition: dom.h:334
bool isDerivedFrom(const FQN &baseTypeName) const
Definition: dom.cc:508
Definition: dom.h:80
Helper class for extending DOMDocument (use the function D(...)).
Definition: dom.h:59
DOMElementWrapper(DOMElementType *me_)
Wrap DOMElement to my special element.
Definition: dom.h:246
T getText(int r=0, int c=0) const
Get the child text as type T.
Definition: dom.h:266
void setEmbedXPathCount(int xPathCount)
Definition: dom.cc:400
std::string toString(const std::vector< std::vector< T >> &value, int precision=0)
bool isDerivedFrom(const FQN &baseTypeName) const
Definition: dom.cc:499
FQN getAttributeQName(const FQN &name) const
Get attribute named name of type QName.
Definition: dom.cc:303
bool hasAttribute(const FQN &name) const
check if this element has a attibute named name.
Definition: dom.cc:477
int getLineNumber() const
Definition: dom.cc:360
Definition: dom.h:134
Initialize Xerces on load and terminate it on unload of the library/program.
Definition: dom.h:68
boost::filesystem::path convertPath(const boost::filesystem::path &relPath) const
Definition: dom.cc:289
std::string getRootXPathExpression() const
Definition: dom.cc:514
static std::shared_ptr< DOMParser > create(const std::set< boost::filesystem::path > &schemas={})
Create DOM parser.
Definition: dom.cc:811
static void handleCDATA(xercesc::DOMElement *e)
handle CDATA sections
Definition: dom.cc:894
const xercesc::DOMElement * getNextElementSiblingNamed(const FQN &name) const
Get next sibling element of the specified full qualified name.
Definition: dom.cc:198
Definition: dom.h:178
const xercesc::DOMElement * getFirstElementChildNamed(const FQN &name) const
Get first child element of the specified full qualified name.
Definition: dom.cc:181
Helper class for extending DOMAttr (use the function A(...)).
Definition: dom.h:366
void setOriginalElementLineNumber(int lineNr)
Set the line number of the original element.
Definition: dom.cc:455
static std::string convertToString(const EmbedDOMLocator &loc, const std::string &message, bool subsequentError=false)
Definition: dom.cc:686
boost::filesystem::path getOriginalFilename(bool skipThis=false, const xercesc::DOMElement *&found=DOMElementWrapper< DOMElementType >::dummyArg) const
Definition: dom.cc:255
void resetCachedGrammarPool()
reset all loaded grammars
Definition: dom.cc:1025
Print DOM error messages.
Definition: dom.h:228
Helper class for extending DOMElement (use the function E(...)).
Definition: dom.h:63
boost::filesystem::path getDocumentFilename() const
Definition: dom.cc:568
void removeAttribute(const FQN &name)
remove from this element the attibute named name.
Definition: dom.cc:369
std::shared_ptr< DOMParser > getParser() const
Get full qualified tag name.
Definition: dom.cc:562
A XML DOM parser.
Definition: dom.h:462
const xercesc::DOMProcessingInstruction * getFirstProcessingInstructionChildNamed(const std::string &target) const
Get first child processing instruction of the specified target.
Definition: dom.cc:215
std::conditional< std::is_same< DOMAttrType, const xercesc::DOMAttr >::value, const DOMAttrWrapper *, DOMAttrWrapper * >::type operator->()
Treat this object as a pointer (like DOMAttr*)
Definition: dom.h:378
DOMAttrWrapper(DOMAttrType *me_)
Wrap DOMAttr to my special element.
Definition: dom.h:369
DOMDocumentWrapper(DOMDocumentType *me_)
Wrap DOMDocument to my special element.
Definition: dom.h:398
static void serialize(xercesc::DOMNode *n, const boost::filesystem::path &outputSource, bool prettyPrint=true)
Definition: dom.cc:990
std::shared_ptr< xercesc::DOMDocument > createDocument()
create a empty document
Definition: dom.cc:1030
void setOriginalFilename()
Definition: dom.cc:281
static void serializeToString(xercesc::DOMNode *n, std::string &outputData, bool prettyPrint=true)
Definition: dom.cc:1001
std::conditional< std::is_same< DOMDocumentType, const xercesc::DOMDocument >::value, const DOMDocumentWrapper *, DOMDocumentWrapper * >::type operator->()
Treat this object as a pointer (like DOMDocument*)
Definition: dom.h:415
int getEmbedCountNumber() const
Definition: dom.cc:374
int getEmbedXPathCount() const
Definition: dom.cc:391
std::string getAttribute(const FQN &name) const
Get attribute named name.
Definition: dom.cc:297