Yate: yatexml.h Source File

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
34namespace TelEngine {
35
36class XmlSaxParser;
37class XmlDomParser;
38class XmlDeclaration;
39class XmlFragment;
40class XmlChild;
41class XmlParent;
42class XmlDocument;
43class XmlElement;
44class XmlComment;
45class XmlCData;
46class XmlText;
47class XmlDoctype;
48class XPath;
49
50 struct YATE_API XmlEscape {
54 const char* value;
55
59 char replace;
60};
61
66 class YATE_API XmlSaxParser : public DebugEnabler
67{
68public:
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 == 0x20) || (c == 0x09) || (c == 0x0d) || (c == 0x0a)); }
212
219 static inline bool checkFirstNameCharacter(unsigned char ch) {
220 return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')
221 || (ch == ':') || (ch == '_')
222 || (ch >= 0xc0 && ch <= 0xd6) || (ch >= 0xd8 && ch <= 0xf6) || (ch >= 0xf8);
223 }
224
230 static bool checkDataChar(unsigned char c);
231
237 static inline bool checkNameCharacter(unsigned char ch) {
238 return checkFirstNameCharacter(ch) || ch == '-' || ch == '.' || (ch >= '0' && ch <= '9')
239 || ch == 0xB7;
240 }
241
247 static bool validTag(const String& buf);
248
255 static String& escape(String& buf, const String& text);
256
266 static inline bool unEscape(String& text, String* error, bool* found = 0)
267 { return unEscape(text,text.c_str(),text.length(),error,false,found); }
268
284 static bool unEscape(String& text, const char* str, unsigned int len, String* error,
285 bool inText = false, bool* found = 0);
286
290 static const TokenDict s_errorString[];
291
295 static const XmlEscape s_escape[];
296
297protected:
302 XmlSaxParser(const char* name = "XmlSaxParser");
303
309 bool parseInstruction();
310
316 bool parseCData();
317
323 bool parseComment();
324
330 bool parseElement();
331
337 bool parseDeclaration();
338
344 bool parseSpecial();
345
351 bool parseEndTag();
352
359 bool parseDoctype();
360
366 bool auxParse();
367
374 void unEscape(String& text);
375
379 void skipBlanks();
380
386 inline bool badCharacter(char c)
387 { return c == '<' || c == '>'; }
388
392 inline void resetError()
393 { m_error = NoError; }
394
398 inline void resetParsed()
399 { m_parsed.clear(); m_parsed.clearParams(); }
400
405 String* extractName(bool& empty);
406
411 NamedString* getAttribute();
412
418 virtual void gotComment(const String& text)
419 { }
420
426 virtual void gotProcessing(const NamedString& instr)
427 { }
428
434 virtual void gotDeclaration(const NamedList& decl)
435 { }
436
442 virtual void gotText(const String& text)
443 { }
444
450 virtual void gotCdata(const String& data)
451 { }
452
459 virtual void gotElement(const NamedList& element, bool empty)
460 { }
461
467 virtual void endElement(const String& name)
468 { }
469
475 virtual void gotDoctype(const String& doc)
476 { }
477
483 virtual bool completed()
484 { return true; }
485
492 bool processElement(NamedList& list, bool empty);
493
499 bool processText(String& text);
500
504 unsigned int m_offset;
505
509 unsigned int m_row;
510
514 unsigned int m_column;
515
519 Error m_error;
520
524 String m_buf;
525
530 NamedList m_parsed;
531
535 Type m_unparsed;
536};
537
542 class YATE_API XmlParent
543{
544public:
548 XmlParent()
549 { }
550
554 virtual ~XmlParent()
555 { }
556
562 virtual XmlDocument* document()
563 { return 0; }
564
570 virtual XmlFragment* fragment()
571 { return 0; }
572
578 virtual XmlElement* element()
579 { return 0; }
580
586 virtual XmlSaxParser::Error addChild(XmlChild* child) = 0;
587
594 inline XmlChild* addChildSafe(XmlChild* child, XmlSaxParser::Error* code = 0) {
595 XmlSaxParser::Error err = addChild(child);
596 if (err != XmlSaxParser::NoError) {
597 TelEngine::destruct(child);
598 if (code)
599 *code = err;
600 }
601 return child;
602 }
603
610 virtual XmlChild* removeChild(XmlChild* child, bool delObj = true) = 0;
611
616 virtual void reset()
617 { }
618
624 virtual const ObjList& getChildren() const
625 { return ObjList::empty(); }
626
631 virtual void clearChildren()
632 { }
633
638 inline bool hasChildren() const
639 { return getChildren().skipNull() != 0; }
640};
641
646 class YATE_API XmlDomParser : public XmlSaxParser
647{
648 friend class XmlChild;
649public:
655 XmlDomParser(const char* name = "XmlDomParser", bool fragment = false);
656
662 XmlDomParser(XmlParent* fragment, bool takeOwnership);
663
667 virtual ~XmlDomParser();
668
673 XmlDocument* document()
674 { return m_data->document(); }
675
680 XmlFragment* fragment()
681 { return m_data->fragment(); }
682
686 virtual void reset();
687
693 inline bool isCurrent(const XmlElement* el) const
694 { return el == m_current; }
695
696protected:
697
702 virtual void gotComment(const String& text);
703
708 virtual void gotProcessing(const NamedString& instr);
709
714 virtual void gotDeclaration(const NamedList& decl);
715
720 virtual void gotText(const String& text);
721
726 virtual void gotCdata(const String& data);
727
733 virtual void gotElement(const NamedList& element, bool empty);
734
739 virtual void endElement(const String& name);
740
745 virtual void gotDoctype(const String& doc);
746
751 virtual bool completed()
752 { return m_current == 0; }
753
754private:
755 XmlElement* m_current; // The current xml element
756 XmlParent* m_data; // Main xml fragment
757 bool m_ownData; // The DOM owns data
758};
759
764 class YATE_API XmlChild : public GenObject
765{
766 YCLASS(XmlChild,GenObject)
767 friend class XmlDomParser;
768public:
772 XmlChild();
773
778 virtual void setParent(XmlParent* parent)
779 { }
780
785 virtual XmlElement* xmlElement()
786 { return 0; }
787
792 virtual XmlComment* xmlComment()
793 { return 0; }
794
799 virtual XmlCData* xmlCData()
800 { return 0; }
801
806 virtual XmlText* xmlText()
807 { return 0; }
808
813 virtual XmlDeclaration* xmlDeclaration()
814 { return 0; }
815
820 virtual XmlDoctype* xmlDoctype()
821 { return 0; }
822
827 virtual void replaceParams(const NamedList& params)
828 {}
829};
830
831
836 class YATE_API XmlDeclaration : public XmlChild
837{
838 YCLASS(XmlDeclaration,XmlChild)
839public:
845 XmlDeclaration(const char* version = "1.0", const char* enc = "utf-8");
846
851 XmlDeclaration(const NamedList& decl);
852
857 XmlDeclaration(const XmlDeclaration& orig);
858
862 ~XmlDeclaration();
863
868 inline const NamedList& getDec() const
869 { return m_declaration; }
870
876 virtual XmlDeclaration* xmlDeclaration()
877 { return this; }
878
884 void toString(String& dump, bool escape = true) const;
885
886private:
887 NamedList m_declaration; // The declaration
888};
889
894 class YATE_API XmlFragment : public XmlParent
895{
896public:
897
901 XmlFragment();
902
907 XmlFragment(const XmlFragment& orig);
908
912 virtual ~XmlFragment();
913
918 virtual XmlFragment* fragment()
919 { return this; }
920
925 virtual const ObjList& getChildren() const
926 { return m_list; }
927
933 virtual XmlSaxParser::Error addChild(XmlChild* child);
934
938 virtual void reset();
939
944 inline XmlChild* pop()
945 { return static_cast<XmlChild*>(m_list.remove(false)); }
946
951 XmlElement* popElement();
952
959 virtual XmlChild* removeChild(XmlChild* child, bool delObj = true);
960
964 virtual void clearChildren()
965 { m_list.clear(); }
966
972 void copy(const XmlFragment& other, XmlParent* parent = 0);
973
986 void toString(String& dump, bool escape = true, const String& indent = String::empty(),
987 const String& origIndent = String::empty(), bool completeOnly = true,
988 const String* auth = 0, const XmlElement* parent = 0) const;
989
994 void replaceParams(const NamedList& params);
995
1006 static inline XmlElement* findElement(ObjList* list, const String* name, const String* ns,
1007 bool noPrefix = true)
1008 { return getElement(list,name,ns,noPrefix); }
1009
1020 static XmlElement* getElement(ObjList*& lst, const String* name = 0, const String* ns = 0,
1021 bool noPrefix = true);
1022
1028 static inline XmlText* findText(ObjList* lst)
1029 { return getText(lst); }
1030
1036 static inline XmlText* getText(ObjList*& lst) {
1037 XmlText* x = 0;
1038 for (; lst && !x; lst = lst->skipNext())
1039 x = (static_cast<XmlChild*>(lst->get()))->xmlText();
1040 return x;
1041 }
1042
1043private:
1044 static XmlElement* elementMatch(XmlElement* xml, const String* name, const String* ns,
1045 bool noPrefix = true);
1046 ObjList m_list; // The children list
1047};
1048
1053 class YATE_API XmlDocument : public XmlParent
1054{
1055public:
1056
1060 XmlDocument();
1061
1065 virtual ~XmlDocument();
1066
1071 virtual XmlDocument* document()
1072 { return this; }
1073
1083 virtual XmlSaxParser::Error addChild(XmlChild* child);
1084
1089 XmlDeclaration* declaration() const;
1090
1097 inline const XmlFragment& getFragment(bool before) const
1098 { return before ? m_beforeRoot : m_afterRoot; }
1099
1105 XmlElement* root(bool completed = false) const;
1106
1112 inline XmlElement* takeRoot(bool completed = false)
1113 {
1114 XmlElement* r = root(completed);
1115 if (r)
1116 m_root = 0;
1117 return r;
1118 }
1119
1123 virtual void reset();
1124
1131 virtual XmlChild* removeChild(XmlChild* child, bool delObj = true)
1132 { return m_beforeRoot.removeChild(child,delObj); }
1133
1140 virtual XmlSaxParser::Error read(Stream& in, int* error = 0);
1141
1154 virtual int write(Stream& out, bool escape = true,
1155 const String& indent = String::empty(), const String& origIndent = String::empty(),
1156 bool completeOnly = true) const;
1157
1165 XmlSaxParser::Error loadFile(const char* file, int* error = 0);
1166
1177 int saveFile(const char* file = 0, bool escape = true,
1178 const String& indent = String::empty(), bool completeOnly = true,
1179 const char* eoln = "\r\n") const;
1180
1188 void toString(String& dump, bool escape = true, const String& indent = String::empty(),
1189 const String& origIndent = String::empty()) const;
1190
1195 void replaceParams(const NamedList& params);
1196
1197private:
1198 XmlElement* m_root; // The root element
1199 XmlFragment m_beforeRoot; // XML children before root (declaration ...)
1200 String m_file; // The file name used on load
1201 XmlFragment m_afterRoot; // XML children after root (comments, empty text)
1202};
1203
1204
1210 class YATE_API XmlElement : public XmlChild, public XmlParent
1211{
1212 YCLASS(XmlElement,XmlChild)
1213public:
1220 XmlElement(const NamedList& element, bool empty, XmlParent* parent = 0);
1221
1227 XmlElement(const char* name, bool complete = true);
1228
1235 XmlElement(const char* name, const char* value, bool complete = true);
1236
1241 XmlElement(const XmlElement& orig);
1242
1246 virtual ~XmlElement();
1247
1252 inline const char* tag() const
1253 { return m_element; }
1254
1259 inline bool isDefaultNs() const
1260 { return m_prefixed == 0; }
1261
1266 inline const String& unprefixedTag() const
1267 { return m_prefixed ? m_prefixed->name() : static_cast<const String&>(m_element); }
1268
1273 void setUnprefixedTag(const String& s);
1274
1279 inline const String& getTag() const
1280 { return m_prefixed ? m_prefixed->name() : static_cast<const String&>(m_element); }
1281
1288 bool getTag(const String*& tag, const String*& ns) const;
1289
1294 virtual XmlElement* xmlElement()
1295 { return this; }
1296
1301 virtual XmlElement* element()
1302 { return this; }
1303
1308 virtual XmlSaxParser::Error addChild(XmlChild* child);
1309
1316 virtual XmlChild* removeChild(XmlChild* child, bool delObj = true);
1317
1321 virtual void setCompleted()
1322 { m_complete = true; }
1323
1327 inline bool completed() const
1328 { return m_complete; }
1329
1333 inline bool empty() const
1334 { return m_empty; }
1335
1340 inline XmlElement* parent() const
1341 { return m_parent ? m_parent->element() : 0; }
1342
1346 virtual XmlParent* getParent()
1347 { return m_parent; }
1348
1353 virtual void setParent(XmlParent* parent);
1354
1358 virtual const String& getName() const
1359 { return m_element; }
1360
1364 virtual const NamedList& getElement() const
1365 { return m_element; }
1366
1371 inline const ObjList& getChildren() const
1372 { return m_children.getChildren(); }
1373
1377 inline void clearChildren()
1378 { return m_children.clearChildren(); }
1379
1384 inline const NamedList* inheritedNs() const
1385 { return m_inheritedNs; }
1386
1392 void setInheritedNs(const XmlElement* xml = 0, bool inherit = true);
1393
1398 void addInheritedNs(const NamedList& list);
1399
1404 inline XmlElement* pop() {
1405 XmlElement* x = findFirstChild();
1406 if (!(x && x->completed()))
1407 return 0;
1408 m_children.removeChild(x,false);
1409 return x;
1410 }
1411
1416 virtual const String& toString() const
1417 { return m_element; }
1418
1430 void toString(String& dump, bool escape = true, const String& indent = String::empty(),
1431 const String& origIndent = String::empty(), bool completeOnly = true,
1432 const String* auth = 0) const;
1433
1443 inline XmlElement* findFirstChild(const String* name = 0, const String* ns = 0,
1444 bool noPrefix = true) const
1445 { return XmlFragment::findElement(getChildren().skipNull(),name,ns,noPrefix); }
1446
1456 inline XmlElement* findFirstChild(const String& name, const String* ns = 0,
1457 bool noPrefix = true) const
1458 { return XmlFragment::findElement(getChildren().skipNull(),&name,ns,noPrefix); }
1459
1470 inline XmlElement* findNextChild(const XmlElement* prev = 0, const String* name = 0,
1471 const String* ns = 0, bool noPrefix = true) const {
1472 if (!prev)
1473 return findFirstChild(name,ns,noPrefix);
1474 ObjList* start = getChildren().find(prev);
1475 return start ? XmlFragment::findElement(start->skipNext(),name,ns,noPrefix) : 0;
1476 }
1477
1488 inline XmlElement* findNextChild(const String& name, const XmlElement* prev = 0,
1489 const String* ns = 0, bool noPrefix = true) const
1490 { return findNextChild(prev,&name,ns,noPrefix); }
1491
1501 inline const String* childText(const String& name, const String* ns = 0,
1502 bool noPrefix = true) const {
1503 XmlElement* c = findFirstChild(&name,ns,noPrefix);
1504 return c ? &(c->getText()) : 0;
1505 }
1506
1511 XmlChild* getFirstChild();
1512
1516 const String& getText() const;
1517
1525 XmlText* setText(const char* text);
1526
1531 void addText(const char* text);
1532
1538 void addText(const void* buf, unsigned int len);
1539
1544 inline const NamedList& attributes() const
1545 { return m_element; }
1546
1553 unsigned int copyAttributes(NamedList& list, const String& prefix) const;
1554
1562 inline void setAttributes(const NamedList& list, const String& prefix = String::empty(),
1563 bool skipPrefix = true) {
1564 if (prefix)
1565 m_element.copySubParams(list,prefix,skipPrefix);
1566 else
1567 m_element.copyParams(list);
1568 }
1569
1575 inline void setAttribute(const String& name, const char* value)
1576 { m_element.setParam(name,value); }
1577
1583 inline void setAttributeValid(const String& name, const char* value) {
1584 if (!TelEngine::null(value))
1585 m_element.setParam(name,value);
1586 else
1587 removeAttribute(name);
1588 }
1589
1595 inline const char* attribute(const String& name) const
1596 { return m_element.getValue(name); }
1597
1603 inline String* getAttribute(const String& name) const
1604 { return m_element.getParam(name); }
1605
1612 inline bool hasAttribute(const String& name, const String& value) const {
1613 String* a = getAttribute(name);
1614 return a && *a == value;
1615 }
1616
1621 inline void removeAttribute(const String& name)
1622 { m_element.clearParam(name); }
1623
1628 inline String* xmlns() const {
1629 if (!m_prefixed)
1630 return xmlnsAttribute(s_ns);
1631 return xmlnsAttribute(s_nsPrefix + *m_prefixed);
1632 }
1633
1638 String* xmlnsAttribute(const String& name) const;
1639
1645 inline bool hasXmlns(const String& ns) const {
1646 const String* x = xmlns();
1647 return x && *x == ns;
1648 }
1649
1658 bool setXmlns(const String& name = String::empty(), bool addAttr = false,
1659 const String& value = String::empty());
1660
1666 virtual void replaceParams(const NamedList& params);
1667
1674 inline XmlElement* addChild(const char* name, const char* value = 0) {
1675 return TelEngine::null(name) ? 0
1676 : static_cast<XmlElement*>(addChildSafe(new XmlElement(name,value)));
1677 }
1678
1686 inline XmlElement* addChildHex(const char* name, const void* buf, unsigned int len) {
1687 XmlElement* x = addChild(name);
1688 if (x)
1689 x->addText(buf,len);
1690 return x;
1691 }
1692
1699 static inline bool isXmlns(const String& str)
1700 { return str == s_ns || str.startsWith(s_nsPrefix); }
1701
1718 static XmlElement* param2xml(NamedString* param, const String& tag,
1719 bool copyXml = false);
1720
1730 static NamedString* xml2param(XmlElement* xml, const String* tag,
1731 bool copyXml = false);
1732
1743 static void xml2param(NamedList& list, XmlElement* parent, const String* tag,
1744 bool copyXml = false);
1745
1749 static const String s_ns;
1750
1754 static const String s_nsPrefix;
1755
1756private:
1757 // Set prefixed data (tag and prefix)
1758 inline void setPrefixed() {
1759 TelEngine::destruct(m_prefixed);
1760 int pos = m_element.find(":");
1761 if (pos != -1)
1762 m_prefixed = new NamedString(m_element.substr(pos + 1),m_element.substr(0,pos));
1763 }
1764
1765 XmlFragment m_children; // Children of this element
1766 NamedList m_element; // The element
1767 NamedString* m_prefixed; // Splitted prefixed tag (the value is the namespace prefix)
1768 XmlParent* m_parent; // The XmlElement who holds this element
1769 NamedList* m_inheritedNs; // Inherited namespaces (if parent is 0)
1770 bool m_empty; // True if this element does not have any children
1771 bool m_complete; // True if the end element tag war reported
1772};
1773
1778 class YATE_API XmlComment : public XmlChild
1779{
1780 YCLASS(XmlComment,XmlChild)
1781public:
1786 XmlComment(const String& comm);
1787
1792 XmlComment(const XmlComment& orig);
1793
1797 virtual ~XmlComment();
1798
1803 inline const String& getComment() const
1804 { return m_comment; }
1805
1811 void toString(String& dump, const String& indent = String::empty()) const;
1812
1817 virtual XmlComment* xmlComment()
1818 { return this; }
1819
1820private:
1821 String m_comment; // The comment
1822};
1823
1828 class YATE_API XmlCData : public XmlChild
1829{
1830 YCLASS(XmlCData,XmlChild)
1831public:
1832
1837 XmlCData(const String& data);
1838
1843 XmlCData(const XmlCData& orig);
1844
1848 virtual ~XmlCData();
1849
1854 inline const String& getCData() const
1855 { return m_data;}
1856
1862 void toString(String& dump, const String& indent = String::empty()) const;
1863
1868 virtual XmlCData* xmlCData()
1869 { return this; }
1870
1871private:
1872 String m_data; // The data
1873};
1874
1879 class YATE_API XmlText : public XmlChild
1880{
1881 YCLASS(XmlText,XmlChild)
1882public:
1887 XmlText(const char* text);
1888
1894 XmlText(const void* buf, unsigned int len);
1895
1900 XmlText(const XmlText& orig);
1901
1905 virtual ~XmlText();
1906
1910 inline const String& getText() const
1911 { return m_text; }
1912
1917 inline void setText(const char* text)
1918 { m_text = text; }
1919
1925 inline void setText(const void* buf, unsigned int len)
1926 { m_text.hexify(buf,len); }
1927
1938 void toString(String& dump, bool escape = true, const String& indent = String::empty(),
1939 const String* auth = 0, const XmlElement* parent = 0) const;
1940
1945 virtual XmlText* xmlText()
1946 { return this; }
1947
1952 bool onlySpaces();
1953
1958 virtual void replaceParams(const NamedList& params);
1959
1960private:
1961 String m_text; // The text
1962};
1963
1964 class YATE_API XmlDoctype : public XmlChild
1965{
1966 YCLASS(XmlDoctype,XmlChild)
1967public:
1972 XmlDoctype(const String& doctype);
1973
1978 XmlDoctype(const XmlDoctype& orig);
1979
1983 virtual ~XmlDoctype();
1984
1989 inline const String& getDoctype() const
1990 { return m_doctype; }
1991
1996 virtual XmlDoctype* xmlDoctype()
1997 { return this; }
1998
2004 void toString(String& dump, const String& indent = String::empty()) const;
2005
2006private:
2007 String m_doctype; // The document type
2008};
2009
2010
2011// Internal
2012class XPathParseData;
2013class XPathPredicate;
2014class XPathStep;
2015class XPathNodeCheck;
2016
2021 class YATE_API XPath : public String
2022{
2023 YCLASS(XPath,String)
2024public:
2028 enum Flags {
2029 LateParse = 0x0001, // Don't try to parse in constructor
2030 StrictParse = 0x0002, // Strict parse
2031 // - Don't allow spaces at step start
2032 // - Don't ignore duplicate index predicate (not specified in spec but common sense)
2033 IgnoreEmptyResult = 0x0004, // Don't check always empty result path (avoid error: EEmptyResult)
2034 NoXmlNameCheck = 0x0008, // Don't validate XML names (tag and attribute)
2035 // Internal
2036 FInternal = 0xff00, // Internal flags mask
2037 FAbsolute = 0x0100, // Absolute path
2038 FCopying = 0x0200,
2039 };
2040
2044 enum Find {
2045 FindXml = 0x01,
2046 FindText = 0x02,
2047 FindAttr = 0x04,
2048 FindAny = FindXml | FindText | FindAttr
2049 };
2050
2054 enum Status {
2055 NoError = 0,
2056 // Syntax errors
2057 EEmptyItem, // Empty path item
2058 ESyntax, // Generic syntax error
2059 // Semantic errors
2060 ERange, // Out of range value
2061 ESemantic, // Generic semantic error
2062 // Oher errors
2063 EEmptyResult, // Path will always produce an empty result
2064 NotParsed, // Path not parsed, never returned as error
2065 };
2066
2072 XPath(const char* value = 0, unsigned int flags = 0);
2073
2078 XPath(const XPath& other);
2079
2083 virtual ~XPath();
2084
2089 inline bool absolute() const
2090 { return 0 != (m_flags & FAbsolute); }
2091
2096 inline unsigned int status() const
2097 { return m_status; }
2098
2103 inline unsigned int errorItem() const
2104 { return m_errorItem; }
2105
2110 inline const String& error() const
2111 { return m_error; }
2112
2118 inline String& describeError(String& buf) const {
2119 if (!status())
2120 return buf;
2121 buf << "item=" << m_errorItem << " status=" << m_status;
2122 const char* tmp = error() ? error().c_str() : lookup(m_status,dictErrors());
2123 if (tmp)
2124 buf << " (" << tmp << ")";
2125 return buf;
2126 }
2127
2132 inline unsigned int parse() {
2133 if (NotParsed == status())
2134 parsePath();
2135 return status();
2136 }
2137
2148 inline const GenObject* find(const XmlElement& xml, unsigned int what, ObjList* list = 0) const {
2149 if (status() || 0 == (FindAny & what))
2150 return 0;
2151 const GenObject* res = 0;
2152 unsigned int total = 0;
2153 find(total,xml,res,list,what,0,0,absolute());
2154 return res;
2155 }
2156
2165 inline XmlElement* findXml(const XmlElement& xml, ObjList* list = 0) const
2166 { return (XmlElement*)find(xml,FindXml,list); }
2167
2176 inline const String* findText(const XmlElement& xml, ObjList* list = 0) const
2177 { return (const String*)find(xml,FindText,list); }
2178
2188 String& dump(String& buf, bool escape = true, const char* itemSep = "\r\n",
2189 bool sepFirst = true) const;
2190
2196 void dump(ObjList& lst, bool escape = true) const;
2197
2202 inline XPath& operator=(const XPath& other)
2203 { return copy(other); }
2204
2210 static inline const String* anyValue(const GenObject* gen) {
2211 if (!gen)
2212 return 0;
2213 const XmlElement* xml = YOBJECT(XmlElement,gen);
2214 if (xml)
2215 return &xml->getText();
2216 const NamedString* ns = YOBJECT(NamedString,gen);
2217 return ns ? (const String*)ns : &gen->toString();
2218 }
2219
2229 static String& escape(String& buf, const String& str, char quot = '"', bool literal = true);
2230
2235 static unsigned int maxStepPredicates();
2236
2241 static const TokenDict* dictErrors();
2242
2243protected:
2248 virtual void changed();
2249
2253 void parsePath();
2254
2258 void reset();
2259
2260private:
2261 int find(unsigned int& total, const XmlElement& src, const GenObject*& res, ObjList* list,
2262 unsigned int what, ObjList* crtItem = 0, unsigned int step = 0, bool absolute = false) const;
2263 int getText(unsigned int& total, const XmlElement& xml, const GenObject*& res,
2264 XPathNodeCheck& data) const;
2265 bool parseStepPredicate(XPathParseData& data, XPathPredicate* pred);
2266 bool checkStepPredicate(XPathParseData& data, XPathStep* step, XPathPredicate* pred);
2267 bool setStatus(unsigned int code, unsigned int itemIdx = 0, const char* error = 0,
2268 XPathParseData* data = 0);
2269 XPath& copy(const XPath& other, bool constr = false);
2270
2271 unsigned int m_flags;
2272 ObjList m_items;
2273 unsigned int m_status;
2274 unsigned int m_errorItem;
2275 String m_error;
2276};
2277
2278}; // namespace TelEngine
2279
2280#endif /* __YATEXML_H */
2281
2282/* vi: set ts=8 sw=4 sts=4 noet: */
DebugEnabler
A holder for a debug level.
Definition yateclass.h:329
GenObject
Definition yateclass.h:1627
GenObject::toString
virtual const String & toString() const
NamedList
A named string container class.
Definition yateclass.h:7690
NamedList::clearParams
void clearParams()
Definition yateclass.h:7757
NamedList::getParam
NamedString * getParam(const String &name) const
NamedList::setParam
NamedList & setParam(NamedString *param)
NamedList::getValue
const char * getValue(const String &name, const char *defvalue=0) const
NamedList::clearParam
NamedList & clearParam(const String &name, char childSep=0, const String *value=0)
NamedList::copySubParams
NamedList & copySubParams(const NamedList &original, const String &prefix, bool skipPrefix=true, bool replace=false)
NamedList::copyParams
NamedList & copyParams(bool replace, const NamedList &original, bool copyUserData=false)
NamedString
A named string class.
Definition yateclass.h:5304
NamedString::name
const String & name() const
Definition yateclass.h:5319
ObjList
An object list class.
Definition yateclass.h:2032
ObjList::find
ObjList * find(const GenObject *obj) const
ObjList::skipNull
ObjList * skipNull() const
ObjList::skipNext
ObjList * skipNext() const
ObjList::get
GenObject * get() const
Definition yateclass.h:2068
ObjList::clear
void clear()
ObjList::empty
static const ObjList & empty()
ObjList::remove
GenObject * remove(bool delobj=true)
Stream
An abstract stream class capable of reading and writing.
Definition yateclass.h:11123
String
A C-style string handling class.
Definition yateclass.h:3055
String::c_str
const char * c_str() const
Definition yateclass.h:3160
String::find
int find(char what, unsigned int offs=0) const
String::hexify
String & hexify(const void *data, unsigned int len, char sep=0, bool upCase=false)
String::clear
void clear()
String::startsWith
bool startsWith(const char *what, bool wordBreak=false, bool caseInsensitive=false) const
String::empty
static const String & empty()
String::length
unsigned int length() const
Definition yateclass.h:3182
String::substr
String substr(int offs, int len=-1) const
TelEngine::XPath
XML Path holder.
Definition yatexml.h:2022
TelEngine::XPath::XPath
XPath(const char *value=0, unsigned int flags=0)
TelEngine::XPath::absolute
bool absolute() const
Definition yatexml.h:2089
TelEngine::XPath::parse
unsigned int parse()
Definition yatexml.h:2132
TelEngine::XPath::errorItem
unsigned int errorItem() const
Definition yatexml.h:2103
TelEngine::XPath::operator=
XPath & operator=(const XPath &other)
Definition yatexml.h:2202
TelEngine::XPath::dump
String & dump(String &buf, bool escape=true, const char *itemSep="\r\n", bool sepFirst=true) const
TelEngine::XPath::find
const GenObject * find(const XmlElement &xml, unsigned int what, ObjList *list=0) const
Definition yatexml.h:2148
TelEngine::XPath::findText
const String * findText(const XmlElement &xml, ObjList *list=0) const
Definition yatexml.h:2176
TelEngine::XPath::findXml
XmlElement * findXml(const XmlElement &xml, ObjList *list=0) const
Definition yatexml.h:2165
TelEngine::XPath::describeError
String & describeError(String &buf) const
Definition yatexml.h:2118
TelEngine::XPath::maxStepPredicates
static unsigned int maxStepPredicates()
TelEngine::XPath::~XPath
virtual ~XPath()
TelEngine::XPath::parsePath
void parsePath()
TelEngine::XPath::changed
virtual void changed()
TelEngine::XPath::dump
void dump(ObjList &lst, bool escape=true) const
TelEngine::XPath::Status
Status
Definition yatexml.h:2054
TelEngine::XPath::anyValue
static const String * anyValue(const GenObject *gen)
Definition yatexml.h:2210
TelEngine::XPath::XPath
XPath(const XPath &other)
TelEngine::XPath::escape
static String & escape(String &buf, const String &str, char quot='"', bool literal = true)
TelEngine::XPath::Flags
Flags
Definition yatexml.h:2028
TelEngine::XPath::dictErrors
static const TokenDict * dictErrors()
TelEngine::XPath::Find
Find
Definition yatexml.h:2044
TelEngine::XPath::status
unsigned int status() const
Definition yatexml.h:2096
TelEngine::XPath::reset
void reset()
TelEngine::XPath::error
const String & error() const
Definition yatexml.h:2110
TelEngine::XmlCData
Xml Declaration.
Definition yatexml.h:1829
TelEngine::XmlCData::getCData
const String & getCData() const
Definition yatexml.h:1854
TelEngine::XmlCData::toString
void toString(String &dump, const String &indent=String::empty()) const
TelEngine::XmlCData::xmlCData
virtual XmlCData * xmlCData()
Definition yatexml.h:1868
TelEngine::XmlCData::~XmlCData
virtual ~XmlCData()
TelEngine::XmlCData::XmlCData
XmlCData(const XmlCData &orig)
TelEngine::XmlCData::XmlCData
XmlCData(const String &data)
TelEngine::XmlChild
Xml Child.
Definition yatexml.h:765
TelEngine::XmlChild::xmlElement
virtual XmlElement * xmlElement()
Definition yatexml.h:785
TelEngine::XmlChild::replaceParams
virtual void replaceParams(const NamedList &params)
Definition yatexml.h:827
TelEngine::XmlChild::xmlComment
virtual XmlComment * xmlComment()
Definition yatexml.h:792
TelEngine::XmlChild::setParent
virtual void setParent(XmlParent *parent)
Definition yatexml.h:778
TelEngine::XmlChild::xmlCData
virtual XmlCData * xmlCData()
Definition yatexml.h:799
TelEngine::XmlChild::XmlChild
XmlChild()
TelEngine::XmlChild::xmlDeclaration
virtual XmlDeclaration * xmlDeclaration()
Definition yatexml.h:813
TelEngine::XmlChild::xmlDoctype
virtual XmlDoctype * xmlDoctype()
Definition yatexml.h:820
TelEngine::XmlChild::xmlText
virtual XmlText * xmlText()
Definition yatexml.h:806
TelEngine::XmlComment
Xml Comment.
Definition yatexml.h:1779
TelEngine::XmlComment::~XmlComment
virtual ~XmlComment()
TelEngine::XmlComment::toString
void toString(String &dump, const String &indent=String::empty()) const
TelEngine::XmlComment::xmlComment
virtual XmlComment * xmlComment()
Definition yatexml.h:1817
TelEngine::XmlComment::XmlComment
XmlComment(const String &comm)
TelEngine::XmlComment::getComment
const String & getComment() const
Definition yatexml.h:1803
TelEngine::XmlComment::XmlComment
XmlComment(const XmlComment &orig)
TelEngine::XmlDeclaration
Xml Declaration.
Definition yatexml.h:837
TelEngine::XmlDeclaration::XmlDeclaration
XmlDeclaration(const NamedList &decl)
TelEngine::XmlDeclaration::XmlDeclaration
XmlDeclaration(const char *version="1.0", const char *enc="utf-8")
TelEngine::XmlDeclaration::XmlDeclaration
XmlDeclaration(const XmlDeclaration &orig)
TelEngine::XmlDeclaration::getDec
const NamedList & getDec() const
Definition yatexml.h:868
TelEngine::XmlDeclaration::toString
void toString(String &dump, bool escape=true) const
TelEngine::XmlDeclaration::xmlDeclaration
virtual XmlDeclaration * xmlDeclaration()
Definition yatexml.h:876
TelEngine::XmlDeclaration::~XmlDeclaration
~XmlDeclaration()
TelEngine::XmlDoctype
Definition yatexml.h:1965
TelEngine::XmlDoctype::~XmlDoctype
virtual ~XmlDoctype()
TelEngine::XmlDoctype::XmlDoctype
XmlDoctype(const XmlDoctype &orig)
TelEngine::XmlDoctype::toString
void toString(String &dump, const String &indent=String::empty()) const
TelEngine::XmlDoctype::getDoctype
const String & getDoctype() const
Definition yatexml.h:1989
TelEngine::XmlDoctype::XmlDoctype
XmlDoctype(const String &doctype)
TelEngine::XmlDoctype::xmlDoctype
virtual XmlDoctype * xmlDoctype()
Definition yatexml.h:1996
TelEngine::XmlDocument
Xml Document.
Definition yatexml.h:1054
TelEngine::XmlDocument::write
virtual int write(Stream &out, bool escape=true, const String &indent=String::empty(), const String &origIndent=String::empty(), bool completeOnly=true) const
TelEngine::XmlDocument::addChild
virtual XmlSaxParser::Error addChild(XmlChild *child)
TelEngine::XmlDocument::~XmlDocument
virtual ~XmlDocument()
TelEngine::XmlDocument::root
XmlElement * root(bool completed=false) const
TelEngine::XmlDocument::XmlDocument
XmlDocument()
TelEngine::XmlDocument::document
virtual XmlDocument * document()
Definition yatexml.h:1071
TelEngine::XmlDocument::reset
virtual void reset()
TelEngine::XmlDocument::declaration
XmlDeclaration * declaration() const
TelEngine::XmlDocument::takeRoot
XmlElement * takeRoot(bool completed=false)
Definition yatexml.h:1112
TelEngine::XmlDocument::getFragment
const XmlFragment & getFragment(bool before) const
Definition yatexml.h:1097
TelEngine::XmlDocument::replaceParams
void replaceParams(const NamedList &params)
TelEngine::XmlDocument::removeChild
virtual XmlChild * removeChild(XmlChild *child, bool delObj=true)
Definition yatexml.h:1131
TelEngine::XmlDocument::toString
void toString(String &dump, bool escape=true, const String &indent=String::empty(), const String &origIndent=String::empty()) const
TelEngine::XmlDocument::loadFile
XmlSaxParser::Error loadFile(const char *file, int *error=0)
TelEngine::XmlDocument::read
virtual XmlSaxParser::Error read(Stream &in, int *error=0)
TelEngine::XmlDocument::saveFile
int saveFile(const char *file=0, bool escape=true, const String &indent=String::empty(), bool completeOnly=true, const char *eoln="\r\n") const
TelEngine::XmlDomParser
Document Object Model XML Parser.
Definition yatexml.h:647
TelEngine::XmlDomParser::completed
virtual bool completed()
Definition yatexml.h:751
TelEngine::XmlDomParser::XmlDomParser
XmlDomParser(XmlParent *fragment, bool takeOwnership)
TelEngine::XmlDomParser::~XmlDomParser
virtual ~XmlDomParser()
TelEngine::XmlDomParser::gotText
virtual void gotText(const String &text)
TelEngine::XmlDomParser::gotDeclaration
virtual void gotDeclaration(const NamedList &decl)
TelEngine::XmlDomParser::endElement
virtual void endElement(const String &name)
TelEngine::XmlDomParser::reset
virtual void reset()
TelEngine::XmlDomParser::document
XmlDocument * document()
Definition yatexml.h:673
TelEngine::XmlDomParser::gotDoctype
virtual void gotDoctype(const String &doc)
TelEngine::XmlDomParser::gotElement
virtual void gotElement(const NamedList &element, bool empty)
TelEngine::XmlDomParser::gotProcessing
virtual void gotProcessing(const NamedString &instr)
TelEngine::XmlDomParser::gotComment
virtual void gotComment(const String &text)
TelEngine::XmlDomParser::XmlDomParser
XmlDomParser(const char *name="XmlDomParser", bool fragment=false)
TelEngine::XmlDomParser::gotCdata
virtual void gotCdata(const String &data)
TelEngine::XmlDomParser::isCurrent
bool isCurrent(const XmlElement *el) const
Definition yatexml.h:693
TelEngine::XmlDomParser::fragment
XmlFragment * fragment()
Definition yatexml.h:680
TelEngine::XmlElement
Xml Element.
Definition yatexml.h:1211
TelEngine::XmlElement::~XmlElement
virtual ~XmlElement()
TelEngine::XmlElement::parent
XmlElement * parent() const
Definition yatexml.h:1340
TelEngine::XmlElement::setText
XmlText * setText(const char *text)
TelEngine::XmlElement::hasAttribute
bool hasAttribute(const String &name, const String &value) const
Definition yatexml.h:1612
TelEngine::XmlElement::clearChildren
void clearChildren()
Definition yatexml.h:1377
TelEngine::XmlElement::addChild
virtual XmlSaxParser::Error addChild(XmlChild *child)
TelEngine::XmlElement::findNextChild
XmlElement * findNextChild(const XmlElement *prev=0, const String *name=0, const String *ns=0, bool noPrefix=true) const
Definition yatexml.h:1470
TelEngine::XmlElement::xmlElement
virtual XmlElement * xmlElement()
Definition yatexml.h:1294
TelEngine::XmlElement::toString
void toString(String &dump, bool escape=true, const String &indent=String::empty(), const String &origIndent=String::empty(), bool completeOnly=true, const String *auth=0) const
TelEngine::XmlElement::attribute
const char * attribute(const String &name) const
Definition yatexml.h:1595
TelEngine::XmlElement::tag
const char * tag() const
Definition yatexml.h:1252
TelEngine::XmlElement::getAttribute
String * getAttribute(const String &name) const
Definition yatexml.h:1603
TelEngine::XmlElement::addChildHex
XmlElement * addChildHex(const char *name, const void *buf, unsigned int len)
Definition yatexml.h:1686
TelEngine::XmlElement::setXmlns
bool setXmlns(const String &name=String::empty(), bool addAttr=false, const String &value=String::empty())
TelEngine::XmlElement::setUnprefixedTag
void setUnprefixedTag(const String &s)
TelEngine::XmlElement::findNextChild
XmlElement * findNextChild(const String &name, const XmlElement *prev=0, const String *ns=0, bool noPrefix=true) const
Definition yatexml.h:1488
TelEngine::XmlElement::replaceParams
virtual void replaceParams(const NamedList &params)
TelEngine::XmlElement::xmlnsAttribute
String * xmlnsAttribute(const String &name) const
TelEngine::XmlElement::pop
XmlElement * pop()
Definition yatexml.h:1404
TelEngine::XmlElement::findFirstChild
XmlElement * findFirstChild(const String &name, const String *ns=0, bool noPrefix=true) const
Definition yatexml.h:1456
TelEngine::XmlElement::isXmlns
static bool isXmlns(const String &str)
Definition yatexml.h:1699
TelEngine::XmlElement::setAttributeValid
void setAttributeValid(const String &name, const char *value)
Definition yatexml.h:1583
TelEngine::XmlElement::xmlns
String * xmlns() const
Definition yatexml.h:1628
TelEngine::XmlElement::empty
bool empty() const
Definition yatexml.h:1333
TelEngine::XmlElement::XmlElement
XmlElement(const XmlElement &orig)
TelEngine::XmlElement::attributes
const NamedList & attributes() const
Definition yatexml.h:1544
TelEngine::XmlElement::param2xml
static XmlElement * param2xml(NamedString *param, const String &tag, bool copyXml=false)
TelEngine::XmlElement::XmlElement
XmlElement(const NamedList &element, bool empty, XmlParent *parent=0)
TelEngine::XmlElement::xml2param
static void xml2param(NamedList &list, XmlElement *parent, const String *tag, bool copyXml=false)
TelEngine::XmlElement::setAttributes
void setAttributes(const NamedList &list, const String &prefix=String::empty(), bool skipPrefix=true)
Definition yatexml.h:1562
TelEngine::XmlElement::s_ns
static const String s_ns
Definition yatexml.h:1749
TelEngine::XmlElement::setInheritedNs
void setInheritedNs(const XmlElement *xml=0, bool inherit=true)
TelEngine::XmlElement::setParent
virtual void setParent(XmlParent *parent)
TelEngine::XmlElement::toString
virtual const String & toString() const
Definition yatexml.h:1416
TelEngine::XmlElement::copyAttributes
unsigned int copyAttributes(NamedList &list, const String &prefix) const
TelEngine::XmlElement::setCompleted
virtual void setCompleted()
Definition yatexml.h:1321
TelEngine::XmlElement::addText
void addText(const char *text)
TelEngine::XmlElement::element
virtual XmlElement * element()
Definition yatexml.h:1301
TelEngine::XmlElement::getTag
bool getTag(const String *&tag, const String *&ns) const
TelEngine::XmlElement::hasXmlns
bool hasXmlns(const String &ns) const
Definition yatexml.h:1645
TelEngine::XmlElement::getName
virtual const String & getName() const
Definition yatexml.h:1358
TelEngine::XmlElement::XmlElement
XmlElement(const char *name, bool complete=true)
TelEngine::XmlElement::getFirstChild
XmlChild * getFirstChild()
TelEngine::XmlElement::getParent
virtual XmlParent * getParent()
Definition yatexml.h:1346
TelEngine::XmlElement::getElement
virtual const NamedList & getElement() const
Definition yatexml.h:1364
TelEngine::XmlElement::completed
bool completed() const
Definition yatexml.h:1327
TelEngine::XmlElement::unprefixedTag
const String & unprefixedTag() const
Definition yatexml.h:1266
TelEngine::XmlElement::XmlElement
XmlElement(const char *name, const char *value, bool complete=true)
TelEngine::XmlElement::getText
const String & getText() const
TelEngine::XmlElement::removeChild
virtual XmlChild * removeChild(XmlChild *child, bool delObj=true)
TelEngine::XmlElement::addText
void addText(const void *buf, unsigned int len)
TelEngine::XmlElement::isDefaultNs
bool isDefaultNs() const
Definition yatexml.h:1259
TelEngine::XmlElement::addChild
XmlElement * addChild(const char *name, const char *value=0)
Definition yatexml.h:1674
TelEngine::XmlElement::getChildren
const ObjList & getChildren() const
Definition yatexml.h:1371
TelEngine::XmlElement::inheritedNs
const NamedList * inheritedNs() const
Definition yatexml.h:1384
TelEngine::XmlElement::addInheritedNs
void addInheritedNs(const NamedList &list)
TelEngine::XmlElement::findFirstChild
XmlElement * findFirstChild(const String *name=0, const String *ns=0, bool noPrefix=true) const
Definition yatexml.h:1443
TelEngine::XmlElement::removeAttribute
void removeAttribute(const String &name)
Definition yatexml.h:1621
TelEngine::XmlElement::setAttribute
void setAttribute(const String &name, const char *value)
Definition yatexml.h:1575
TelEngine::XmlElement::xml2param
static NamedString * xml2param(XmlElement *xml, const String *tag, bool copyXml=false)
TelEngine::XmlElement::getTag
const String & getTag() const
Definition yatexml.h:1279
TelEngine::XmlElement::s_nsPrefix
static const String s_nsPrefix
Definition yatexml.h:1754
TelEngine::XmlElement::childText
const String * childText(const String &name, const String *ns=0, bool noPrefix=true) const
Definition yatexml.h:1501
TelEngine::XmlFragment
Xml Fragment.
Definition yatexml.h:895
TelEngine::XmlFragment::~XmlFragment
virtual ~XmlFragment()
TelEngine::XmlFragment::fragment
virtual XmlFragment * fragment()
Definition yatexml.h:918
TelEngine::XmlFragment::XmlFragment
XmlFragment()
TelEngine::XmlFragment::addChild
virtual XmlSaxParser::Error addChild(XmlChild *child)
TelEngine::XmlFragment::copy
void copy(const XmlFragment &other, XmlParent *parent=0)
TelEngine::XmlFragment::popElement
XmlElement * popElement()
TelEngine::XmlFragment::XmlFragment
XmlFragment(const XmlFragment &orig)
TelEngine::XmlFragment::toString
void toString(String &dump, bool escape=true, const String &indent=String::empty(), const String &origIndent=String::empty(), bool completeOnly=true, const String *auth=0, const XmlElement *parent=0) const
TelEngine::XmlFragment::findText
static XmlText * findText(ObjList *lst)
Definition yatexml.h:1028
TelEngine::XmlFragment::reset
virtual void reset()
TelEngine::XmlFragment::clearChildren
virtual void clearChildren()
Definition yatexml.h:964
TelEngine::XmlFragment::getChildren
virtual const ObjList & getChildren() const
Definition yatexml.h:925
TelEngine::XmlFragment::pop
XmlChild * pop()
Definition yatexml.h:944
TelEngine::XmlFragment::replaceParams
void replaceParams(const NamedList &params)
TelEngine::XmlFragment::findElement
static XmlElement * findElement(ObjList *list, const String *name, const String *ns, bool noPrefix=true)
Definition yatexml.h:1006
TelEngine::XmlFragment::removeChild
virtual XmlChild * removeChild(XmlChild *child, bool delObj=true)
TelEngine::XmlFragment::getElement
static XmlElement * getElement(ObjList *&lst, const String *name=0, const String *ns=0, bool noPrefix=true)
TelEngine::XmlFragment::getText
static XmlText * getText(ObjList *&lst)
Definition yatexml.h:1036
TelEngine::XmlParent
Xml Parent.
Definition yatexml.h:543
TelEngine::XmlParent::~XmlParent
virtual ~XmlParent()
Definition yatexml.h:554
TelEngine::XmlParent::fragment
virtual XmlFragment * fragment()
Definition yatexml.h:570
TelEngine::XmlParent::document
virtual XmlDocument * document()
Definition yatexml.h:562
TelEngine::XmlParent::removeChild
virtual XmlChild * removeChild(XmlChild *child, bool delObj=true)=0
TelEngine::XmlParent::XmlParent
XmlParent()
Definition yatexml.h:548
TelEngine::XmlParent::reset
virtual void reset()
Definition yatexml.h:616
TelEngine::XmlParent::clearChildren
virtual void clearChildren()
Definition yatexml.h:631
TelEngine::XmlParent::element
virtual XmlElement * element()
Definition yatexml.h:578
TelEngine::XmlParent::getChildren
virtual const ObjList & getChildren() const
Definition yatexml.h:624
TelEngine::XmlParent::hasChildren
bool hasChildren() const
Definition yatexml.h:638
TelEngine::XmlParent::addChildSafe
XmlChild * addChildSafe(XmlChild *child, XmlSaxParser::Error *code=0)
Definition yatexml.h:594
TelEngine::XmlParent::addChild
virtual XmlSaxParser::Error addChild(XmlChild *child)=0
TelEngine::XmlSaxParser
Serial Access XML Parser.
Definition yatexml.h:67
TelEngine::XmlSaxParser::resetError
void resetError()
Definition yatexml.h:392
TelEngine::XmlSaxParser::unEscape
static bool unEscape(String &text, const char *str, unsigned int len, String *error, bool inText=false, bool *found=0)
TelEngine::XmlSaxParser::extractName
String * extractName(bool &empty)
TelEngine::XmlSaxParser::unEscape
static bool unEscape(String &text, String *error, bool *found=0)
Definition yatexml.h:266
TelEngine::XmlSaxParser::getError
static const char * getError(int code, const char *defVal="Xml error")
Definition yatexml.h:202
TelEngine::XmlSaxParser::checkFirstNameCharacter
static bool checkFirstNameCharacter(unsigned char ch)
Definition yatexml.h:219
TelEngine::XmlSaxParser::skipBlanks
void skipBlanks()
TelEngine::XmlSaxParser::parseSpecial
bool parseSpecial()
TelEngine::XmlSaxParser::s_escape
static const XmlEscape s_escape[]
Definition yatexml.h:295
TelEngine::XmlSaxParser::completed
virtual bool completed()
Definition yatexml.h:483
TelEngine::XmlSaxParser::offset
unsigned int offset() const
Definition yatexml.h:110
TelEngine::XmlSaxParser::m_row
unsigned int m_row
Definition yatexml.h:509
TelEngine::XmlSaxParser::m_unparsed
Type m_unparsed
Definition yatexml.h:535
TelEngine::XmlSaxParser::unparsed
Type unparsed()
Definition yatexml.h:175
TelEngine::XmlSaxParser::processElement
bool processElement(NamedList &list, bool empty)
TelEngine::XmlSaxParser::gotText
virtual void gotText(const String &text)
Definition yatexml.h:442
TelEngine::XmlSaxParser::m_parsed
NamedList m_parsed
Definition yatexml.h:530
TelEngine::XmlSaxParser::m_offset
unsigned int m_offset
Definition yatexml.h:504
TelEngine::XmlSaxParser::parseDoctype
bool parseDoctype()
TelEngine::XmlSaxParser::checkNameCharacter
static bool checkNameCharacter(unsigned char ch)
Definition yatexml.h:237
TelEngine::XmlSaxParser::row
unsigned int row() const
Definition yatexml.h:117
TelEngine::XmlSaxParser::XmlSaxParser
XmlSaxParser(const char *name="XmlSaxParser")
TelEngine::XmlSaxParser::badCharacter
bool badCharacter(char c)
Definition yatexml.h:386
TelEngine::XmlSaxParser::checkDataChar
static bool checkDataChar(unsigned char c)
TelEngine::XmlSaxParser::blank
static bool blank(char c)
Definition yatexml.h:210
TelEngine::XmlSaxParser::column
unsigned int column() const
Definition yatexml.h:124
TelEngine::XmlSaxParser::gotDeclaration
virtual void gotDeclaration(const NamedList &decl)
Definition yatexml.h:434
TelEngine::XmlSaxParser::endElement
virtual void endElement(const String &name)
Definition yatexml.h:467
TelEngine::XmlSaxParser::parseComment
bool parseComment()
TelEngine::XmlSaxParser::parse
bool parse(const char *data)
TelEngine::XmlSaxParser::reset
virtual void reset()
TelEngine::XmlSaxParser::parseDeclaration
bool parseDeclaration()
TelEngine::XmlSaxParser::parseInstruction
bool parseInstruction()
TelEngine::XmlSaxParser::gotDoctype
virtual void gotDoctype(const String &doc)
Definition yatexml.h:475
TelEngine::XmlSaxParser::gotElement
virtual void gotElement(const NamedList &element, bool empty)
Definition yatexml.h:459
TelEngine::XmlSaxParser::setUnparsed
void setUnparsed(Type id)
Definition yatexml.h:182
TelEngine::XmlSaxParser::validTag
static bool validTag(const String &buf)
TelEngine::XmlSaxParser::gotProcessing
virtual void gotProcessing(const NamedString &instr)
Definition yatexml.h:426
TelEngine::XmlSaxParser::s_errorString
static const TokenDict s_errorString[]
Definition yatexml.h:290
TelEngine::XmlSaxParser::m_buf
String m_buf
Definition yatexml.h:524
TelEngine::XmlSaxParser::~XmlSaxParser
virtual ~XmlSaxParser()
TelEngine::XmlSaxParser::parseEndTag
bool parseEndTag()
TelEngine::XmlSaxParser::buffer
const String & buffer() const
Definition yatexml.h:131
TelEngine::XmlSaxParser::getAttribute
NamedString * getAttribute()
TelEngine::XmlSaxParser::gotComment
virtual void gotComment(const String &text)
Definition yatexml.h:418
TelEngine::XmlSaxParser::unEscape
void unEscape(String &text)
TelEngine::XmlSaxParser::gotCdata
virtual void gotCdata(const String &data)
Definition yatexml.h:450
TelEngine::XmlSaxParser::parseCData
bool parseCData()
TelEngine::XmlSaxParser::processText
bool processText(String &text)
TelEngine::XmlSaxParser::setError
bool setError(Error error, XmlChild *child=0)
TelEngine::XmlSaxParser::parseElement
bool parseElement()
TelEngine::XmlSaxParser::getError
const char * getError(const char *defVal="Xml error")
Definition yatexml.h:169
TelEngine::XmlSaxParser::m_error
Error m_error
Definition yatexml.h:519
TelEngine::XmlSaxParser::error
Error error()
Definition yatexml.h:153
TelEngine::XmlSaxParser::getBuffer
const String & getBuffer() const
Definition yatexml.h:193
TelEngine::XmlSaxParser::auxParse
bool auxParse()
TelEngine::XmlSaxParser::m_column
unsigned int m_column
Definition yatexml.h:514
TelEngine::XmlSaxParser::completeText
bool completeText()
TelEngine::XmlSaxParser::resetParsed
void resetParsed()
Definition yatexml.h:398
TelEngine::XmlSaxParser::escape
static String & escape(String &buf, const String &text)
TelEngine::XmlText
Xml Declaration.
Definition yatexml.h:1880
TelEngine::XmlText::setText
void setText(const void *buf, unsigned int len)
Definition yatexml.h:1925
TelEngine::XmlText::XmlText
XmlText(const char *text)
TelEngine::XmlText::replaceParams
virtual void replaceParams(const NamedList &params)
TelEngine::XmlText::setText
void setText(const char *text)
Definition yatexml.h:1917
TelEngine::XmlText::~XmlText
virtual ~XmlText()
TelEngine::XmlText::toString
void toString(String &dump, bool escape=true, const String &indent=String::empty(), const String *auth=0, const XmlElement *parent=0) const
TelEngine::XmlText::XmlText
XmlText(const void *buf, unsigned int len)
TelEngine::XmlText::onlySpaces
bool onlySpaces()
TelEngine::XmlText::getText
const String & getText() const
Definition yatexml.h:1910
TelEngine::XmlText::XmlText
XmlText(const XmlText &orig)
TelEngine::XmlText::xmlText
virtual XmlText * xmlText()
Definition yatexml.h:1945
TelEngine
Definition yatemime.h:34
TelEngine::XmlEscape
Definition yatexml.h:50
TelEngine::XmlEscape::value
const char * value
Definition yatexml.h:54
TelEngine::XmlEscape::replace
char replace
Definition yatexml.h:59
TokenDict
Definition yateclass.h:891