PTLib  Version 2.10.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pxml.h
Go to the documentation of this file.
1 /*
2  * pxml.h
3  *
4  * XML parser support
5  *
6  * Portable Windows Library
7  *
8  * Copyright (c) 2002 Equivalence Pty. Ltd.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Portable Windows Library.
21  *
22  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23  *
24  * Contributor(s): ______________________________________.
25  *
26  * $Revision: 28994 $
27  * $Author: rjongbloed $
28  * $Date: 2013-01-25 02:06:35 -0600 (Fri, 25 Jan 2013) $
29  */
30 
31 #ifndef PTLIB_PXML_H
32 #define PTLIB_PXML_H
33 
34 #ifdef P_USE_PRAGMA
35 #pragma interface
36 #endif
37 
38 #include <ptlib.h>
39 
40 #include <ptbuildopts.h>
41 
42 #ifndef P_EXPAT
43 
44 namespace PXML {
45 extern PString EscapeSpecialChars(const PString & str);
46 };
47 
48 #else
49 
50 #include <ptclib/http.h>
51 
53 
54 class PXMLElement;
55 class PXMLData;
56 
57 
58 class PXMLObject;
59 class PXMLElement;
60 class PXMLData;
61 
63 
64 class PXMLBase : public PObject
65 {
66  public:
67  enum {
69  };
70 
71  enum Options {
72  NoOptions = 0x0000,
73  Indent = 0x0001,
75  NoIgnoreWhiteSpace = 0x0004,
76  CloseExtended = 0x0008,
77  WithNS = 0x0010,
78  FragmentOnly = 0x0020,
79  AllOptions = 0xffff
80  };
81  __inline friend Options operator|(Options o1, Options o2) { return (Options)(((unsigned)o1) | ((unsigned)o2)); }
82  __inline friend Options operator&(Options o1, Options o2) { return (Options)(((unsigned)o1) & ((unsigned)o2)); }
83 
89  };
90 
91  PXMLBase(int opts = NoOptions);
92 
93  void SetOptions(int opts)
94  { m_options = opts; }
95 
96  int GetOptions() const { return m_options; }
97 
99  const PString & /*elementName*/
100  ) const
101  {
102  return false;
103  }
104 
105  void SetMaxEntityLength(unsigned len) { m_maxEntityLength = len; }
106  unsigned GetMaxEntityLength() const { return m_maxEntityLength; }
107 
108  protected:
111 };
112 
113 
114 class PXML : public PXMLBase
115 {
116  PCLASSINFO(PXML, PObject);
117  public:
118  PXML(
119  int options = NoOptions,
120  const char * noIndentElements = NULL
121  );
122  PXML(
123  const PString & data,
124  int options = NoOptions,
125  const char * noIndentElements = NULL
126  );
127 
128  PXML(const PXML & xml);
129 
130  ~PXML();
131 
132  bool IsLoaded() const { return rootElement != NULL; }
133  bool IsDirty() const;
134 
135  bool Load(const PString & data, Options options = NoOptions);
136  bool LoadFile(const PFilePath & fn, Options options = NoOptions);
137 
138  virtual void OnLoaded() { }
139 
140  bool Save(Options options = NoOptions);
141  bool Save(PString & data, Options options = NoOptions);
142  bool SaveFile(const PFilePath & fn, Options options = NoOptions);
143 
144  void RemoveAll();
145 
147  const PString & elementName
148  ) const;
149 
150  PString AsString() const;
151  void PrintOn(ostream & strm) const;
152  void ReadFrom(istream & strm);
153 
154 
155  PXMLElement * GetElement(const PCaselessString & name, const PCaselessString & attr, const PString & attrval) const;
156  PXMLElement * GetElement(const PCaselessString & name, PINDEX idx = 0) const;
157  PXMLElement * GetElement(PINDEX idx) const;
158  PINDEX GetNumElements() const;
159  PXMLElement * GetRootElement() const { return rootElement; }
161  PXMLElement * SetRootElement(const PString & documentType);
162  bool RemoveElement(PINDEX idx);
163 
165 
166 
186 
191  };
192 
196  };
197 
198  struct ValidationInfo {
200  const char * m_name;
201 
202  union {
203  const void * m_placeHolder;
204  const char * m_attributeValues;
206  const char * m_namespace;
207  };
208 
209  PINDEX m_minCount;
210  PINDEX m_maxCount;
211  };
212 
213  bool Validate(const ValidationInfo * validator);
214  bool ValidateElements(ValidationContext & context, PXMLElement * baseElement, const ValidationInfo * elements);
215  bool ValidateElement(ValidationContext & context, PXMLElement * element, const ValidationInfo * elements);
216  bool LoadAndValidate(const PString & body, const PXML::ValidationInfo * validator, PString & error, int options = NoOptions);
217 
219  unsigned GetErrorColumn() const { return m_errorColumn; }
220  unsigned GetErrorLine() const { return m_errorLine; }
221 
222  PString GetDocType() const { return docType; }
223  void SetDocType(const PString & v) { docType = v; }
224 
225  PMutex & GetMutex() { return rootMutex; }
226 
227  // static methods to create XML tags
228  static PString CreateStartTag (const PString & text);
229  static PString CreateEndTag (const PString & text);
230  static PString CreateTagNoData (const PString & text);
231  static PString CreateTag (const PString & text, const PString & data);
232 
233  static PString EscapeSpecialChars(const PString & string);
234 
235  protected:
236  void Construct(int options, const char * noIndentElements);
239 
244 
246  unsigned m_errorLine;
247  unsigned m_errorColumn;
248 
250 
253 };
254 
255 
256 #if P_HTTP
257 class PXML_HTTP : public PXML
258 {
259  PCLASSINFO(PXML_HTTP, PXML);
260  public:
261  PXML_HTTP(
262  int options = NoOptions,
263  const char * noIndentElements = NULL
264  );
265 
266  bool StartAutoReloadURL(
267  const PURL & url,
268  const PTimeInterval & timeout,
269  const PTimeInterval & refreshTime,
270  Options options = NoOptions
271  );
272  bool StopAutoReloadURL();
274  bool AutoLoadURL();
275  virtual void OnAutoLoad(PBoolean ok);
276 
277  bool LoadURL(const PURL & url);
278  bool LoadURL(const PURL & url, const PTimeInterval & timeout, Options options = NoOptions);
279 
280  protected:
281  PDECLARE_NOTIFIER(PTimer, PXML_HTTP, AutoReloadTimeout);
282  PDECLARE_NOTIFIER(PThread, PXML_HTTP, AutoReloadThread);
283 
289 };
290 #endif // P_HTTP
291 
293 
294 PARRAY(PXMLObjectArray, PXMLObject);
295 
296 class PXMLObject : public PObject {
297  PCLASSINFO(PXMLObject, PObject);
298  public:
300  : parent(par) { dirty = false; }
301 
303  { return parent; }
304 
305  PXMLObject * GetNextObject() const;
306 
307  void SetParent(PXMLElement * newParent)
308  {
309  PAssert(parent == NULL, "Cannot reparent PXMLElement");
310  parent = newParent;
311  }
312 
313  PString AsString() const;
314 
315  virtual void Output(ostream & strm, const PXMLBase & xml, int indent) const = 0;
316 
317  virtual PBoolean IsElement() const = 0;
318 
319  void SetDirty();
320  bool IsDirty() const { return dirty; }
321 
322  virtual PXMLObject * Clone(PXMLElement * parent) const = 0;
323 
324  protected:
326  bool dirty;
327 };
328 
330 
331 class PXMLData : public PXMLObject {
332  PCLASSINFO(PXMLData, PXMLObject);
333  public:
334  PXMLData(PXMLElement * parent, const PString & data);
335  PXMLData(PXMLElement * parent, const char * data, int len);
336 
337  PBoolean IsElement() const { return false; }
338 
339  void SetString(const PString & str, bool dirty = true);
340 
341  PString GetString() const { return value; }
342 
343  void Output(ostream & strm, const PXMLBase & xml, int indent) const;
344 
345  PXMLObject * Clone(PXMLElement * parent) const;
346 
347  protected:
349 };
350 
352 
353 class PXMLElement : public PXMLObject {
354  PCLASSINFO(PXMLElement, PXMLObject);
355  public:
356  PXMLElement(PXMLElement * parent, const char * name = NULL);
357  PXMLElement(PXMLElement * parent, const PString & name, const PString & data);
358 
359  PBoolean IsElement() const { return true; }
360 
361  void PrintOn(ostream & strm) const;
362  void Output(ostream & strm, const PXMLBase & xml, int indent) const;
363 
365  { return name; }
366 
372 
373  void SetName(const PString & v)
374  { name = v; }
375 
376  PINDEX GetSize() const
377  { return subObjects.GetSize(); }
378 
379  PXMLObject * AddSubObject(PXMLObject * elem, bool dirty = true);
380 
381  PXMLElement * AddChild (PXMLElement * elem, bool dirty = true);
382  PXMLData * AddChild (PXMLData * elem, bool dirty = true);
383 
384  PXMLElement * AddElement(const char * name);
385  PXMLElement * AddElement(const PString & name, const PString & data);
386  PXMLElement * AddElement(const PString & name, const PString & attrName, const PString & attrVal);
387 
388  void SetAttribute(const PCaselessString & key,
389  const PString & value,
390  bool setDirty = true);
391 
392  PString GetAttribute(const PCaselessString & key) const;
393  PString GetKeyAttribute(PINDEX idx) const;
394  PString GetDataAttribute(PINDEX idx) const;
395  bool HasAttribute(const PCaselessString & key) const;
396  bool HasAttributes() const { return attributes.GetSize() > 0; }
397  PINDEX GetNumAttributes() const { return attributes.GetSize(); }
398 
399  PXMLElement * GetElement(const PCaselessString & name, const PCaselessString & attr, const PString & attrval) const;
400  PXMLElement * GetElement(const PCaselessString & name, PINDEX idx = 0) const;
401  PXMLObject * GetElement(PINDEX idx = 0) const;
402  bool RemoveElement(PINDEX idx);
403 
404  PINDEX FindObject(const PXMLObject * ptr) const;
405 
406  bool HasSubObjects() const
407  { return subObjects.GetSize() != 0; }
408 
409  PXMLObjectArray GetSubObjects() const
410  { return subObjects; }
411 
412  PXMLObject * GetSubObject(PINDEX idx = 0) const
413  { return GetElement(idx); }
414 
415  PString GetData() const;
416  void SetData(const PString & data);
417  void AddData(const PString & data);
418 
419  PXMLObject * Clone(PXMLElement * parent) const;
420 
421  void GetFilePosition(unsigned & col, unsigned & line) const { col = column; line = lineNumber; }
422  void SetFilePosition(unsigned col, unsigned line) { column = col; lineNumber = line; }
423 
424  void AddNamespace(const PString & prefix, const PString & uri);
425  void RemoveNamespace(const PString & prefix);
426 
427  bool GetDefaultNamespace(PCaselessString & str) const;
428  bool GetNamespace(const PCaselessString & prefix, PCaselessString & str) const;
430  bool GetURIForNamespace(const PCaselessString & prefix, PCaselessString & uri);
431 
432  protected:
435  PXMLObjectArray subObjects;
436  bool dirty;
437  unsigned column;
438  unsigned lineNumber;
441 };
442 
444 
445 class PConfig; // stupid gcc 4 does not recognize PConfig as a class
446 
447 class PXMLSettings : public PXML
448 {
449  PCLASSINFO(PXMLSettings, PXML);
450  public:
452  PXMLSettings(const PString & data, Options options = NewLineAfterElement);
453  PXMLSettings(const PConfig & data, Options options = NewLineAfterElement);
454 
455  bool Load(const PString & data);
456  bool LoadFile(const PFilePath & fn);
457 
458  bool Save();
459  bool Save(PString & data);
460  bool SaveFile(const PFilePath & fn);
461 
462  void SetAttribute(const PCaselessString & section, const PString & key, const PString & value);
463 
464  PString GetAttribute(const PCaselessString & section, const PString & key) const;
465  bool HasAttribute(const PCaselessString & section, const PString & key) const;
466 
467  void ToConfig(PConfig & cfg) const;
468 };
469 
470 
472 
473 class PXMLParser : public PXMLBase
474 {
475  PCLASSINFO(PXMLParser, PXMLBase);
476  public:
477  PXMLParser(int options = NoOptions);
478  ~PXMLParser();
479  bool Parse(const char * data, int dataLen, bool final);
480  void GetErrorInfo(PString & errorString, unsigned & errorCol, unsigned & errorLine);
481 
482  virtual void StartElement(const char * name, const char **attrs);
483  virtual void EndElement(const char * name);
484  virtual void AddCharacterData(const char * data, int len);
485  virtual void XmlDecl(const char * version, const char * encoding, int standAlone);
486  virtual void StartDocTypeDecl(const char * docTypeName,
487  const char * sysid,
488  const char * pubid,
489  int hasInternalSubSet);
490  virtual void EndDocTypeDecl();
491  virtual void StartNamespaceDeclHandler(const char * prefix, const char * uri);
492  virtual void EndNamespaceDeclHandler(const char * prefix);
493 
494  PString GetVersion() const { return version; }
495  PString GetEncoding() const { return encoding; }
496 
498 
499  PXMLElement * GetXMLTree() const;
500  PXMLElement * SetXMLTree(PXMLElement * newRoot);
501 
502  protected:
503  void * expat;
505  bool rootOpen;
511 };
512 
514 
516 {
517  PCLASSINFO(PXMLStreamParser, PXMLParser);
518  public:
520 
521  virtual void EndElement(const char * name);
522  virtual PXML * Read(PChannel * channel);
523 
524  protected:
526 };
527 
528 
529 #endif // P_EXPAT
530 
531 #endif // PTLIB_PXML_H
532 
533 
534 // End Of File ///////////////////////////////////////////////////////////////
PString AsString() const
PXMLParser(int options=NoOptions)
PString GetData() const
This class waits for the semaphore on construction and automatically signals the semaphore on destruc...
Definition: psync.h:86
PCaselessString GetDocumentType() const
PXMLElement * AddChild(PXMLElement *elem, bool dirty=true)
PXMLObjectArray subObjects
Definition: pxml.h:435
void SetOptions(int opts)
Definition: pxml.h:93
Definition: pxml.h:184
unsigned m_maxEntityLength
Definition: pxml.h:110
Definition: pxml.h:175
PString GetVersion() const
Definition: pxml.h:494
PString m_defaultNameSpace
Definition: pxml.h:252
PString GetDocType() const
Definition: pxml.h:222
Definition: pxml.h:180
unsigned m_errorLine
Definition: pxml.h:246
PCaselessString PrependNamespace(const PCaselessString &name) const
This class defines an arbitrary time interval to millisecond accuracy.
Definition: timeint.h:55
PXMLElement * currentElement
Definition: pxml.h:506
void SetData(const PString &data)
Definition: pxml.h:515
Definition: pxml.h:64
Definition: pxml.h:77
PINDEX GetNumAttributes() const
Definition: pxml.h:397
PString encoding
Definition: pxml.h:508
unsigned GetErrorColumn() const
Definition: pxml.h:219
PXMLBase(int opts=NoOptions)
PXMLObject * GetNextObject() const
void Output(ostream &strm, const PXMLBase &xml, int indent) const
bool loadFromFile
Definition: pxml.h:240
unsigned GetErrorLine() const
Definition: pxml.h:220
ValidationOp m_op
Definition: pxml.h:199
Definition: pxml.h:185
PString GetDataAttribute(PINDEX idx) const
void SetAttribute(const PCaselessString &key, const PString &value, bool setDirty=true)
bool LoadFile(const PFilePath &fn, Options options=NoOptions)
PString value
Definition: pxml.h:348
bool HasAttributes() const
Definition: pxml.h:396
Definition: pxml.h:169
PINDEX m_maxCount
Definition: pxml.h:210
__inline friend Options operator|(Options o1, Options o2)
Definition: pxml.h:81
void SetAttribute(const PCaselessString &section, const PString &key, const PString &value)
virtual void Output(ostream &strm, const PXMLBase &xml, int indent) const =0
Definition: pxml.h:331
A class representing a configuration for the application.
Definition: config.h:67
ValidationOp
Definition: pxml.h:167
bool Load(const PString &data, Options options=NoOptions)
This class is a standard C++ stream class descendent for reading or writing streamed data to or from ...
Definition: pstring.h:1878
static PString CreateTagNoData(const PString &text)
PString AsString() const
PINDEX m_minCount
Definition: pxml.h:209
This is a dictionary collection class of PString objects, keyed by another string.
Definition: pstring.h:2784
This class describes a full description for a file on the particular platform.
Definition: filepath.h:65
bool SaveFile(const PFilePath &fn, Options options=NoOptions)
PQueue< PXML > messages
Definition: pxml.h:525
void SetFilePosition(unsigned col, unsigned line)
Definition: pxml.h:422
This class is a variation of a string that ignores case.
Definition: pstring.h:1708
Definition: pxml.h:193
__inline friend Options operator&(Options o1, Options o2)
Definition: pxml.h:82
Definition: pxml.h:473
PXMLElement * AddElement(const char *name)
PXMLObject(PXMLElement *par)
Definition: pxml.h:299
PBoolean IsNoIndentElement(const PString &elementName) const
unsigned lineNumber
Definition: pxml.h:438
void GetFilePosition(unsigned &col, unsigned &line) const
Definition: pxml.h:421
Definition: pxml.h:181
ignored
Definition: pxml.h:76
bool Validate(const ValidationInfo *validator)
bool GetURIForNamespace(const PCaselessString &prefix, PCaselessString &uri)
PXML(int options=NoOptions, const char *noIndentElements=NULL)
PCaselessString GetName() const
Definition: pxml.h:364
const char * m_attributeValues
Definition: pxml.h:204
PString GetEncoding() const
Definition: pxml.h:495
PXMLElement(PXMLElement *parent, const char *name=NULL)
Definition: pxml.h:198
ValidationInfo * m_subElement
Definition: pxml.h:205
StandAloneType m_standAlone
Definition: pxml.h:243
virtual void StartDocTypeDecl(const char *docTypeName, const char *sysid, const char *pubid, int hasInternalSubSet)
PTimeInterval autoLoadWaitTime
Definition: pxml.h:286
PMutex & GetMutex()
Definition: pxml.h:225
PXMLElement * GetElement(const PCaselessString &name, const PCaselessString &attr, const PString &attrval) const
PXMLElement * GetRootElement() const
Definition: pxml.h:159
bool StartAutoReloadURL(const PURL &url, const PTimeInterval &timeout, const PTimeInterval &refreshTime, Options options=NoOptions)
PXMLObject * GetSubObject(PINDEX idx=0) const
Definition: pxml.h:412
virtual void XmlDecl(const char *version, const char *encoding, int standAlone)
bool IsDirty() const
Definition: pxml.h:320
PINDEX GetSize() const
Definition: pxml.h:376
Definition: pxml.h:114
PXMLElement * GetXMLTree() const
bool HasSubObjects() const
Definition: pxml.h:406
bool Save(Options options=NoOptions)
Definition: pxml.h:172
A class representing a system timer.
Definition: timer.h:181
BOOL PBoolean
Definition: object.h:102
PXML_HTTP(int options=NoOptions, const char *noIndentElements=NULL)
PINDEX FindObject(const PXMLObject *ptr) const
const char * m_name
Definition: pxml.h:200
ignored
Definition: pxml.h:75
void GetErrorInfo(PString &errorString, unsigned &errorCol, unsigned &errorLine)
PXMLElement * SetRootElement(PXMLElement *p)
PString GetAttribute(const PCaselessString &key) const
Definition: pxml.h:87
virtual void StartNamespaceDeclHandler(const char *prefix, const char *uri)
bool GetDefaultNamespace(PCaselessString &str) const
static PString EscapeSpecialChars(const PString &string)
PString GetAutoReloadStatus()
Definition: pxml.h:273
Definition: pxml.h:447
bool IsDirty() const
PStringToString m_nameSpaces
Definition: pxml.h:195
This is a sorted list collection class of PString objects.
Definition: pstring.h:2296
PString version
Definition: pxml.h:242
PXMLSettings(Options options=NewLineAfterElement)
Definition: pxml.h:168
void RemoveAll()
bool LoadFile(const PFilePath &fn)
StandAloneType m_standAlone
Definition: pxml.h:509
bool RemoveElement(PINDEX idx)
PString GetString() const
Definition: pxml.h:341
void ReadFrom(istream &strm)
Input the contents of the object from the stream.
Abstract class defining I/O channel semantics.
Definition: channel.h:107
virtual PBoolean IsNoIndentElement(const PString &) const
Definition: pxml.h:98
PXMLElement * GetElement(const PCaselessString &name, const PCaselessString &attr, const PString &attrval) const
bool AutoLoadURL()
unsigned GetMaxEntityLength() const
Definition: pxml.h:106
bool LoadAndValidate(const PString &body, const PXML::ValidationInfo *validator, PString &error, int options=NoOptions)
int GetOptions() const
Definition: pxml.h:96
PXMLObject * AddSubObject(PXMLObject *elem, bool dirty=true)
virtual PINDEX GetSize() const
Get the current size of the container.
Definition: pxml.h:170
int m_options
Definition: pxml.h:109
bool LoadURL(const PURL &url)
void RemoveNamespace(const PString &prefix)
void SetParent(PXMLElement *newParent)
Definition: pxml.h:307
Definition: pxml.h:74
static PString CreateEndTag(const PString &text)
bool HasAttribute(const PCaselessString &section, const PString &key) const
void AddNamespace(const PString &prefix, const PString &uri)
PCaselessString GetPathName() const
Get the completely qualified name for the element inside the XML tree, for example "root:trunk:branch...
PString GetErrorString() const
Definition: pxml.h:218
static PString CreateStartTag(const PString &text)
PString autoLoadError
Definition: pxml.h:288
Definition: pxml.h:178
PXMLElement * GetParent() const
Definition: pxml.h:302
PMutex autoLoadMutex
Definition: pxml.h:287
The character string class.
Definition: pstring.h:108
PINDEX GetNumElements() const
virtual void AddCharacterData(const char *data, int len)
void SetName(const PString &v)
Definition: pxml.h:373
void SetDirty()
Definition: pxml.h:353
void * expat
Definition: pxml.h:503
PStringToString m_tempNamespaceList
Definition: pxml.h:510
PDECLARE_NOTIFIER(PTimer, PXML_HTTP, AutoReloadTimeout)
virtual void StartElement(const char *name, const char **attrs)
const void * m_placeHolder
Definition: pxml.h:203
void Construct(int options, const char *noIndentElements)
PString encoding
Definition: pxml.h:242
virtual void OnAutoLoad(PBoolean ok)
PString docType
Definition: pxml.h:251
This class defines a thread of execution in the system.
Definition: thread.h:66
bool IsLoaded() const
Definition: pxml.h:132
PXMLElement * rootElement
Definition: pxml.h:237
virtual void OnLoaded()
Definition: pxml.h:138
PXMLElement * SetXMLTree(PXMLElement *newRoot)
void AddData(const PString &data)
PXMLObjectArray GetSubObjects() const
Definition: pxml.h:409
bool HasAttribute(const PCaselessString &key) const
StandAloneType
Definition: pxml.h:84
bool Load(const PString &data)
PString version
Definition: pxml.h:508
Definition: pxml.h:173
Definition: pxml.h:79
virtual PBoolean IsElement() const =0
bool Parse(const char *data, int dataLen, bool final)
PFilePath loadFilename
Definition: pxml.h:241
bool dirty
Definition: pxml.h:436
Definition: pxml.h:72
PURL autoloadURL
Definition: pxml.h:285
PCaselessString m_defaultNamespace
Definition: pxml.h:440
PMutex rootMutex
Definition: pxml.h:238
bool ValidateElement(ValidationContext &context, PXMLElement *element, const ValidationInfo *elements)
PXMLData(PXMLElement *parent, const PString &data)
void Output(ostream &strm, const PXMLBase &xml, int indent) const
Definition: pxml.h:86
static PString CreateTag(const PString &text, const PString &data)
void SetMaxEntityLength(unsigned len)
Definition: pxml.h:105
bool rootOpen
Definition: pxml.h:505
virtual void EndElement(const char *name)
bool dirty
Definition: pxml.h:326
void ToConfig(PConfig &cfg) const
PStringToString attributes
Definition: pxml.h:434
PBoolean IsElement() const
Definition: pxml.h:337
Synonym for PTimedMutex.
#define PAssert(b, msg)
This macro is used to assert that a condition must be true.
Definition: object.h:192
PARRAY(PXMLObjectArray, PXMLObject)
bool StopAutoReloadURL()
virtual PObject * Clone() const
Create a copy of the class on the heap.
Definition: pxml.h:179
void SetDocType(const PString &v)
Definition: pxml.h:223
PString GetAttribute(const PCaselessString &section, const PString &key) const
virtual void EndElement(const char *name)
void SetString(const PString &str, bool dirty=true)
PCaselessString name
Definition: pxml.h:433
Definition: pxml.h:88
Definition: pxml.h:174
virtual void EndDocTypeDecl()
PXMLElement * parent
Definition: pxml.h:325
XML fragment, not complete document.
Definition: pxml.h:78
virtual void EndNamespaceDeclHandler(const char *prefix)
StandAloneType GetStandAlone() const
Definition: pxml.h:497
virtual PXML * Read(PChannel *channel)
Definition: pxml.h:73
Options
Definition: pxml.h:71
PXMLData * lastElement
Definition: pxml.h:507
const char * m_namespace
Definition: pxml.h:206
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
Definition: pxml.h:171
PStringStream m_errorString
Definition: pxml.h:245
bool GetNamespace(const PCaselessString &prefix, PCaselessString &str) const
PSortedStringList noIndentElements
Definition: pxml.h:249
This class describes a Universal Resource Locator.
Definition: url.h:54
void PrintOn(ostream &strm) const
Output the contents of the object to the stream.
bool ValidateElements(ValidationContext &context, PXMLElement *baseElement, const ValidationInfo *elements)
Definition: pxml.h:257
PString m_defaultNameSpace
Definition: pxml.h:194
Definition: pxml.h:296
PXMLElement * rootElement
Definition: pxml.h:504
PStringToString m_nameSpaces
Definition: pxml.h:439
bool SaveFile(const PFilePath &fn)
PTimer autoLoadTimer
Definition: pxml.h:284
PString GetKeyAttribute(PINDEX idx) const
unsigned column
Definition: pxml.h:437
PBoolean IsElement() const
Definition: pxml.h:359
bool RemoveElement(PINDEX idx)
void PrintOn(ostream &strm) const
Output the contents of the object to the stream.
unsigned m_errorColumn
Definition: pxml.h:247