Home » Developer & Programmer » JDeveloper, Java & XML » problem with reading XML attributes and elements (9i)
problem with reading XML attributes and elements [message #321771] Wed, 21 May 2008 05:11 Go to next message
ramora
Messages: 16
Registered: November 2006
Location: hyderabad
Junior Member
Hi experts,

Please help me, Its urgent..

select extract(column_value,'//C/text()').getstringval() CVal,
extract(column_value,'//O/text()').getstringval() OVal
from table(xmlsequence(extract(xmltype(
'<A A="A" T="256cff52" F="SECUF" U="admin" B="AID" C="panID" US="L_NAME" L="en" >
<T N="Table01">
<C A="D">
<C>Fid</C>
<O>AMACYR</O>
<N>null</N>
</C>
<C A="A">
<C>UID</C>
<O>null</O>
<N>256cff52</N>
</C>
</T>
<T N="Table02">
<C A="E">
<C>Fid1</C>
<O>AMACYR1</O>
<N>null</N>
</C>
<C A="F">
<C>UID1</C>
<O>null</O>
<N>256cff52</N>
</C>
</T>
</A>'),
'//A/T')));

the output is coming like below, i am getting empty for
Attributes of A and Attribute of T.

Att of A Att of T CVAL OVAL NVAL
-------- -------- ------ -------- ------------
FidUID AMACYRnull null256cff52
Fid1UID1 AMACYR1null null256cff52


Here i am getting only 2 records, but i need 4 records with the
Atrributes of corresponding child Nodes like below

Att of A. Att of T CVAL OVAL NVAL
------------------------------------------
A Table01 Fid AMACYR null
A Table01 UID null 256cff52
A Table02 Fid1 AMACYR1 null
A Table02 UID1 null 256cff52

Thanks in Advance.
Re: problem with reading XML attributes and elements [message #321786 is a reply to message #321771] Wed, 21 May 2008 05:41 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Your query does not return the values you list.
Can you show us the query you actually ran.
Re: problem with reading XML attributes and elements [message #321794 is a reply to message #321771] Wed, 21 May 2008 06:12 Go to previous messageGo to next message
ramora
Messages: 16
Registered: November 2006
Location: hyderabad
Junior Member
please see below query..

select extract(column_value,'/A/@A') "Att of A",
extract(column_value,'/A/T/@A') "Att of T",
extract(column_value,'//C/text()').getstringval() CVal,
extract(column_value,'//O/text()').getstringval() OVal,
extract(column_value,'//N/text()').getstringval() NVal
from table(xmlsequence(extract(xmltype(
'<A A="A" T="256cff52" F="SECUF" U="admin" B="AID" C="panID" US="L_NAME" L="en" >
<T N="Table01">
<C A="D">
<C>Fid</C>
<O>AMACYR</O>
<N>null</N>
</C>
<C A="A">
<C>UID</C>
<O>null</O>
<N>256cff52</N>
</C>
</T>
<T N="Table02">
<C A="E">
<C>Fid1</C>
<O>AMACYR1</O>
<N>null</N>
</C>
<C A="F">
<C>UID1</C>
<O>null</O>
<N>256cff52</N>
</C>
</T>
</A>'),
'//A/T')));
Re: problem with reading XML attributes and elements [message #321799 is a reply to message #321771] Wed, 21 May 2008 06:27 Go to previous message
Michel Cadot
Messages: 68728
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
You already been requested to format your post, please do it.
Reminder:
Read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.

Regards
Michel
Previous Topic: How to query for xml atrribute?
Next Topic: Web based OAF page
Goto Forum:
  


Current Time: Wed Dec 18 00:03:39 CST 2024