Yate
yatexml.h
1 
22 #ifndef __YATEXML_H
23 #define __YATEXML_H
24 
25 #ifndef __cplusplus
26 #error C++ is required
27 #endif
28 
29 #include <yateclass.h>
30 
34 namespace TelEngine {
35 
36 class XmlSaxParser;
37 class XmlDomParser;
38 class XmlDeclaration;
39 class XmlFragment;
40 class XmlChild;
41 class XmlParent;
42 class XmlDocument;
43 class XmlElement;
44 class XmlComment;
45 class XmlCData;
46 class XmlText;
47 class XmlDoctype;
48 
49 
50 struct YATE_API XmlEscape {
54  const char* value;
55 
59  char replace;
60 };
61 
66 class YATE_API XmlSaxParser : public DebugEnabler
67 {
68 public:
69  enum Error {
70  NoError = 0,
71  NotWellFormed,
72  Unknown,
73  IOError,
74  ElementParse,
75  ReadElementName,
76  InvalidElementName,
77  ReadingAttributes,
78  CommentParse,
79  DeclarationParse,
80  DefinitionParse,
81  CDataParse,
82  ReadingEndTag,
83  Incomplete,
84  InvalidEncoding,
85  UnsupportedEncoding,
86  UnsupportedVersion,
87  };
88  enum Type {
89  None = 0,
90  Text = 1,
91  CData = 2,
92  Element = 3,
93  Doctype = 4,
94  Comment = 5,
95  Declaration = 6,
96  Instruction = 7,
97  EndTag = 8,
98  Special = 9
99  };
100 
104  virtual ~XmlSaxParser();
105 
110  inline unsigned int offset() const
111  { return m_offset; }
112 
117  inline unsigned int row() const
118  { return m_row; }
119 
124  inline unsigned int column() const
125  { return m_column; }
126 
131  inline const String& buffer() const
132  { return m_buf; }
133 
139  bool parse(const char* data);
140 
147  bool completeText();
148 
153  inline Error error()
154  { return m_error; }
155 
162  bool setError(Error error, XmlChild* child = 0);
163 
169  inline const char* getError(const char* defVal = "Xml error")
170  { return getError(m_error,defVal); }
171 
175  inline Type unparsed()
176  { return m_unparsed; }
177 
182  inline void setUnparsed(Type id)
183  { m_unparsed = id;}
184 
188  virtual void reset();
189 
193  const String& getBuffer() const
194  { return m_buf; }
195 
202  static inline const char* getError(int code, const char* defVal = "Xml error")
203  { return lookup(code,s_errorString,defVal); }
204 
210  static inline bool blank(char c)
211  { return (c == 0x20) || (c == 0x09) || (c == 0x0d) || (c == 0x0a); }
212 
219  static bool checkFirstNameCharacter(unsigned char ch);
220 
226  static bool checkDataChar(unsigned char c);
227 
233  static bool checkNameCharacter(unsigned char ch);
234 
240  static bool validTag(const String& buf);
241 
247  static void escape(String& buf, const String& text);
248 
252  static const TokenDict s_errorString[];
253 
257  static const XmlEscape s_escape[];
258 
259 protected:
264  XmlSaxParser(const char* name = "XmlSaxParser");
265 
271  bool parseInstruction();
272 
278  bool parseCData();
279 
285  bool parseComment();
286 
292  bool parseElement();
293 
299  bool parseDeclaration();
300 
306  bool parseSpecial();
307 
313  bool parseEndTag();
314 
321  bool parseDoctype();
322 
328  bool auxParse();
329 
336  void unEscape(String& text);
337 
341  void skipBlanks();
342 
348  inline bool badCharacter(char c)
349  { return c == '<' || c == '>'; }
350 
354  inline void resetError()
355  { m_error = NoError; }
356 
360  inline void resetParsed()
361  { m_parsed.clear(); m_parsed.clearParams(); }
362 
367  String* extractName(bool& empty);
368 
373  NamedString* getAttribute();
374 
380  virtual void gotComment(const String& text)
381  { }
382 
388  virtual void gotProcessing(const NamedString& instr)
389  { }
390 
396  virtual void gotDeclaration(const NamedList& decl)
397  { }
398 
404  virtual void gotText(const String& text)
405  { }
406 
412  virtual void gotCdata(const String& data)
413  { }
414 
421  virtual void gotElement(const NamedList& element, bool empty)
422  { }
423 
429  virtual void endElement(const String& name)
430  { }
431 
437  virtual void gotDoctype(const String& doc)
438  { }
439 
445  virtual bool completed()
446  { return true; }
447 
454  bool processElement(NamedList& list, bool empty);
455 
461  bool processText(String& text);
462 
466  unsigned int m_offset;
467 
471  unsigned int m_row;
472 
476  unsigned int m_column;
477 
481  Error m_error;
482 
487 
493 
498 };
499 
504 class YATE_API XmlParent
505 {
506 public:
511  { }
512 
516  virtual ~XmlParent()
517  { }
518 
525  { return 0; }
526 
533  { return 0; }
534 
540  virtual XmlElement* element()
541  { return 0; }
542 
548  virtual XmlSaxParser::Error addChild(XmlChild* child) = 0;
549 
555  inline XmlChild* addChildSafe(XmlChild* child) {
556  XmlSaxParser::Error err = addChild(child);
557  if (err != XmlSaxParser::NoError)
558  TelEngine::destruct(child);
559  return child;
560  }
561 
568  virtual XmlChild* removeChild(XmlChild* child, bool delObj = true) = 0;
569 
574  virtual void reset()
575  { }
576 
582  virtual const ObjList& getChildren() const
583  { return ObjList::empty(); }
584 
589  virtual void clearChildren()
590  { }
591 
596  inline bool hasChildren() const
597  { return getChildren().skipNull() != 0; }
598 };
599 
604 class YATE_API XmlDomParser : public XmlSaxParser
605 {
606  friend class XmlChild;
607 public:
613  XmlDomParser(const char* name = "XmlDomParser", bool fragment = false);
614 
620  XmlDomParser(XmlParent* fragment, bool takeOwnership);
621 
625  virtual ~XmlDomParser();
626 
632  { return m_data->document(); }
633 
639  { return m_data->fragment(); }
640 
644  virtual void reset();
645 
651  inline bool isCurrent(const XmlElement* el) const
652  { return el == m_current; }
653 
654 protected:
655 
660  virtual void gotComment(const String& text);
661 
666  virtual void gotProcessing(const NamedString& instr);
667 
672  virtual void gotDeclaration(const NamedList& decl);
673 
678  virtual void gotText(const String& text);
679 
684  virtual void gotCdata(const String& data);
685 
691  virtual void gotElement(const NamedList& element, bool empty);
692 
697  virtual void endElement(const String& name);
698 
703  virtual void gotDoctype(const String& doc);
704 
709  virtual bool completed()
710  { return m_current == 0; }
711 
712 private:
713  XmlElement* m_current; // The current xml element
714  XmlParent* m_data; // Main xml fragment
715  bool m_ownData; // The DOM owns data
716 };
717 
722 class YATE_API XmlChild : public GenObject
723 {
725  friend class XmlDomParser;
726 public:
730  XmlChild();
731 
736  virtual void setParent(XmlParent* parent)
737  { }
738 
744  { return 0; }
745 
751  { return 0; }
752 
757  virtual XmlCData* xmlCData()
758  { return 0; }
759 
764  virtual XmlText* xmlText()
765  { return 0; }
766 
772  { return 0; }
773 
779  { return 0; }
780 };
781 
782 
787 class YATE_API XmlDeclaration : public XmlChild
788 {
790 public:
796  XmlDeclaration(const char* version = "1.0", const char* enc = "utf-8");
797 
802  XmlDeclaration(const NamedList& decl);
803 
808  XmlDeclaration(const XmlDeclaration& orig);
809 
813  ~XmlDeclaration();
814 
819  inline const NamedList& getDec() const
820  { return m_declaration; }
821 
828  { return this; }
829 
835  void toString(String& dump, bool escape = true) const;
836 
837 private:
838  NamedList m_declaration; // The declaration
839 };
840 
845 class YATE_API XmlFragment : public XmlParent
846 {
847 public:
848 
852  XmlFragment();
853 
858  XmlFragment(const XmlFragment& orig);
859 
863  virtual ~XmlFragment();
864 
870  { return this; }
871 
876  virtual const ObjList& getChildren() const
877  { return m_list; }
878 
884  virtual XmlSaxParser::Error addChild(XmlChild* child);
885 
889  virtual void reset();
890 
895  inline XmlChild* pop()
896  { return static_cast<XmlChild*>(m_list.remove(false)); }
897 
902  XmlElement* popElement();
903 
910  virtual XmlChild* removeChild(XmlChild* child, bool delObj = true);
911 
915  virtual void clearChildren()
916  { m_list.clear(); }
917 
930  void toString(String& dump, bool escape = true, const String& indent = String::empty(),
931  const String& origIndent = String::empty(), bool completeOnly = true,
932  const String* auth = 0, const XmlElement* parent = 0) const;
933 
944  static XmlElement* findElement(ObjList* list, const String* name, const String* ns,
945  bool noPrefix = true);
946 
947 private:
948  ObjList m_list; // The children list
949 };
950 
955 class YATE_API XmlDocument : public XmlParent
956 {
957 public:
958 
962  XmlDocument();
963 
967  virtual ~XmlDocument();
968 
974  { return this; }
975 
985  virtual XmlSaxParser::Error addChild(XmlChild* child);
986 
991  XmlDeclaration* declaration() const;
992 
998  XmlElement* root(bool completed = false) const;
999 
1005  inline XmlElement* takeRoot(bool completed = false)
1006  {
1007  XmlElement* r = root(completed);
1008  if (r)
1009  m_root = 0;
1010  return r;
1011  }
1012 
1016  virtual void reset();
1017 
1024  virtual XmlChild* removeChild(XmlChild* child, bool delObj = true)
1025  { return m_beforeRoot.removeChild(child,delObj); }
1026 
1033  virtual XmlSaxParser::Error read(Stream& in, int* error = 0);
1034 
1047  virtual int write(Stream& out, bool escape = true,
1048  const String& indent = String::empty(), const String& origIndent = String::empty(),
1049  bool completeOnly = true) const;
1050 
1058  XmlSaxParser::Error loadFile(const char* file, int* error = 0);
1059 
1069  int saveFile(const char* file = 0, bool escape = true,
1070  const String& indent = String::empty(), bool completeOnly = true) const;
1071 
1079  void toString(String& dump, bool escape = true, const String& indent = String::empty(),
1080  const String& origIndent = String::empty()) const;
1081 
1082 private:
1083  XmlElement* m_root; // The root element
1084  XmlFragment m_beforeRoot; // XML children before root (declaration ...)
1085  String m_file; // The file name used on load
1086  XmlFragment m_afterRoot; // XML children after root (comments, empty text)
1087 };
1088 
1089 
1095 class YATE_API XmlElement : public XmlChild, public XmlParent
1096 {
1098 public:
1105  XmlElement(const NamedList& element, bool empty, XmlParent* parent = 0);
1106 
1112  XmlElement(const char* name, bool complete = true);
1113 
1120  XmlElement(const char* name, const char* value, bool complete = true);
1121 
1126  XmlElement(const XmlElement& orig);
1127 
1131  virtual ~XmlElement();
1132 
1137  inline const char* tag() const
1138  { return m_element; }
1139 
1144  inline bool isDefaultNs() const
1145  { return m_prefixed == 0; }
1146 
1151  inline const String& unprefixedTag() const
1152  { return m_prefixed ? m_prefixed->name() : static_cast<const String&>(m_element); }
1153 
1158  void setUnprefixedTag(const String& s);
1159 
1164  inline const String& getTag() const
1165  { return m_prefixed ? m_prefixed->name() : static_cast<const String&>(m_element); }
1166 
1173  bool getTag(const String*& tag, const String*& ns) const;
1174 
1180  { return this; }
1181 
1186  virtual XmlElement* element()
1187  { return this; }
1188 
1193  virtual XmlSaxParser::Error addChild(XmlChild* child);
1194 
1201  virtual XmlChild* removeChild(XmlChild* child, bool delObj = true);
1202 
1206  virtual void setCompleted()
1207  { m_complete = true; }
1208 
1212  inline bool completed() const
1213  { return m_complete; }
1214 
1218  inline bool empty() const
1219  { return m_empty; }
1220 
1225  inline XmlElement* parent() const
1226  { return m_parent ? m_parent->element() : 0; }
1227 
1232  { return m_parent; }
1233 
1238  virtual void setParent(XmlParent* parent);
1239 
1243  virtual const String& getName() const
1244  { return m_element; }
1245 
1249  virtual const NamedList& getElement() const
1250  { return m_element; }
1251 
1256  inline const ObjList& getChildren() const
1257  { return m_children.getChildren(); }
1258 
1262  inline void clearChildren()
1263  { return m_children.clearChildren(); }
1264 
1269  inline const NamedList* inheritedNs() const
1270  { return m_inheritedNs; }
1271 
1277  void setInheritedNs(const XmlElement* xml = 0, bool inherit = true);
1278 
1283  void addInheritedNs(const NamedList& list);
1284 
1289  inline XmlElement* pop() {
1290  XmlElement* x = findFirstChild();
1291  if (!(x && x->completed()))
1292  return 0;
1293  m_children.removeChild(x,false);
1294  return x;
1295  }
1296 
1301  virtual const String& toString() const
1302  { return m_element; }
1303 
1315  void toString(String& dump, bool escape = true, const String& indent = String::empty(),
1316  const String& origIndent = String::empty(), bool completeOnly = true,
1317  const String* auth = 0) const;
1318 
1328  inline XmlElement* findFirstChild(const String* name = 0, const String* ns = 0,
1329  bool noPrefix = true) const
1330  { return XmlFragment::findElement(getChildren().skipNull(),name,ns,noPrefix); }
1331 
1341  inline XmlElement* findFirstChild(const String& name, const String* ns = 0,
1342  bool noPrefix = true) const
1343  { return XmlFragment::findElement(getChildren().skipNull(),&name,ns,noPrefix); }
1344 
1355  inline XmlElement* findNextChild(const XmlElement* prev = 0, const String* name = 0,
1356  const String* ns = 0, bool noPrefix = true) const {
1357  if (!prev)
1358  return findFirstChild(name,ns,noPrefix);
1359  ObjList* start = getChildren().find(prev);
1360  return start ? XmlFragment::findElement(start->skipNext(),name,ns,noPrefix) : 0;
1361  }
1362 
1373  inline XmlElement* findNextChild(const String& name, const XmlElement* prev = 0,
1374  const String* ns = 0, bool noPrefix = true) const
1375  { return findNextChild(prev,&name,ns,noPrefix); }
1376 
1386  inline const String* childText(const String& name, const String* ns = 0,
1387  bool noPrefix = true) const {
1388  XmlElement* c = findFirstChild(&name,ns,noPrefix);
1389  return c ? &(c->getText()) : 0;
1390  }
1391 
1396  XmlChild* getFirstChild();
1397 
1401  const String& getText() const;
1402 
1410  XmlText* setText(const char* text);
1411 
1416  void addText(const char* text);
1417 
1422  inline const NamedList& attributes() const
1423  { return m_element; }
1424 
1431  unsigned int copyAttributes(NamedList& list, const String& prefix) const;
1432 
1440  void setAttributes(NamedList& list, const String& prefix, bool skipPrefix = true);
1441 
1447  inline void setAttribute(const String& name, const char* value)
1448  { m_element.setParam(name,value); }
1449 
1455  inline void setAttributeValid(const String& name, const char* value) {
1456  if (!TelEngine::null(value))
1457  m_element.setParam(name,value);
1458  else
1459  removeAttribute(name);
1460  }
1461 
1467  inline const char* attribute(const String& name) const
1468  { return m_element.getValue(name); }
1469 
1475  inline String* getAttribute(const String& name) const
1476  { return m_element.getParam(name); }
1477 
1484  inline bool hasAttribute(const String& name, const String& value) const {
1485  String* a = getAttribute(name);
1486  return a && *a == value;
1487  }
1488 
1493  inline void removeAttribute(const String& name)
1494  { m_element.clearParam(name); }
1495 
1500  inline String* xmlns() const {
1501  if (!m_prefixed)
1502  return xmlnsAttribute(s_ns);
1503  return xmlnsAttribute(s_nsPrefix + *m_prefixed);
1504  }
1505 
1510  String* xmlnsAttribute(const String& name) const;
1511 
1517  inline bool hasXmlns(const String& ns) const {
1518  const String* x = xmlns();
1519  return x && *x == ns;
1520  }
1521 
1530  bool setXmlns(const String& name = String::empty(), bool addAttr = false,
1531  const String& value = String::empty());
1532 
1539  static inline bool isXmlns(const String& str)
1540  { return str == s_ns || str.startsWith(s_nsPrefix); }
1541 
1558  static XmlElement* param2xml(NamedString* param, const String& tag,
1559  bool copyXml = false);
1560 
1570  static NamedString* xml2param(XmlElement* xml, const String* tag,
1571  bool copyXml = false);
1572 
1583  static void xml2param(NamedList& list, XmlElement* parent, const String* tag,
1584  bool copyXml = false);
1585 
1589  static const String s_ns;
1590 
1594  static const String s_nsPrefix;
1595 
1596 private:
1597  // Set prefixed data (tag and prefix)
1598  inline void setPrefixed() {
1599  TelEngine::destruct(m_prefixed);
1600  int pos = m_element.find(":");
1601  if (pos != -1)
1602  m_prefixed = new NamedString(m_element.substr(pos + 1),m_element.substr(0,pos));
1603  }
1604 
1605  XmlFragment m_children; // Children of this element
1606  NamedList m_element; // The element
1607  NamedString* m_prefixed; // Splitted prefixed tag (the value is the namespace prefix)
1608  XmlParent* m_parent; // The XmlElement who holds this element
1609  NamedList* m_inheritedNs; // Inherited namespaces (if parent is 0)
1610  bool m_empty; // True if this element does not have any children
1611  bool m_complete; // True if the end element tag war reported
1612 };
1613 
1618 class YATE_API XmlComment : public XmlChild
1619 {
1621 public:
1626  XmlComment(const String& comm);
1627 
1632  XmlComment(const XmlComment& orig);
1633 
1637  virtual ~XmlComment();
1638 
1643  inline const String& getComment() const
1644  { return m_comment; }
1645 
1651  void toString(String& dump, const String& indent = String::empty()) const;
1652 
1658  { return this; }
1659 
1660 private:
1661  String m_comment; // The comment
1662 };
1663 
1668 class YATE_API XmlCData : public XmlChild
1669 {
1671 public:
1672 
1677  XmlCData(const String& data);
1678 
1683  XmlCData(const XmlCData& orig);
1684 
1688  virtual ~XmlCData();
1689 
1694  inline const String& getCData() const
1695  { return m_data;}
1696 
1702  void toString(String& dump, const String& indent = String::empty()) const;
1703 
1708  virtual XmlCData* xmlCData()
1709  { return this; }
1710 
1711 private:
1712  String m_data; // The data
1713 };
1714 
1719 class YATE_API XmlText : public XmlChild
1720 {
1722 public:
1727  XmlText(const String& text);
1728 
1733  XmlText(const XmlText& orig);
1734 
1738  virtual ~XmlText();
1739 
1743  inline const String& getText() const
1744  { return m_text; }
1745 
1750  inline void setText(const char* text)
1751  { m_text = text; }
1752 
1763  void toString(String& dump, bool escape = true, const String& indent = String::empty(),
1764  const String* auth = 0, const XmlElement* parent = 0) const;
1765 
1770  virtual XmlText* xmlText()
1771  { return this; }
1772 
1777  bool onlySpaces();
1778 private:
1779  String m_text; // The text
1780 };
1781 
1782 class YATE_API XmlDoctype : public XmlChild
1783 {
1785 public:
1790  XmlDoctype(const String& doctype);
1791 
1796  XmlDoctype(const XmlDoctype& orig);
1797 
1801  virtual ~XmlDoctype();
1802 
1807  inline const String& getDoctype() const
1808  { return m_doctype; }
1809 
1815  { return this; }
1816 
1822  void toString(String& dump, const String& indent = String::empty()) const;
1823 
1824 private:
1825  String m_doctype; // The document type
1826 };
1827 
1828 }; // namespace TelEngine
1829 
1830 #endif /* __YATEXML_H */
1831 
1832 /* vi: set ts=8 sw=4 sts=4 noet: */
const char * getError(const char *defVal="Xml error")
Definition: yatexml.h:169
const String * childText(const String &name, const String *ns=0, bool noPrefix=true) const
Definition: yatexml.h:1386
virtual XmlText * xmlText()
Definition: yatexml.h:1770
Xml Declaration.
Definition: yatexml.h:787
virtual ~XmlParent()
Definition: yatexml.h:516
bool startsWith(const char *what, bool wordBreak=false, bool caseInsensitive=false) const
void clearChildren()
Definition: yatexml.h:1262
const char * tag() const
Definition: yatexml.h:1137
Document Object Model XML Parser.
Definition: yatexml.h:604
const String & getDoctype() const
Definition: yatexml.h:1807
virtual XmlCData * xmlCData()
Definition: yatexml.h:757
String m_buf
Definition: yatexml.h:486
Xml Document.
Definition: yatexml.h:955
virtual const ObjList & getChildren() const
Definition: yatexml.h:876
const ObjList & getChildren() const
Definition: yatexml.h:1256
XmlChild * pop()
Definition: yatexml.h:895
Xml Declaration.
Definition: yatexml.h:1719
virtual void gotText(const String &text)
Definition: yatexml.h:404
virtual void gotElement(const NamedList &element, bool empty)
Definition: yatexml.h:421
XmlDocument * document()
Definition: yatexml.h:631
XmlParent()
Definition: yatexml.h:510
char replace
Definition: yatexml.h:59
virtual bool completed()
Definition: yatexml.h:709
NamedList m_parsed
Definition: yatexml.h:492
Xml Fragment.
Definition: yatexml.h:845
Serial Access XML Parser.
Definition: yatexml.h:66
unsigned int column() const
Definition: yatexml.h:124
Xml Child.
Definition: yatexml.h:722
virtual XmlChild * removeChild(XmlChild *child, bool delObj=true)
Definition: yatexml.h:1024
virtual XmlDoctype * xmlDoctype()
Definition: yatexml.h:778
virtual const ObjList & getChildren() const
Definition: yatexml.h:582
Xml Element.
Definition: yatexml.h:1095
Xml Comment.
Definition: yatexml.h:1618
void setAttribute(const String &name, const char *value)
Definition: yatexml.h:1447
const String & getComment() const
Definition: yatexml.h:1643
void resetError()
Definition: yatexml.h:354
const String & getText() const
unsigned int m_column
Definition: yatexml.h:476
virtual XmlCData * xmlCData()
Definition: yatexml.h:1708
const String & getCData() const
Definition: yatexml.h:1694
ObjList * find(const GenObject *obj) const
int lookup(const char *str, const TokenDict *tokens, int defvalue=0, int base=0)
bool isCurrent(const XmlElement *el) const
Definition: yatexml.h:651
void destruct(GenObject *obj)
Definition: yateclass.h:933
virtual XmlFragment * fragment()
Definition: yatexml.h:532
virtual void gotProcessing(const NamedString &instr)
Definition: yatexml.h:388
virtual void gotDeclaration(const NamedList &decl)
Definition: yatexml.h:396
bool hasAttribute(const String &name, const String &value) const
Definition: yatexml.h:1484
virtual XmlDoctype * xmlDoctype()
Definition: yatexml.h:1814
const String & getTag() const
Definition: yatexml.h:1164
const char * attribute(const String &name) const
Definition: yatexml.h:1467
bool hasChildren() const
Definition: yatexml.h:596
static const char * getError(int code, const char *defVal="Xml error")
Definition: yatexml.h:202
A holder for a debug level.
Definition: yateclass.h:309
XmlElement * parent() const
Definition: yatexml.h:1225
virtual void setCompleted()
Definition: yatexml.h:1206
virtual bool completed()
Definition: yatexml.h:445
virtual const String & getName() const
Definition: yatexml.h:1243
virtual const NamedList & getElement() const
Definition: yatexml.h:1249
bool hasXmlns(const String &ns) const
Definition: yatexml.h:1517
static const ObjList & empty()
virtual void clearChildren()
Definition: yatexml.h:589
virtual void endElement(const String &name)
Definition: yatexml.h:429
A named string class.
Definition: yateclass.h:3111
virtual void gotCdata(const String &data)
Definition: yatexml.h:412
virtual XmlFragment * fragment()
Definition: yatexml.h:869
const NamedList & attributes() const
Definition: yatexml.h:1422
virtual void gotComment(const String &text)
Definition: yatexml.h:380
const String & getText() const
Definition: yatexml.h:1743
bool null(const char *str)
Definition: yateclass.h:2829
virtual XmlText * xmlText()
Definition: yatexml.h:764
virtual void reset()
Definition: yatexml.h:574
A named string container class.
Definition: yateclass.h:4553
virtual XmlComment * xmlComment()
Definition: yatexml.h:1657
Definition: yatexml.h:50
const NamedList * inheritedNs() const
Definition: yatexml.h:1269
virtual XmlElement * xmlElement()
Definition: yatexml.h:1179
void setText(const char *text)
Definition: yatexml.h:1750
bool completed() const
Definition: yatexml.h:1212
Type m_unparsed
Definition: yatexml.h:497
const NamedList & getDec() const
Definition: yatexml.h:819
An abstract stream class capable of reading and writing.
Definition: yateclass.h:6322
virtual const String & toString() const
Definition: yatexml.h:1301
void setUnparsed(Type id)
Definition: yatexml.h:182
unsigned int m_offset
Definition: yatexml.h:466
Definition: yatexml.h:1782
void setAttributeValid(const String &name, const char *value)
Definition: yatexml.h:1455
virtual XmlDeclaration * xmlDeclaration()
Definition: yatexml.h:827
const String & buffer() const
Definition: yatexml.h:131
XmlElement * findFirstChild(const String &name, const String *ns=0, bool noPrefix=true) const
Definition: yatexml.h:1341
ObjList * skipNext() const
const char * value
Definition: yatexml.h:54
virtual XmlElement * element()
Definition: yatexml.h:1186
const String & unprefixedTag() const
Definition: yatexml.h:1151
virtual void setParent(XmlParent *parent)
Definition: yatexml.h:736
Definition: yateclass.h:217
XmlElement * pop()
Definition: yatexml.h:1289
virtual XmlParent * getParent()
Definition: yatexml.h:1231
unsigned int offset() const
Definition: yatexml.h:110
XmlElement * findNextChild(const XmlElement *prev=0, const String *name=0, const String *ns=0, bool noPrefix=true) const
Definition: yatexml.h:1355
void removeAttribute(const String &name)
Definition: yatexml.h:1493
static bool blank(char c)
Definition: yatexml.h:210
A C-style string handling class.
Definition: yateclass.h:1832
Error error()
Definition: yatexml.h:153
Error m_error
Definition: yatexml.h:481
Definition: yateclass.h:683
static const String s_nsPrefix
Definition: yatexml.h:1594
virtual XmlDocument * document()
Definition: yatexml.h:973
Type unparsed()
Definition: yatexml.h:175
An object list class.
Definition: yateclass.h:1229
XmlChild * addChildSafe(XmlChild *child)
Definition: yatexml.h:555
String * getAttribute(const String &name) const
Definition: yatexml.h:1475
XmlFragment * fragment()
Definition: yatexml.h:638
static bool isXmlns(const String &str)
Definition: yatexml.h:1539
XmlElement * findFirstChild(const String *name=0, const String *ns=0, bool noPrefix=true) const
Definition: yatexml.h:1328
void resetParsed()
Definition: yatexml.h:360
void YCLASS(class type, class base)
virtual XmlElement * element()
Definition: yatexml.h:540
bool isDefaultNs() const
Definition: yatexml.h:1144
XmlElement * takeRoot(bool completed=false)
Definition: yatexml.h:1005
Xml Declaration.
Definition: yatexml.h:1668
bool badCharacter(char c)
Definition: yatexml.h:348
static const String & empty()
bool empty() const
Definition: yatexml.h:1218
XmlElement * findNextChild(const String &name, const XmlElement *prev=0, const String *ns=0, bool noPrefix=true) const
Definition: yatexml.h:1373
virtual void gotDoctype(const String &doc)
Definition: yatexml.h:437
virtual XmlComment * xmlComment()
Definition: yatexml.h:750
unsigned int row() const
Definition: yatexml.h:117
virtual XmlDocument * document()
Definition: yatexml.h:524
virtual XmlElement * xmlElement()
Definition: yatexml.h:743
Xml Parent.
Definition: yatexml.h:504
String * xmlns() const
Definition: yatexml.h:1500
const String & getBuffer() const
Definition: yatexml.h:193
static const String s_ns
Definition: yatexml.h:1589
virtual XmlDeclaration * xmlDeclaration()
Definition: yatexml.h:771
static XmlElement * findElement(ObjList *list, const String *name, const String *ns, bool noPrefix=true)
Definition: yateclass.h:830
virtual void clearChildren()
Definition: yatexml.h:915
unsigned int m_row
Definition: yatexml.h:471