XML Attribute
An XML attribute is an identifier associated with an XML tag. It has a unique name in the context of the tag, and a string value. A tag can have any number of attributes, including none.
<tagNameattribName="Value">…</tagName>
<tagNameattribName="Value"/>
Conversion to Struct
An XML element converts to a Struct with the name attribName, and
annotation tag xmlClass = attribute.
Annotations
The Struct for an XML element can have the following annotations:
xmlClass = attributexmlNamespaceURI =URIxmlNamespaceAlias =prefix
If xmlToStruct/schema is used, and if the data type is
defined in a schema with a namespace, it can have addition annotations:
xmlDataType =DataTypexmlTypeCategory = simple|complexxmlTypeNamespace =
For more information, see Struct Annotations for XML.
XML to Struct Conversion: Attributes
XML element with attribute and value:
<para audience="admin">text</para>
String returned by $dbgString after conversion:
[]
[para]
[$tags]
[xmlClass] = element
[aurience] = admin
[$tags]
[xmlClass] = attribute
[] = text
You can get the values of Structs using Struct access operators. For example:
vValue = vStruct->p ; Result: vValue = "text" vClass = vStruct->p->$tags->xmlClass ; Result: vClass = "element" vValue = vStruct->p->priority ; Result: vValue = "2" vClass = vStruct->p->priority->$tags->xmlClass ; Result: vClass = "attribute"