Skip to main content

%XML.Element

Class %XML.Element Extends %RegisteredObject [ System = 3 ]

The %XML.Element class defines an XML element to be used by %XML.Writer. The tag name, attributes and namespace may be defined. To get a new instance of %XML.Element call %New(tag) where tag is the tagname to be used for the element. The Tagname property may alternatively be set to the tag name.

Properties

Tagname

Property Tagname As %String;

The tagname to be used for the element.

Namespace

Property Namespace As %String;

The Namespace property is set to the namespace to be used for this tag. If Namespace is not set then %XML.Writer will use the default namespace or no namespace if no default is set.

Local

Property Local As %Boolean [ InitialExpression = 0 ];

The Local property determines how the tag is qualified for the case of elementFormDefault="unqualified".

Attributes

Property Attributes As %String [ MultiDimensional, Private ];

Internal array of attribute name/value pairs.

Methods

%OnNew

Method %OnNew(tag As %String) As %Status [ Internal ]

tag is the tagname to be used for the element. This method is for internal use only. You should not make direct use of it within your applications. There is no guarantee made about either the behavior or future operation of this method.

AddAttribute

Method AddAttribute(name As %String, value As %String = "", namespace As %String, valueNamespace As %String) As %Status

The AddAttribute method adds an attribute to this element.
The name and value arguments are required.
The namespace is the optional namespace for the attribute name. If namespace is not specified, then the default namespace is used for the attribute name.
The valueNamespace argument is the namespace for the value. If valueNamespace is not specified (the most usual case), no namespace prefix is used for the value. valueNamespace is used for attributes like xsi:type whose value comes from an XML schema namespace.

AttributeCount

Method AttributeCount() As %Integer

The AttributeCount returns the number of attributes.

GetAttribute

Method GetAttribute(index As %Integer, ByRef name As %String, ByRef namespace As %String, ByRef valueNamespace As %String) As %String

The GetAttribute returns the specified attribute.