Xml Document.  
 More...
#include <yatexml.h>
|  | 
|  | XmlDocument () | 
|  | 
| virtual | ~XmlDocument () | 
|  | 
| virtual XmlDocument * | document () | 
|  | 
| virtual XmlSaxParser::Error | addChild (XmlChild *child) | 
|  | 
| XmlDeclaration * | declaration () const | 
|  | 
| const XmlFragment & | getFragment (bool before) const | 
|  | 
| XmlElement * | root (bool completed=false) const | 
|  | 
| XmlElement * | takeRoot (bool completed=false) | 
|  | 
| virtual void | reset () | 
|  | 
| virtual XmlChild * | removeChild (XmlChild *child, bool delObj=true) | 
|  | 
| virtual XmlSaxParser::Error | read (Stream &in, int *error=0) | 
|  | 
| virtual int | write (Stream &out, bool escape=true, const String &indent=String::empty(), const String &origIndent=String::empty(), bool completeOnly=true) const | 
|  | 
| XmlSaxParser::Error | loadFile (const char *file, int *error=0) | 
|  | 
| int | saveFile (const char *file=0, bool escape=true, const String &indent=String::empty(), bool completeOnly=true, const char *eoln="\r\n") const | 
|  | 
| void | toString (String &dump, bool escape=true, const String &indent=String::empty(), const String &origIndent=String::empty()) const | 
|  | 
| void | replaceParams (const NamedList ¶ms) | 
|  | 
|  | XmlParent () | 
|  | 
| virtual | ~XmlParent () | 
|  | 
| virtual XmlFragment * | fragment () | 
|  | 
| virtual XmlElement * | element () | 
|  | 
| XmlChild * | addChildSafe (XmlChild *child, XmlSaxParser::Error *code=0) | 
|  | 
| virtual const ObjList & | getChildren () const | 
|  | 
| virtual void | clearChildren () | 
|  | 
| bool | hasChildren () const | 
|  | 
Xml Document. 
Xml Document 
◆ XmlDocument()
◆ ~XmlDocument()
◆ addChild()
  
  | 
        
          | virtual XmlSaxParser::Error addChild | ( | XmlChild * | child | ) |  |  | virtual | 
 
Append a new child to this document. Set the root to an XML element if not already set. If we already have a completed root the element will be added to the root, otherwise an error will be returned. If we don't have a root non xml elements (other then text) will be added the list of elements before root 
- Parameters
- 
  
  
- Returns
- An error code if an error was detected 
Implements XmlParent.
 
 
◆ declaration()
Retrieve the document declaration 
- Returns
- XmlDeclaration pointer or 0 if not found 
 
 
◆ document()
Get an Xml Document 
- Returns
- This 
Reimplemented from XmlParent.
 
 
◆ getFragment()
Retrieve XML fragment outside the root element 
- Parameters
- 
  
    | before | True to retrieve the fragment holding children before root element, false to retrieve children after root |  
 
- Returns
- Requested fragment's reference 
 
 
◆ loadFile()
      
        
          | XmlSaxParser::Error loadFile | ( | const char * | file, | 
        
          |  |  | int * | error = 0 ) | 
      
 
Load a file an parse it Reset the document 
- Parameters
- 
  
    | file | The file to load |  | error | Pointer to data to be filled with file error if IOError is returned |  
 
- Returns
- Parser error (NoError on success) 
 
 
◆ read()
  
  | 
        
          | virtual XmlSaxParser::Error read | ( | Stream & | in, |  
          |  |  | int * | error = 0 ) |  | virtual | 
 
Load this document from data stream and parse it. 
- Parameters
- 
  
    | in | The input stream |  | error | Optional pointer to data to be filled with error if IOError is returned |  
 
- Returns
- Parser error (NoError on success) 
 
 
◆ removeChild()
◆ replaceParams()
      
        
          | void replaceParams | ( | const NamedList & | params | ) |  | 
      
 
Replaces all ${paramname} in document's components with the corresponding parameters 
- Parameters
- 
  
  
 
 
◆ reset()
Reset this Xml Document 
Reimplemented from XmlParent.
 
 
◆ root()
Retrieve the root element 
- Parameters
- 
  
    | completed | True to retrieve the root element if is not completed |  
 
- Returns
- Root pointer or 0 if not found or is not completed 
Referenced by XmlDocument::takeRoot().
 
 
◆ saveFile()
      
        
          | int saveFile | ( | const char * | file = 0, | 
        
          |  |  | bool | escape = true, | 
        
          |  |  | const String & | indent = String::empty(), | 
        
          |  |  | bool | completeOnly = true, | 
        
          |  |  | const char * | eoln = "\r\n" ) const | 
      
 
Save this xml document in the specified file. Create a new fle if not found. Truncate an existing one 
- Parameters
- 
  
    | file | The file to save or will be used the file used on load |  | escape | True if the attributes values need to be escaped |  | indent | Spaces for output |  | completeOnly | True to build only if complete |  | eoln | End of line chars. Set it to NULL to ignore it. Empty string will be replaced by CR/LF |  
 
- Returns
- 0 on success, error code on failure 
 
 
◆ takeRoot()
Take the root element from the document 
- Parameters
- 
  
    | completed | True to retrieve the root element if is not completed |  
 
- Returns
- Root pointer or 0 if not found or is not completed 
References XmlDocument::root().
 
 
◆ toString()
Build a String from this XmlDocument 
- Parameters
- 
  
    | dump | The string where to append representation |  | escape | True if the attributes values need to be escaped |  | indent | Spaces for output |  | origIndent | Original indent |  
 
 
 
◆ write()
Write this document to a data stream. A indent + n * origIndent will be added before each xml child, where n is the imbrication level, starting with 0. A indent + (n + 1) * origIndent will be added before each attribute 
- Parameters
- 
  
    | out | The output stream |  | escape | True if the attributes values need to be escaped |  | indent | Line indent |  | origIndent | Original indent |  | completeOnly | True to build only if complete |  
 
- Returns
- Written bytes, negative on error 
 
 
The documentation for this class was generated from the following file: