The XMLNSC parser uses field types to represent attributes and elements.
XML Construct | XMLNSC Field Type constant | Value |
---|---|---|
Complex element | XMLNSC.Folder | 0x01000000 |
Simple element |
|
|
Attribute |
|
|
XML Construct | XMLNSC Field Type constant | Purpose |
---|---|---|
Element | XMLNSC.Field | Matches elements that contain normal text, CData, or a mixture of both |
Attribute | XMLNSC.Attribute | Matches both single-quoted and double-quoted attributes |
<root id="12345">
<id>ABCDE</id>
</root>
Note that the message contains an attribute
and an element with the same name. Example 1 : Query the value of an XML element
SET value = FIELDVALUE(InputRoot.XMLNSC.root.(XMLNSC.Field)id)
The
result is that value is set to 'ABCDE'.SET value = FIELDVALUE(InputRoot.XMLNSC.root.(XMLNSC.Attribute)id)
The
result is that value is set to '12345'. CREATE LASTCHILD OF OutputRoot.XMLNSC Type XMLNSC.Folder Name 'root';
-- Note : XMLNSC.Attribute could be used here as well.
SET OuputRoot.XMLNSC.root.(XMLNSC.Attribute)id = '12345';
SET OuputRoot.XMLNSC.root.(XMLNSC.Field)id = 'ABCDE';
The
first line is optional because the element 'root' is created automatically
by the following line if it does not already exist.