Apama 10.3 | Apama Documentation | Connecting Apama Applications to External Components | Standard IAF Plug-ins | Codec IAF Plug-ins | The XML codec IAF plug-in | About the XML parser
About the XML parser
On startup, the XML codec logs the names of the classes it is using for XML parsing and XML generation. For example:
INFO [11808] - XMLCodec: Encoder initialized: using XML Document builder
INFO [11808] - XMLCodec: Decoder initialized: using Streaming API for XML (StAX)
Apama uses Xerces for encoding (creating XML docs) and Woodstox StAX for decoding (parsing).
XML namespace support
If your application relies on the standard XML parsing/generation behavior (that is, not XPath) there is no concept of "declaring namespaces" in the XML codec nor is it required as long as the XML document is valid (that is, it declares any namespace prefixes it uses) then you can just use namespaceprefix:elementName when referring to elements in your mapping rules. If there is any doubt, you can run your sample message through the XMLCodec property logFlattenedXML=true and it will show you what to specify in your mapping rules, for example, consider the following sample message:
<h:table xmlns:h="http://www.myco.com/apama/test/testnamespace_h/"
With the above sample message you could use mapping rules such as:
<map type="string" default="" apama="default_namespace"
<map type="string" default="" apama="prefix_namespace"
<map type="string" default="" apama="prefixed_element_text"
<map type="string" default="" apama="non_prefixed_element_text"
If you use XPath in your application, XPath itself contains operators to access the local (non-namespace) name and namespace URI of any XML content. However it is often convenient to define some global prefixes to make it easier to refer to namespaced elements. Apama supports this by allowing any number of XPathNamespace:myprefix codec properties, whose value is the URN that the specified prefix should point to. For example,
<property name="XPathNamespace:b" value="urn:xmlns:mynamespace"/>
would allow XPath expressions to use "b" to refer to elements in the "mynamespace" namespace:
<property name="XPath:Test.root/b:elementname/text()"/>

Copyright © 2013-2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.