XML_OPTIONS

set options for XML parser

Synopsis:
CALL XML_OPTIONS handle, opt$ TO [status]
'xml_options( handle, opt$, [status] )
ArgumentEnumerationPurpose
handleXML Handle
opt$Options array
statusKDB_ERROR_ENUMReturn status
>XML_OPTIONS

XML_OPTIONS

This function can be used to set parsing options for the XML tree associated with the handle opened by XML_OPEN or XML_PARSE_BUFFER. This call must be made after the handle is allocated but before the first call to XML_NEXT which is when the document is actually parsed.

The options are passed as bits set in bytes of a string opt$ which must be 5 bytes or more in length.

Byte Length Purpose
1 2 Optional features
3 2 Mask for nodes to be returned
5 1 Namespace separator used to separate the NS URI from the tag name when namespaces are enabled. The default is ':' as recommended in the specification but as colons occur in many URIs it may be advantageous to use another character. If set to HEX(00) the URI and tag name will be concantenated without a separator.

The optional features are controlled by bits in a 2 byte field. They can be ORed together. The default is HEX(0000).

Option bit Purpose
HEX(0001) Strip whitespace between tags and values. The XML specification requires whitespace to be preserved even between tags. This can result in annoying HEX(0A)s appended to values and so XML_NEXT will strip leading whitespace outside of CDATA sections by default. To conform exactly to the XML spec and to preserve leading spaces in element values you may wish to disable this option by not setting this bit.
HEX(0002) Process namespace qualifiers. If set then any namespace qualifiers on element tags will be replaced by the actual URI as a prefix and the defining xmlns attributes will be dropped.
HEX(0004) Ignore attributes. If you know the XML to be parsed does not require attributes you can simplify parsing by setting this.

The XML nodes that are returned by XML_NEXT can be specified using the mask parameter. By default the mask is HEX(0001) so that only opening tag elements are returned. To see other components you can set other bits according to the following table.

Mask bit Purpose
HEX(0001) Opening element tags. Returns tag name, element value and any attributes.
HEX(0002) Closing element tags. Returns tag name.
HEX(0004) Comment. Returns name as blank and the comment text in the value.
HEX(0008) Processing instruction. Returns the target in the name and any data in the value.
History
Introduced in KCML 6.00
See Also:
XML_CLOSE, XML_ERROR, XML_NEXT, XML_OPEN, XML_PARSE_BUFFER, XML_TEXT
KCML database status codes