type
XAttr
src
@Js
const class XAttr : Obj
XAttr models an XML attribute in an element. Attributes are immutable and may be shared across multiple XElem parents.
constructors
make |
Construct an element with unqualified local name, value, and optional XML namespace. |
---|---|
makeNs |
Construct an attribute which defines a namespace with "xmlns:<prefix>" name and uri value. |
fields
name |
Unqualified local name of the attribute. |
---|---|
ns |
The XML namespace which qualified this attribute's name. |
val |
Value of the attribute. |
methods
prefix |
If this attribute is qualified by an XML namespace then return the namespace's prefix. |
---|---|
qname |
Qualified name of the attribute. |
toStr |
Return this attribute name/value pair as string. |
uri |
If this element is qualified by an XML namespace then return the namespace's uri. |
write |
Write this attribute to the output stream. |
Slot Details
make
src
new make(Str name, Str val, XNs? ns := null)
Construct an element with unqualified local name, value, and optional XML namespace. The XNs instance should be defined as an attribute on an ancestor element. Throw ArgErr if an attempt is made to qualify the attribute by the default namespace with prefix of "".
makeNs
name
Unqualified local name of the attribute. If an XML namespace prefix was specified, then this is everything after the colon:
foo='val' => foo x:foo='val' => foo
Note that attributes which start with "xml:" and "xmlns:" are not treated as a namespace:
xml:lang='en' => xml:lang XML:lang='en' => xml:lang