SUMMARY:  INNER | FIELD | CONSTR | METHOD | FRIEND DETAIL:  FIELD | CONSTR | METHOD | FRIEND


Platform::Text::Xml
Class Element

NonCopyableType
   |
   +-Element

Implemented in:
Platform.Text.Xml.h

class Element:
private NonCopyableType

Represents an XML element.

Inner Compounds, Typedefs, and Enumscollapse
struct ContentData
          Represents a content data fragment which is the smallest piece of information contained within an XML Element.
typedef Attributes
          Represents the type of XML element attributes.
typedef Collection
          Represents the type of a collection of XML elements.
typedef Content
          Represents the type of XML element content.
enum ContentType
          Specifies the content type of a content data fragment.

Field Summarycollapse
Attributes attributes
          The attributes associated with this element.
Content content
          The content of this element.
String name
          The name of this element.
Element* parent
          The parent element.

Constructor Summarycollapse
Element(const String& xml, Int fromIndex = 0)
          Creates an XML element by parsing the contents of the specified string.
~Element()
          Destroys an XML element.

Method Summarycollapse
String cdata() const
          Returns a string containing concatenated CDATA sections of this element.
Collection children() const
          Returns a collection of pointers to the children elements of this element.
UInt deepSize() const
          Computes the total size, in bytes, occupied by this XML element and all of its sub-elements.
Int depth() const
          Returns the distanse to the root element.
String path(Char pathSeparator = appText('/')) const
          Returns the path to the root element.
Void reformat(Int flags, Bool recurse = True)
          Re-formats the XML element by applying the specified re-format options.
Collection& selectInto(Collection& buffer, const String& path, Int fromIndex = 0) const
          Searches the XML hierarchy for elements that fulfill a given criteria.
String text() const
          Returns a string containing concatenated text sections of this element.
String toString(Bool prettyPrint = False) const
          Returns a string representation of the XML element.
template <typename Action>
Void
traverse(Action& action)
          Recursively traverses the XML hierarchy performing the specified action on each element.

 

Field Detail

attributes

Attributes attributes

The attributes associated with this element.


content

Content content

The content of this element.


name

String name

The name of this element.


parent

Element* parent

The parent element.

 

Constructor Detail

Element[inline]

Element(const String& xml, Int fromIndex = 0)

Creates an XML element by parsing the contents of the specified string.

Parameters:
xml - a string containing XML text
fromIndex - starting index within the string
Throws:
ParseError - if the specified string does not contain valid XML

~Element[inline]

~Element()

Destroys an XML element.

 

Method Detail

cdata[inline]

String cdata() const

Returns a string containing concatenated CDATA sections of this element.

Returns:
a string containing concatenated CDATA sections of this element

children[inline]

Collection children() const

Returns a collection of pointers to the children elements of this element. If this element does not have any children elements the result is an empty collection.

Returns:
a collection of element pointers

deepSize[inline]

UInt deepSize() const

Computes the total size, in bytes, occupied by this XML element and all of its sub-elements.

Returns:
the total size, in bytes, occupied by this XML element and all of its sub-elements

depth[inline]

Int depth() const

Returns the distanse to the root element.

Returns:
the distanse to the root element

path[inline]

String path(Char pathSeparator = appText('/')) const

Returns the path to the root element.

Returns:
the path to the root element

reformat

Void reformat(Int flags, Bool recurse = True)

Re-formats the XML element by applying the specified re-format options.

Parameters:
flags - re-format options
recurse - specifies whether to re-format the element recursively
See Also:
ReformatFlags

selectInto

Collection& selectInto(Collection& buffer, const String& path, Int fromIndex = 0) const

Searches the XML hierarchy for elements that fulfill a given criteria.

Parameters:
buffer - the receiving buffer
path - the search path and criteria rules
fromIndex - starting index within the path
Returns:
a reference to the buffer updated with the elements that fulfill the given criteria

text[inline]

String text() const

Returns a string containing concatenated text sections of this element.

Returns:
a string containing concatenated text sections of this element

toString

String toString(Bool prettyPrint = False) const

Returns a string representation of the XML element.

Parameters:
prettyPrint - specifies whether to apply internal formatting e.g. based on the depth of the elements within the XML hierarchy; expects the element to be re-formatted
Returns:
a string containing textual representation of the XML element

traverse[inline]

template <typename Action>
Void traverse(Action& action)

Recursively traverses the XML hierarchy performing the specified action on each element.

Parameters:
action - a function or a functor object executed on each traversed element


SUMMARY:  INNER | FIELD | CONSTR | METHOD | FRIEND DETAIL:  FIELD | CONSTR | METHOD | FRIEND