Use the XML API to perform operations
We can use the IBM XML API to perform operations that use the new and updated W3C XML standards.
Limitations of the processor:
- When using the namespace axis, only the namespaces declared on the current node are accessible through the namespace axis (rather than all of the namespaces that are in scope for the current node) if the input document supplied is a StreamSource, SAXSource, or StAXSource.
- When evaluating some string functions and operations, the processor might not handle Unicode characters with code points above #xFFFF correctly; it might incorrectly treat the surrogate pair in the UTF-16 encoding of the character as two separate characters.
- Whitespace text nodes might not be stripped from elements that have complex type with element-only content. When matching children of such an element, use a sequence type that matches only elements such as element() to avoid processing these text nodes.
- The column number reported in an error message relating to an operator expression might not point to the operand that is actually in error. Consider both operands when determining the cause of the error.
- Use a variable declared in an XQuery typeswitch clause as an operand in an arithmetic expression might cause an error.
When using the variable declared in an XQuery typeswitch clause in an arithmetic expression such as in the following example, the processor might incorrectly report a type error.
typeswitch (.) case $a as xs:integer return ($a + 1) default return 17To work around this limitation, cast the variable to the expected type. For example:
typeswitch (.) case $a as xs:integer return (($a cast as xs:integer) + 1) default return 17
- Perform basic operations.
- Precompile.
- Use resolvers.
- Use external variables and functions.
- Create items and sequences.
- Work with collations.
- Execute using the command-line tools.
- Use a message handler and manage exceptions.
Subtopics
- Build and running a sample XML application
We can use the IBM WebSphere Application Server XML thin client, the com.ibm.xml.thinclient_8.5.0.jar file, to build a sample XML application. We can also use the API documentation to improve the understanding of the XML API.
- Run the IBM Thin Client for XML
The IBM Thin Client for XML with WebSphere Application Server allows applications to take advantage of IBM XML technology components in a simple Java environment. Such applications can directly access the XML API to process XPath, XQuery, and XSL in a Java SE runtime environment. We can bundle the Thin Client for XML library with the application using the WAS installation. The Thin Client for XML also extends the choice of Java SE runtime environment. It can be run in IBM Java Runtime Environments (JREs) packaged with WebSphere Application Server as well as in the Windows and Linux JREs from Oracle Corporation, the JREs that are downloaded from the Oracle Corporation website, or the JRE that is downloaded from the HP website.
- Performing basic operations
We can use this information to help to perform basic XPath, XSLT, and XQuery operations.
- Precompiling
We can use this information to help to precompile an expression, query, or stylesheet.
- Use resolvers
We can use this information to help to use resolvers.
- Use external variables and functions
We can use this information to help to use external variables and functions.
- Create items and sequences
We can use this information to help to create items and sequences using the XItemFactory as well as to use sequence types.
- Work with collations
XSLT stylesheets and expressions in XQuery and XPath can refer to collations using collation URIs. A collation is a set of culture-specific rules that define how text should be sorted and which differences between two pieces of text are considered significant and which insignificant.
- Executing using the command-line tools
We can use the ExecuteXSLT tool to execute a stylesheet, use the ExecuteXPath tool to execute an XPath expression, and use the ExecuteXQuery tool to execute an XQuery expression.
- Use a message handler and managing exceptions
We can use this information to help to use a message handler and mange exceptions.
Related tasks
Performing basic operations Precompiling Use resolvers Use external variables and functions Create items and sequences Work with collations Executing using the command-line tools Use a message handler and managing exceptions