v2026.6.4
All Bundles
Bundle XML parsing and building library. XmlParser reads XML into an XmlElement tree with attribute and child-node navigation; XmlBuilder constructs XML documents. Compile with -lib xml.

XmlAttribute

Represents an XML attribute

Operations

GetDecodedValue #

Gets the attribute value with XML entity references decoded (< > & " ' and numeric references).

method : public : GetDecodedValue() ~ String

Return

TypeDescription
Stringdecoded attribute value

Example

parser := XmlParser->New("<a title=\"5 &lt; 6\"/>");
if(parser->Parse()) {
  attrib := parser->GetRoot()->GetAttribute("title");
  attrib->GetDecodedValue()->PrintLine();   # 5 < 6
};

GetName #

Gets the name of the attribute

method : public : GetName() ~ String

Return

TypeDescription
Stringattribute name

Example

parser := XmlParser->New("<item id=\"7\"/>");
if(parser->Parse()) {
  attrib := parser->GetRoot()->GetAttribute("id");
  attrib->GetName()->PrintLine();
};

GetNamespace #

Gets the attribute namespace

method : public : GetNamespace() ~ String

Return

TypeDescription
Stringattribute namespace

Example

attrib := XmlAttribute->New("xml:lang", "en");
attrib->GetNamespace()->PrintLine();

GetValue #

Gets the attribute value as it appeared in the source: entity references such as &amp; are NOT decoded. Use GetDecodedValue for the decoded text.

method : public : GetValue() ~ String

Return

TypeDescription
Stringraw attribute value

Example

parser := XmlParser->New("<img src=\"photo.png\"/>");
if(parser->Parse()) {
  attrib := parser->GetRoot()->GetAttribute("src");
  attrib->GetValue()->PrintLine();
};

New # constructor

Constructor

New(name:String, value:String)

Parameters

NameTypeDescription
nameStringattribute name
valueStringattribute value

SetName #

Sets the attribute name

method : public : SetName(name:String) ~ Nil

Parameters

NameTypeDescription
nameStringattribute name

Example

attrib := XmlAttribute->New("class", "widget");
attrib->SetName("id");
attrib->GetName()->PrintLine();

SetNamespace #

Sets the attribute namespace

method : public : SetNamespace(namespace:String) ~ Nil

Parameters

NameTypeDescription
namespaceStringattribute namespace

Example

attrib := XmlAttribute->New("lang", "en");
attrib->SetNamespace("xml");
attrib->GetNamespace()->PrintLine();

SetValue #

Sets the attribute value

method : public : SetValue(value:String) ~ Nil

Parameters

NameTypeDescription
valueStringattribute value

Example

attrib := XmlAttribute->New("color", "red");
attrib->SetValue("blue");
attrib->GetValue()->PrintLine();