IBM Integration Bus, Version 9.0.0.8 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS

See information about the latest product version

XMLNSC: Using field types

The XMLNSC parser sets the field type on every syntax element that it creates.

The field type indicates the type of XML construct that the element represents. The XMLNSC parser uses the field type when writing a message tree. The field type can be set by using ESQL or Java™ to control the output XML. The field types that are used by the XMLNSC parser must be referenced by using constants with names that are prefixed by 'XMLNSC.'
Tip: Field type constants that have the prefix 'XML.' are for use with the XMLNS and XML parsers only, and are not valid with the XMLNSC or MRM parsers.

Field types for creating syntax elements

Use the following field type constants to create syntax elements in the message tree. The XMLNSC parser uses these values when creating a message tree from an input message.
XML construct XMLNSC Field Type constant Value
Simple Element
XMLNSC.Field
XMLNSC.CDataField
0x03000000
0x03000001
Attribute
XMLNSC.SingleAttribute
XMLNSC.Attribute
0x03000101
0x03000100
Mixed content
XMLNSC.Value
XMLNSC.CDataValue
0x02000000
0x02000001
Namespace  Declaration
XMLNSC.SingleNamespaceDecl
XMLNSC.NamespaceDecl
0x03000102
0x03000103
Complex element
XMLNSC.Folder
0x01000000
Inline DTD
XMLNSC.DocumentType
0x01000300
XML declaration
XMLNSC.XmlDeclaration
0x01000400
Entity reference
XMLNSC.EntityReference
0x02000100
Entity definition
XMLNSC.SingleEntityDefinition
XMLNSC.EntityDefinition
0x03000301
0x03000300
Comment
XMLNSC.Comment
0x03000400
Processing Instruction
XMLNSC.ProcessingInstruction
0x03000401

Field types for path expressions ( generic field types )

Use the following field type constants when querying the message tree by using a path expression; for example:
SET str = FIELDVALUE(InputRoot.e1.(XMLNSC.Attribute)attr1)
It is good practice to specify field types when querying a message tree built by the XMLNSC parser. This makes your ESQL code more specific and more readable, and it avoids incorrect results in some cases. However, care is required when choosing which field type constant to use. When you use the XMLNSC parser, use a generic field type constant when querying the message tree. This allows your path expression to tolerate variations in the input XML.

The generic field type constants are listed in the following table:

XML construct XMLNSC Field Type constant Purpose
Tag XMLNSC.Element Matches any tag, whether it contains child tags (XMLNSC.Folder) or a value (XMLNSC.Field )
Element XMLNSC.Field Matches a tag which contains normal text, CData, or a mixture of both. Does not match tags which contain child tags.
Attribute XMLNSC.Attribute Matches single-quoted and double-quoted attributes
Mixed content XMLNSC.Value Matches normal text, CData, or a mixture of both
XML Declaration XMLNSC.NamespaceDecl Matches single- and double-quoted declarations
If you write
InputRoot.e1.(XMLNSC.DoubleAttribute)attrName
your path expression does not match a single-quoted attribute. If you use the generic field type constant XMLNSC.Attribute, your message flow works with either single-quoted or double-quoted attributes.

Note that you should always use the field type constants and not their numeric values.

Field types for controlling output format

The following field types are provided for XML Schema and base64 support. Do not use these field type constants in path expressions; use them in conjunction with XMLNSC.Attribute and XMLNSC.Field to indicate the required output format for DATE and BLOB values. See XMLNSC: XML Schema support for further information.
XMLNSC Field Type constant Purpose Value
XMLNSC.gYear The value must be a DATE. If the field type includes this value, the DATE value is produced by using the XML Schema gYear format. 0x00000010
XMLNSC.gYearMonth The value must be a DATE. If the field type includes this value, the DATE value is produced by using the XML Schema gYearMonth format. 0x00000040
XMLNSC.gMonth The value must be a DATE. If the field type includes this value, the DATE value is produced by using the XML Schema gMonth format. 0x00000020
XMLNSC.gMonthDay The value must be a DATE. If the field type includes this value, the DATE value is produced by using the XML Schema gMonthDay format. 0x00000050
XMLNSC.gDay The value must be a DATE. If the field type includes this value, the DATE value is produced by using the XML Schema gDay format. 0x00000030
XMLNSC.base64Binary The value must be a BLOB. The value is produced with base64 encoding. 0x00000060
XMLNSC.List The element must be XMLNSC.Attribute or XMLNSC.Field. If the field type includes this value, the values of all child elements in the message tree are produced as a space-separated list. 0x00000070

Field types for direct output

Use the following field types to produce pre-constructed segments of an XML document. Character escaping is not done; therefore, take extra care not to construct a badly-formed output document. Use these constants only after carefully exploring alternative solutions.
XMLNSC Field Type constant Purpose Value
XMLNSC.Bitstream The value of this syntax element must be a BLOB. The value is written directly to the output bit stream. For more information about its usage, see Working with large XML messages. 0x03000200
XMLNSC.AsisElementContent The value of this syntax element must be CHARACTER. The value is written directly to the output bit stream. No character substitutions are performed. Use this element with care. 0x03000600

ac67192_.htm | Last updated Friday, 21 July 2017