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 
556  inline XmlChild* addChildSafe(XmlChild* child, XmlSaxParser::Error* code = 0) {
557  XmlSaxParser::Error err = addChild(child);
558  if (err != XmlSaxParser::NoError) {
559  TelEngine::destruct(child);
560  if (code)
561  *code = err;
562  }
563  return child;
564  }
565 
572  virtual XmlChild* removeChild(XmlChild* child, bool delObj = true) = 0;
573 
578  virtual void reset()
579  { }
580 
586  virtual const ObjList& getChildren() const
587  { return ObjList::empty(); }
588 
593  virtual void clearChildren()
594  { }
595 
600  inline bool hasChildren() const
601  { return getChildren().skipNull() != 0; }
602 };
603 
608 class YATE_API XmlDomParser : public XmlSaxParser
609 {
610  friend class XmlChild;
611 public:
617  XmlDomParser(const char* name = "XmlDomParser", bool fragment = false);
618 
624  XmlDomParser(XmlParent* fragment, bool takeOwnership);
625 
629  virtual ~XmlDomParser();
630 
636  { return m_data->document(); }
637 
643  { return m_data->fragment(); }
644 
648  virtual void reset();
649 
655  inline bool isCurrent(const XmlElement* el) const
656  { return el == m_current; }
657 
658 protected:
659 
664  virtual void gotComment(const String& text);
665 
670  virtual void gotProcessing(const NamedString& instr);
671 
676  virtual void gotDeclaration(const NamedList& decl);
677 
682  virtual void gotText(const String& text);
683 
688  virtual void gotCdata(const String& data);
689 
695  virtual void gotElement(const NamedList& element, bool empty);
696 
701  virtual void endElement(const String& name);
702 
707  virtual void gotDoctype(const String& doc);
708 
713  virtual bool completed()
714  { return m_current == 0; }
715 
716 private:
717  XmlElement* m_current; // The current xml element
718  XmlParent* m_data; // Main xml fragment
719  bool m_ownData; // The DOM owns data
720 };
721 
726 class YATE_API XmlChild : public GenObject
727 {
729  friend class XmlDomParser;
730 public:
734  XmlChild();
735 
740  virtual void setParent(XmlParent* parent)
741  { }
742 
748  { return 0; }
749 
755  { return 0; }
756 
761  virtual XmlCData* xmlCData()
762  { return 0; }
763 
768  virtual XmlText* xmlText()
769  { return 0; }
770 
776  { return 0; }
777 
783  { return 0; }
784 
789  virtual void replaceParams(const NamedList& params)
790  {}
791 };
792 
793 
798 class YATE_API XmlDeclaration : public XmlChild
799 {
801 public:
807  XmlDeclaration(const char* version = "1.0", const char* enc = "utf-8");
808 
813  XmlDeclaration(const NamedList& decl);
814 
819  XmlDeclaration(const XmlDeclaration& orig);
820 
824  ~XmlDeclaration();
825 
830  inline const NamedList& getDec() const
831  { return m_declaration; }
832 
839  { return this; }
840 
846  void toString(String& dump, bool escape = true) const;
847 
848 private:
849  NamedList m_declaration; // The declaration
850 };
851 
856 class YATE_API XmlFragment : public XmlParent
857 {
858 public:
859 
863  XmlFragment();
864 
869  XmlFragment(const XmlFragment& orig);
870 
874  virtual ~XmlFragment();
875 
881  { return this; }
882 
887  virtual const ObjList& getChildren() const
888  { return m_list; }
889 
895  virtual XmlSaxParser::Error addChild(XmlChild* child);
896 
900  virtual void reset();
901 
906  inline XmlChild* pop()
907  { return static_cast<XmlChild*>(m_list.remove(false)); }
908 
913  XmlElement* popElement();
914 
921  virtual XmlChild* removeChild(XmlChild* child, bool delObj = true);
922 
926  virtual void clearChildren()
927  { m_list.clear(); }
928 
934  void copy(const XmlFragment& other, XmlParent* parent = 0);
935 
948  void toString(String& dump, bool escape = true, const String& indent = String::empty(),
949  const String& origIndent = String::empty(), bool completeOnly = true,
950  const String* auth = 0, const XmlElement* parent = 0) const;
951 
956  void replaceParams(const NamedList& params);
957 
968  static XmlElement* findElement(ObjList* list, const String* name, const String* ns,
969  bool noPrefix = true);
970 
971 private:
972  ObjList m_list; // The children list
973 };
974 
979 class YATE_API XmlDocument : public XmlParent
980 {
981 public:
982 
986  XmlDocument();
987 
991  virtual ~XmlDocument();
992 
998  { return this; }
999 
1009  virtual XmlSaxParser::Error addChild(XmlChild* child);
1010 
1015  XmlDeclaration* declaration() const;
1016 
1023  inline const XmlFragment& getFragment(bool before) const
1024  { return before ? m_beforeRoot : m_afterRoot; }
1025 
1031  XmlElement* root(bool completed = false) const;
1032 
1038  inline XmlElement* takeRoot(bool completed = false)
1039  {
1040  XmlElement* r = root(completed);
1041  if (r)
1042  m_root = 0;
1043  return r;
1044  }
1045 
1049  virtual void reset();
1050 
1057  virtual XmlChild* removeChild(XmlChild* child, bool delObj = true)
1058  { return m_beforeRoot.removeChild(child,delObj); }
1059 
1066  virtual XmlSaxParser::Error read(Stream& in, int* error = 0);
1067 
1080  virtual int write(Stream& out, bool escape = true,
1081  const String& indent = String::empty(), const String& origIndent = String::empty(),
1082  bool completeOnly = true) const;
1083 
1091  XmlSaxParser::Error loadFile(const char* file, int* error = 0);
1092 
1103  int saveFile(const char* file = 0, bool escape = true,
1104  const String& indent = String::empty(), bool completeOnly = true,
1105  const char* eoln = "\r\n") const;
1106 
1114  void toString(String& dump, bool escape = true, const String& indent = String::empty(),
1115  const String& origIndent = String::empty()) const;
1116 
1121  void replaceParams(const NamedList& params);
1122 
1123 private:
1124  XmlElement* m_root; // The root element
1125  XmlFragment m_beforeRoot; // XML children before root (declaration ...)
1126  String m_file; // The file name used on load
1127  XmlFragment m_afterRoot; // XML children after root (comments, empty text)
1128 };
1129 
1130 
1136 class YATE_API XmlElement : public XmlChild, public XmlParent
1137 {
1139 public:
1146  XmlElement(const NamedList& element, bool empty, XmlParent* parent = 0);
1147 
1153  XmlElement(const char* name, bool complete = true);
1154 
1161  XmlElement(const char* name, const char* value, bool complete = true);
1162 
1167  XmlElement(const XmlElement& orig);
1168 
1172  virtual ~XmlElement();
1173 
1178  inline const char* tag() const
1179  { return m_element; }
1180 
1185  inline bool isDefaultNs() const
1186  { return m_prefixed == 0; }
1187 
1192  inline const String& unprefixedTag() const
1193  { return m_prefixed ? m_prefixed->name() : static_cast<const String&>(m_element); }
1194 
1199  void setUnprefixedTag(const String& s);
1200 
1205  inline const String& getTag() const
1206  { return m_prefixed ? m_prefixed->name() : static_cast<const String&>(m_element); }
1207 
1214  bool getTag(const String*& tag, const String*& ns) const;
1215 
1221  { return this; }
1222 
1227  virtual XmlElement* element()
1228  { return this; }
1229 
1234  virtual XmlSaxParser::Error addChild(XmlChild* child);
1235 
1242  virtual XmlChild* removeChild(XmlChild* child, bool delObj = true);
1243 
1247  virtual void setCompleted()
1248  { m_complete = true; }
1249 
1253  inline bool completed() const
1254  { return m_complete; }
1255 
1259  inline bool empty() const
1260  { return m_empty; }
1261 
1266  inline XmlElement* parent() const
1267  { return m_parent ? m_parent->element() : 0; }
1268 
1273  { return m_parent; }
1274 
1279  virtual void setParent(XmlParent* parent);
1280 
1284  virtual const String& getName() const
1285  { return m_element; }
1286 
1290  virtual const NamedList& getElement() const
1291  { return m_element; }
1292 
1297  inline const ObjList& getChildren() const
1298  { return m_children.getChildren(); }
1299 
1303  inline void clearChildren()
1304  { return m_children.clearChildren(); }
1305 
1310  inline const NamedList* inheritedNs() const
1311  { return m_inheritedNs; }
1312 
1318  void setInheritedNs(const XmlElement* xml = 0, bool inherit = true);
1319 
1324  void addInheritedNs(const NamedList& list);
1325 
1330  inline XmlElement* pop() {
1331  XmlElement* x = findFirstChild();
1332  if (!(x && x->completed()))
1333  return 0;
1334  m_children.removeChild(x,false);
1335  return x;
1336  }
1337 
1342  virtual const String& toString() const
1343  { return m_element; }
1344 
1356  void toString(String& dump, bool escape = true, const String& indent = String::empty(),
1357  const String& origIndent = String::empty(), bool completeOnly = true,
1358  const String* auth = 0) const;
1359 
1369  inline XmlElement* findFirstChild(const String* name = 0, const String* ns = 0,
1370  bool noPrefix = true) const
1371  { return XmlFragment::findElement(getChildren().skipNull(),name,ns,noPrefix); }
1372 
1382  inline XmlElement* findFirstChild(const String& name, const String* ns = 0,
1383  bool noPrefix = true) const
1384  { return XmlFragment::findElement(getChildren().skipNull(),&name,ns,noPrefix); }
1385 
1396  inline XmlElement* findNextChild(const XmlElement* prev = 0, const String* name = 0,
1397  const String* ns = 0, bool noPrefix = true) const {
1398  if (!prev)
1399  return findFirstChild(name,ns,noPrefix);
1400  ObjList* start = getChildren().find(prev);
1401  return start ? XmlFragment::findElement(start->skipNext(),name,ns,noPrefix) : 0;
1402  }
1403 
1414  inline XmlElement* findNextChild(const String& name, const XmlElement* prev = 0,
1415  const String* ns = 0, bool noPrefix = true) const
1416  { return findNextChild(prev,&name,ns,noPrefix); }
1417 
1427  inline const String* childText(const String& name, const String* ns = 0,
1428  bool noPrefix = true) const {
1429  XmlElement* c = findFirstChild(&name,ns,noPrefix);
1430  return c ? &(c->getText()) : 0;
1431  }
1432 
1437  XmlChild* getFirstChild();
1438 
1442  const String& getText() const;
1443 
1451  XmlText* setText(const char* text);
1452 
1457  void addText(const char* text);
1458 
1463  inline const NamedList& attributes() const
1464  { return m_element; }
1465 
1472  unsigned int copyAttributes(NamedList& list, const String& prefix) const;
1473 
1481  void setAttributes(NamedList& list, const String& prefix, bool skipPrefix = true);
1482 
1488  inline void setAttribute(const String& name, const char* value)
1489  { m_element.setParam(name,value); }
1490 
1496  inline void setAttributeValid(const String& name, const char* value) {
1497  if (!TelEngine::null(value))
1498  m_element.setParam(name,value);
1499  else
1500  removeAttribute(name);
1501  }
1502 
1508  inline const char* attribute(const String& name) const
1509  { return m_element.getValue(name); }
1510 
1516  inline String* getAttribute(const String& name) const
1517  { return m_element.getParam(name); }
1518 
1525  inline bool hasAttribute(const String& name, const String& value) const {
1526  String* a = getAttribute(name);
1527  return a && *a == value;
1528  }
1529 
1534  inline void removeAttribute(const String& name)
1535  { m_element.clearParam(name); }
1536 
1541  inline String* xmlns() const {
1542  if (!m_prefixed)
1543  return xmlnsAttribute(s_ns);
1544  return xmlnsAttribute(s_nsPrefix + *m_prefixed);
1545  }
1546 
1551  String* xmlnsAttribute(const String& name) const;
1552 
1558  inline bool hasXmlns(const String& ns) const {
1559  const String* x = xmlns();
1560  return x && *x == ns;
1561  }
1562 
1571  bool setXmlns(const String& name = String::empty(), bool addAttr = false,
1572  const String& value = String::empty());
1573 
1579  virtual void replaceParams(const NamedList& params);
1580 
1587  static inline bool isXmlns(const String& str)
1588  { return str == s_ns || str.startsWith(s_nsPrefix); }
1589 
1606  static XmlElement* param2xml(NamedString* param, const String& tag,
1607  bool copyXml = false);
1608 
1618  static NamedString* xml2param(XmlElement* xml, const String* tag,
1619  bool copyXml = false);
1620 
1631  static void xml2param(NamedList& list, XmlElement* parent, const String* tag,
1632  bool copyXml = false);
1633 
1637  static const String s_ns;
1638 
1642  static const String s_nsPrefix;
1643 
1644 private:
1645  // Set prefixed data (tag and prefix)
1646  inline void setPrefixed() {
1647  TelEngine::destruct(m_prefixed);
1648  int pos = m_element.find(":");
1649  if (pos != -1)
1650  m_prefixed = new NamedString(m_element.substr(pos + 1),m_element.substr(0,pos));
1651  }
1652 
1653  XmlFragment m_children; // Children of this element
1654  NamedList m_element; // The element
1655  NamedString* m_prefixed; // Splitted prefixed tag (the value is the namespace prefix)
1656  XmlParent* m_parent; // The XmlElement who holds this element
1657  NamedList* m_inheritedNs; // Inherited namespaces (if parent is 0)
1658  bool m_empty; // True if this element does not have any children
1659  bool m_complete; // True if the end element tag war reported
1660 };
1661 
1666 class YATE_API XmlComment : public XmlChild
1667 {
1669 public:
1674  XmlComment(const String& comm);
1675 
1680  XmlComment(const XmlComment& orig);
1681 
1685  virtual ~XmlComment();
1686 
1691  inline const String& getComment() const
1692  { return m_comment; }
1693 
1699  void toString(String& dump, const String& indent = String::empty()) const;
1700 
1706  { return this; }
1707 
1708 private:
1709  String m_comment; // The comment
1710 };
1711 
1716 class YATE_API XmlCData : public XmlChild
1717 {
1719 public:
1720 
1725  XmlCData(const String& data);
1726 
1731  XmlCData(const XmlCData& orig);
1732 
1736  virtual ~XmlCData();
1737 
1742  inline const String& getCData() const
1743  { return m_data;}
1744 
1750  void toString(String& dump, const String& indent = String::empty()) const;
1751 
1756  virtual XmlCData* xmlCData()
1757  { return this; }
1758 
1759 private:
1760  String m_data; // The data
1761 };
1762 
1767 class YATE_API XmlText : public XmlChild
1768 {
1770 public:
1775  XmlText(const String& text);
1776 
1781  XmlText(const XmlText& orig);
1782 
1786  virtual ~XmlText();
1787 
1791  inline const String& getText() const
1792  { return m_text; }
1793 
1798  inline void setText(const char* text)
1799  { m_text = text; }
1800 
1811  void toString(String& dump, bool escape = true, const String& indent = String::empty(),
1812  const String* auth = 0, const XmlElement* parent = 0) const;
1813 
1818  virtual XmlText* xmlText()
1819  { return this; }
1820 
1825  bool onlySpaces();
1826 
1831  virtual void replaceParams(const NamedList& params);
1832 
1833 private:
1834  String m_text; // The text
1835 };
1836 
1837 class YATE_API XmlDoctype : public XmlChild
1838 {
1840 public:
1845  XmlDoctype(const String& doctype);
1846 
1851  XmlDoctype(const XmlDoctype& orig);
1852 
1856  virtual ~XmlDoctype();
1857 
1862  inline const String& getDoctype() const
1863  { return m_doctype; }
1864 
1870  { return this; }
1871 
1877  void toString(String& dump, const String& indent = String::empty()) const;
1878 
1879 private:
1880  String m_doctype; // The document type
1881 };
1882 
1883 }; // namespace TelEngine
1884 
1885 #endif /* __YATEXML_H */
1886 
1887 /* 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:1427
virtual XmlText * xmlText()
Definition: yatexml.h:1818
Xml Declaration.
Definition: yatexml.h:798
virtual ~XmlParent()
Definition: yatexml.h:516
bool startsWith(const char *what, bool wordBreak=false, bool caseInsensitive=false) const
void clearChildren()
Definition: yatexml.h:1303
const char * tag() const
Definition: yatexml.h:1178
Document Object Model XML Parser.
Definition: yatexml.h:608
const String & getDoctype() const
Definition: yatexml.h:1862
virtual XmlCData * xmlCData()
Definition: yatexml.h:761
String m_buf
Definition: yatexml.h:486
Xml Document.
Definition: yatexml.h:979
virtual const ObjList & getChildren() const
Definition: yatexml.h:887
const ObjList & getChildren() const
Definition: yatexml.h:1297
XmlChild * pop()
Definition: yatexml.h:906
Xml Declaration.
Definition: yatexml.h:1767
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:635
XmlParent()
Definition: yatexml.h:510
char replace
Definition: yatexml.h:59
virtual bool completed()
Definition: yatexml.h:713
NamedList m_parsed
Definition: yatexml.h:492
Xml Fragment.
Definition: yatexml.h:856
Serial Access XML Parser.
Definition: yatexml.h:66
XmlChild * addChildSafe(XmlChild *child, XmlSaxParser::Error *code=0)
Definition: yatexml.h:556
unsigned int column() const
Definition: yatexml.h:124
Xml Child.
Definition: yatexml.h:726
virtual XmlChild * removeChild(XmlChild *child, bool delObj=true)
Definition: yatexml.h:1057
virtual XmlDoctype * xmlDoctype()
Definition: yatexml.h:782
virtual const ObjList & getChildren() const
Definition: yatexml.h:586
Xml Element.
Definition: yatexml.h:1136
Xml Comment.
Definition: yatexml.h:1666
void setAttribute(const String &name, const char *value)
Definition: yatexml.h:1488
const String & getComment() const
Definition: yatexml.h:1691
void resetError()
Definition: yatexml.h:354
const String & getText() const
unsigned int m_column
Definition: yatexml.h:476
virtual XmlCData * xmlCData()
Definition: yatexml.h:1756
const String & getCData() const
Definition: yatexml.h:1742
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:655
void destruct(GenObject *obj)
Definition: yateclass.h:1157
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:1525
virtual XmlDoctype * xmlDoctype()
Definition: yatexml.h:1869
const String & getTag() const
Definition: yatexml.h:1205
const char * attribute(const String &name) const
Definition: yatexml.h:1508
bool hasChildren() const
Definition: yatexml.h:600
static const char * getError(int code, const char *defVal="Xml error")
Definition: yatexml.h:202
A holder for a debug level.
Definition: yateclass.h:311
XmlElement * parent() const
Definition: yatexml.h:1266
virtual void setCompleted()
Definition: yatexml.h:1247
virtual bool completed()
Definition: yatexml.h:445
virtual const String & getName() const
Definition: yatexml.h:1284
virtual const NamedList & getElement() const
Definition: yatexml.h:1290
bool hasXmlns(const String &ns) const
Definition: yatexml.h:1558
virtual void replaceParams(const NamedList &params)
Definition: yatexml.h:789
static const ObjList & empty()
virtual void clearChildren()
Definition: yatexml.h:593
virtual void endElement(const String &name)
Definition: yatexml.h:429
A named string class.
Definition: yateclass.h:3480
virtual void gotCdata(const String &data)
Definition: yatexml.h:412
virtual XmlFragment * fragment()
Definition: yatexml.h:880
const NamedList & attributes() const
Definition: yatexml.h:1463
virtual void gotComment(const String &text)
Definition: yatexml.h:380
const String & getText() const
Definition: yatexml.h:1791
bool null(const char *str)
Definition: yateclass.h:3179
virtual XmlText * xmlText()
Definition: yatexml.h:768
virtual void reset()
Definition: yatexml.h:578
A named string container class.
Definition: yateclass.h:5015
virtual XmlComment * xmlComment()
Definition: yatexml.h:1705
Definition: yatexml.h:50
const NamedList * inheritedNs() const
Definition: yatexml.h:1310
virtual XmlElement * xmlElement()
Definition: yatexml.h:1220
void setText(const char *text)
Definition: yatexml.h:1798
bool completed() const
Definition: yatexml.h:1253
Type m_unparsed
Definition: yatexml.h:497
const NamedList & getDec() const
Definition: yatexml.h:830
An abstract stream class capable of reading and writing.
Definition: yateclass.h:6873
virtual const String & toString() const
Definition: yatexml.h:1342
void setUnparsed(Type id)
Definition: yatexml.h:182
unsigned int m_offset
Definition: yatexml.h:466
Definition: yatexml.h:1837
void setAttributeValid(const String &name, const char *value)
Definition: yatexml.h:1496
virtual XmlDeclaration * xmlDeclaration()
Definition: yatexml.h:838
const String & buffer() const
Definition: yatexml.h:131
XmlElement * findFirstChild(const String &name, const String *ns=0, bool noPrefix=true) const
Definition: yatexml.h:1382
ObjList * skipNext() const
const char * value
Definition: yatexml.h:54
virtual XmlElement * element()
Definition: yatexml.h:1227
const String & unprefixedTag() const
Definition: yatexml.h:1192
virtual void setParent(XmlParent *parent)
Definition: yatexml.h:740
Definition: yateclass.h:219
XmlElement * pop()
Definition: yatexml.h:1330
virtual XmlParent * getParent()
Definition: yatexml.h:1272
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:1396
void removeAttribute(const String &name)
Definition: yatexml.h:1534
static bool blank(char c)
Definition: yatexml.h:210
A C-style string handling class.
Definition: yateclass.h:2130
Error error()
Definition: yatexml.h:153
const XmlFragment & getFragment(bool before) const
Definition: yatexml.h:1023
Error m_error
Definition: yatexml.h:481
Definition: yateclass.h:848
static const String s_nsPrefix
Definition: yatexml.h:1642
virtual XmlDocument * document()
Definition: yatexml.h:997
Type unparsed()
Definition: yatexml.h:175
An object list class.
Definition: yateclass.h:1453
String * getAttribute(const String &name) const
Definition: yatexml.h:1516
XmlFragment * fragment()
Definition: yatexml.h:642
static bool isXmlns(const String &str)
Definition: yatexml.h:1587
XmlElement * findFirstChild(const String *name=0, const String *ns=0, bool noPrefix=true) const
Definition: yatexml.h:1369
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:1185
XmlElement * takeRoot(bool completed=false)
Definition: yatexml.h:1038
Xml Declaration.
Definition: yatexml.h:1716
bool badCharacter(char c)
Definition: yatexml.h:348
static const String & empty()
bool empty() const
Definition: yatexml.h:1259
XmlElement * findNextChild(const String &name, const XmlElement *prev=0, const String *ns=0, bool noPrefix=true) const
Definition: yatexml.h:1414
virtual void gotDoctype(const String &doc)
Definition: yatexml.h:437
virtual XmlComment * xmlComment()
Definition: yatexml.h:754
unsigned int row() const
Definition: yatexml.h:117
virtual XmlDocument * document()
Definition: yatexml.h:524
virtual XmlElement * xmlElement()
Definition: yatexml.h:747
Xml Parent.
Definition: yatexml.h:504
String * xmlns() const
Definition: yatexml.h:1541
const String & getBuffer() const
Definition: yatexml.h:193
static const String s_ns
Definition: yatexml.h:1637
virtual XmlDeclaration * xmlDeclaration()
Definition: yatexml.h:775
static XmlElement * findElement(ObjList *list, const String *name, const String *ns, bool noPrefix=true)
Definition: yateclass.h:1048
virtual void clearChildren()
Definition: yatexml.h:926
unsigned int m_row
Definition: yatexml.h:471