how to read elements in a xml file sent as a string
931478Jul 27 2012 — edited Feb 26 2020Hi,
I am new to BPEL and i am working on a requirement where i receive the XML message as a String from an AQ. And I am not able parse the xml to read the individual elements of it. Appreciate your help on this.
The (sample)input message from Q is which i am able to see in the BPEL console:
<BUGINFO_XML>
<XML_MESSAGE>
<?xml version="1.0"?>
<BUGINFO>
<SR_ID>3-29OU7OF</SR_ID>
<OBJECT_TYPE>UPDATE_PREBUG</OBJECT_TYPE>
<RESERVED_BUG_NUM>8221084</RESERVED_BUG_NUM>
<TYPE>Predefect Update</TYPE>
<AUDIENCE>INTERNAL</AUDIENCE>
<COMMENT>TEST activity by Sireesha</COMMENT>
</BUGINFO>
</XML_MESSAGE>
</BUGINFO_XML>
and the corresponding xsd file is:
<schema targetNamespace="http://xmlns.oracle.com/xdb/ORIONCC"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:ORIONCC="http://xmlns.oracle.com/xdb/ORIONCC"
elementFormDefault="unqualified" attributeFormDefault="qualified">
<complexType name="BUGINFO_XML">
<sequence>
<element name="XML_MESSAGE" type="string" nillable="true" minOccurs="0"/>
</sequence>
</complexType>
<element name="BUGINFO_XML" type="ORIONCC:BUGINFO_XML" />
</schema>
i have created a variable(called VariableXML) of element type of the above xsd type({http://xmlns.oracle.com/xdb/ORIONCC}BUGINFO_XML) and using ora:parseEscapedXML method, i copied the input data to this variable and i can see the data copied fine to this variable, but after that i am not able to traverse to the individual element of it say i want the value of SR_ID which i am not able to get.
<VariableXML>
<BUGINFO_XML>
<SR_ID>3-29OU7OF</SR_ID>
<OBJECT_TYPE>UPDATE_PREBUG</OBJECT_TYPE>
<RESERVED_BUG_NUM>8221084</RESERVED_BUG_NUM>
<TYPE>Predefect Update</TYPE>
<AUDIENCE>INTERNAL</AUDIENCE>
<COMMENT>TEST activity by Sireesha</COMMENT>
</BUGINFO_XML>
</VariableXML>
When i see the structure of this variable in the Assign activity i can see only up to '/ns2:BUGINFO_XML/XML_MESSAGE' but not the individual elements.
Please let me know how can i parse this xml to read the elements of it.
I am using jdev 11.1.1.4 and weblogic 10.3
Thanks,
Sireesha
Edited by: user12217808 on Jul 27, 2012 7:10 AM