Yate
XmlFragment Class Reference

Xml Fragment. More...

#include <yatexml.h>

Inheritance diagram for XmlFragment:
XmlParent

Public Member Functions

 XmlFragment ()
 
 XmlFragment (const XmlFragment &orig)
 
virtual ~XmlFragment ()
 
virtual XmlFragmentfragment ()
 
virtual const ObjListgetChildren () const
 
virtual XmlSaxParser::Error addChild (XmlChild *child)
 
virtual void reset ()
 
XmlChildpop ()
 
XmlElementpopElement ()
 
virtual XmlChildremoveChild (XmlChild *child, bool delObj=true)
 
virtual void clearChildren ()
 
void copy (const XmlFragment &other, XmlParent *parent=0)
 
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
 
void replaceParams (const NamedList &params)
 
- Public Member Functions inherited from XmlParent
 XmlParent ()
 
virtual ~XmlParent ()
 
virtual XmlDocumentdocument ()
 
virtual XmlElementelement ()
 
XmlChildaddChildSafe (XmlChild *child, XmlSaxParser::Error *code=0)
 
bool hasChildren () const
 

Static Public Member Functions

static XmlElementfindElement (ObjList *list, const String *name, const String *ns, bool noPrefix=true)
 
static XmlElementgetElement (ObjList *&lst, const String *name=0, const String *ns=0, bool noPrefix=true)
 
static XmlTextfindText (ObjList *lst)
 
static XmlTextgetText (ObjList *&lst)
 

Detailed Description

Xml Fragment.

Xml Fragment a fragment from a Xml document

Constructor & Destructor Documentation

◆ XmlFragment() [1/2]

Constructor

◆ XmlFragment() [2/2]

XmlFragment ( const XmlFragment & orig)

Copy constructor

Parameters
origOriginal XmlFragment

◆ ~XmlFragment()

virtual ~XmlFragment ( )
virtual

Destructor

Member Function Documentation

◆ addChild()

virtual XmlSaxParser::Error addChild ( XmlChild * child)
virtual

Append a new xml child to this fragment

Parameters
childthe child to append
Returns
An error code if an error was detected

Implements XmlParent.

◆ clearChildren()

virtual void clearChildren ( )
inlinevirtual

Clear the list of children

Reimplemented from XmlParent.

References ObjList::clear().

Referenced by XmlElement::clearChildren().

◆ copy()

void copy ( const XmlFragment & other,
XmlParent * parent = 0 )

Copy other fragment into this one

Parameters
otherFragment to copy
parentOptional parent to set in copied children

◆ findElement()

static XmlElement * findElement ( ObjList * list,
const String * name,
const String * ns,
bool noPrefix = true )
inlinestatic

Find a completed xml element in a list

Parameters
listThe list to search for the element
nameOptional element tag to match
nsOptional element namespace to match
noPrefixTrue to compare the tag without namespace prefix, false to include namespace prefix when comparing the given tag. This parameter is ignored if name is 0 or ns is not 0
Returns
XmlElement pointer or 0 if not found

References XmlFragment::getElement().

Referenced by XmlElement::findFirstChild(), XmlElement::findFirstChild(), and XmlElement::findNextChild().

◆ findText()

static XmlText * findText ( ObjList * lst)
inlinestatic

Retrieve first XML text from given list

Parameters
lstList of XmlChild
Returns
XmlText pointer, NULL if not found

References XmlFragment::getText().

◆ fragment()

virtual XmlFragment * fragment ( )
inlinevirtual

Get an Xml Fragment

Returns
This

Reimplemented from XmlParent.

◆ getChildren()

virtual const ObjList & getChildren ( ) const
inlinevirtual

Get the list of children

Returns
The children list

Reimplemented from XmlParent.

Referenced by XmlElement::getChildren().

◆ getElement()

static XmlElement * getElement ( ObjList *& lst,
const String * name = 0,
const String * ns = 0,
bool noPrefix = true )
static

Retrieve first XML element from given list. Advance the list when found

Parameters
lstList of XmlChild
nameOptional element tag to match
nsOptional element namespace to match
noPrefixTrue to compare the tag without namespace prefix, false to include namespace prefix when comparing the given tag. This parameter is ignored if name is 0 or ns is not 0
Returns
XmlElement pointer, NULL if not found

Referenced by XmlFragment::findElement().

◆ getText()

static XmlText * getText ( ObjList *& lst)
inlinestatic

Retrieve first XML text from given list. Advance the list when found

Parameters
lstList of XmlChild
Returns
XmlText pointer, NULL if not found

References ObjList::get(), ObjList::skipNext(), and XmlText::xmlText().

Referenced by XmlFragment::findText().

◆ pop()

XmlChild * pop ( )
inline

Remove the first child from list and returns it

Returns
XmlChild pointer or 0

References ObjList::remove().

◆ popElement()

XmlElement * popElement ( )

Remove the first XmlElement from list and returns it if completed

Returns
XmlElement pointer or 0 if no XmlElement is found or the first one is not completed

◆ removeChild()

virtual XmlChild * removeChild ( XmlChild * child,
bool delObj = true )
virtual

Remove a child. Reset the parent of not deleted xml element

Parameters
childThe child to remove
delObjTrue to delete the object
Returns
XmlChild pointer if found and not deleted

Implements XmlParent.

Referenced by XmlElement::pop(), and XmlDocument::removeChild().

◆ replaceParams()

void replaceParams ( const NamedList & params)

Replaces all ${paramname} in fragment's children with the corresponding parameters

Parameters
paramsList of parameters

◆ reset()

virtual void reset ( )
virtual

Reset this Xml Fragment

Reimplemented from XmlParent.

◆ 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

Build a String from this XmlFragment

Parameters
dumpThe string where to append representation
escapeTrue if the attributes values need to be escaped
indentSpaces for output
origIndentOriginal indent
completeOnlyTrue to build only if complete
authOptional list of tag and attribute names to be replaced with '***'. This parameter can be used when the result will be printed to output to avoid printing authentication data to output. The array must end with an empty string
parentOptional parent element whose tag will be searched in the auth list

The documentation for this class was generated from the following file: