Class XmlElement

Superclasses :
xml::Element
Package :
xml

This class represents an element in an XML document. It has extra attributes and methods to deal with XML namespaces.

For example, given the document

<?xml version="1.0" ?> <top xmlns:nsid="http://an.url.com"> <nsid:inner nsid:attr="val"/> </top>

If n is the XmlElement representing the <top> element, then its global name is GlobalName("top") (ie the same as its local name). The inner XmlElement however, has a global name of

GlobalName("inner", "http://an.url.com"),

and a single attribute with key

GlobalName("attr", "http://an.url.com").

The original parsed name and attribute table are still available via the methods in the superclass Element. For example, get_name() for the inner XmlElement returns "nsid:inner".

Source

Class summary
Methods inherited from xml::Element
get_attribute(key) get_attributes() get_name(s) get_nth_element(n, s) get_type() search_children(s) search_tree(s) set_attribute(key, value) set_name(s)
Variables inherited from xml::Element
attributes name
Methods inherited from xml::Node
add_child(obj, pos) add_string(s, pos) do_trim(s) generate_nodes() get_children() get_children_no_whitespace() get_parent() get_string_content() get_trimmed_children() get_trimmed_string_content() get_type() remove_whitespace_children()
Variables inherited from xml::Node
children parent
Methods inherited from lang::Object
clone(seen) equals(other, seen) get_class() get_class_name() get_id() hash_code(depth, seen) is_instance(name) to_string(depth, seen)
Methods defined in this class
get_attribute_global_name(gn) get_attributes_global_name() get_global_name() get_namespace_declarations() get_whitespace_children() initially() print_structure(f, indent, flags) search_children_global_name(s) search_tree_global_name(s) set_global_name(s) xml_space_preserved()
Variables defined in this class
attributes_global_name global_name namespace_declarations whitespace_children xml_space_preserve

Method detail

get_attribute_global_name(gn)

Return the attribute for this tag, or &null if none specified, based on the given GlobalName.
Parameters :
gn - the GlobalName instance representing the global name
Source

get_attributes_global_name()

Return the global name attributes map for this tag. This will be a table of GlobalName instances to values.
Source

get_global_name()

Get the global name, which will be a GlobalName instance.
Returns :
a GlobalName instance representing the global name.
Source

get_namespace_declarations()

Return the table of namespace declarations for this element. The table will be a map of prefixes to URI's.
Source

get_whitespace_children()

Get whitespace children. During validation, the parser may remove insignificant whitespace from the children list. This method will always give the original list including whitespace. If no whitespace was removed, this list will be identical to the children list.
Source

initially()

Overrides initially() in xml::Node

print_structure(f, indent, flags)

Overrides print_structure(f, indent, flags) in xml::Node
Source

search_children_global_name(s)

Generate the elements under this element, with the given name. If name is omitted, generate all the elements.
Parameters :
s - a GlobalName, being the name of the sub-elements
Source

search_tree_global_name(s)

Search for all the Elements with the given tag name, recursively traversing the entire tree based at this node.
Parameters :
s - a GlobalName, being the name of the sub-elements
Source

set_global_name(s)

Set the global (namespace-aware) name. The global name should be a GlobalName instance.
Parameters :
s - a GlobalName instance representing the global name.
Source

xml_space_preserved()

Succeed iff the parser applied the xml:space="preserve" feature when parsing this element.
Source

Variable detail

attributes_global_name


global_name


namespace_declarations


whitespace_children


xml_space_preserve