You can write an application program to query a fragment
of XML before transforming it into application data.
About this task
If your application is going to process many different types
of XML, you might want to query the XML to determine which XMLTRANSFORM
resource to use to transform it to application data. This command
might also be useful if your XML contains <xsd:any> elements.
Procedure
- In your application program, use the TRANSFORM
XMLTODATA API command to query the XML:
EXEC CICS TRANSFORM XMLTODATA
CHANNEL('MyChannelName')
XMLCONTAINER('SourceContainerName')
ELEMNAME(elementName) ELEMNAMELEN(elementNameLength)
You
must specify the name of the channel and the name of the container
that holds the XML. You do not have to specify an XMLTRANSFORM resource
to query the XML. The above example queries the name of the first
XML element and the length of the XML element. You can also query
the type of the first XML element, the length of the type, and the
namespace of the type.
- Optional: If the application requires the namespace of the XML element, provide a data-area in which
CICS can write the ELEMNS value.
- Optional: After querying the XML, you can write
application logic to determine which XMLTRANSFORM resource to use
to transform the XML to application data.
- Install the application program in CICS.
Results
CICS reads the specified container and returns the information
about the XML element to the application program.