Home » Developer & Programmer » JDeveloper, Java & XML » To get a tag value in XML
To get a tag value in XML [message #378385] Tue, 30 December 2008 03:46 Go to next message
sathyam2627
Messages: 52
Registered: November 2006
Member
Hi All,

XML File content is stored in a clob variable. Now i would like to extract a tag value without hardcoding the tag path.. As i am not sure with the path of the tag.

I have gone thru the solution for this in this portal everywhere i have observed path of the tag has specified to extract value of the particular tag.

Is there any way to extract value of the given tag by just passing the name of the tag.

Thanks for your help.
Re: To get a tag value in XML [message #378411 is a reply to message #378385] Tue, 30 December 2008 05:35 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Post a Test case: create table and insert statements along with the result you want with these data.

Regards
Michel
Re: To get a tag value in XML [message #378641 is a reply to message #378411] Wed, 31 December 2008 03:32 Go to previous messageGo to next message
sathyam2627
Messages: 52
Registered: November 2006
Member
Test Case
----------

Table T1 is having 5 columns say A,B,C,D,E out of this A,B,C,D are primary key columns
Table T2 is having 5 columns say F,G,H,I,J out of this F,G,H,I are foriegn key columns to t1(References t1(A,B,C,D)).

T1 is the master table and t2 is the child table.

We are extracting data from both t1 and t2 and generating a single xml file as a single dataset.

 Select * From T1;
  A   B  C  D  E
------------------
  1   x  y  z  cc

   Select * From T2;
---------------------
No data found

When table is not containing rows we are populating with dummy values.

we are able to generate xml file for t1 and t2 tables in a clob variable like this.

<?xml version = '1.0'?>
<STORESET STORE_KEY="10">
  <DATASET NUM="1">
    <ROWSET TABLE_NAME="T1">
      <ROW num="1">
	<A>1</A>
	<B>x</B>
	<C>Y</C>
	<D>Z</D>
	<E>CC</E>
      </ROW> 
    </ROWSET>                                            
    <ROWSET TABLE_NAME="T2">
      <ROW num="1">
	<F>0</F>
	<G>tst</G>
	<H>tst</H>
	<I>Tst</I>
	<J>tst</J>
      </ROW>
    </ROWSET> 
 </DATASET>
</STORESET>


The problem is now t2 is not having records then rowset is coming as
<ROWSET TABLE_NAME="T2">
<ROW num="1">
	<F>0</F>
	<G>tst</G>
	<H>tst</H>
	<I>Tst</I>
	<J>tst</J>
</ROW>

This values we have hardcoded and will get into picture when table is not containing records.

Since t1 and t2 master detail tables now We want to update the tag values of <F><G><H><I> as matching with master data with any record like
<ROWSET TABLE_NAME="T2">
 <ROW num="1">
	<F>1</F>
	<G>x</G>
	<H>y</H>
	<I>z</I>
	<J>tst</J>
 </ROW>  


we are generating xml with DBMS_XMLQuery.GetXML
Please guide me how can i update the tag values of t2.
I hope i am clear with my explantion.



Thanks
Re: To get a tag value in XML [message #378642 is a reply to message #378641] Wed, 31 December 2008 03:33 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Michel Cadot wrote on Tue, 30 December 2008 12:35
Post a Test case: create table and insert statements along with the result you want with these data.

Regards
Michel



Quote:
we are able to generate xml file for t1 and t2 tables in a clob variable like this.

Post what you did to get it.

Regards
Michel

[Updated on: Wed, 31 December 2008 03:35]

Report message to a moderator

Re: To get a tag value in XML [message #378643 is a reply to message #378642] Wed, 31 December 2008 03:35 Go to previous messageGo to next message
sathyam2627
Messages: 52
Registered: November 2006
Member
we are using oracle database version as Release 9.2.0.8.0
Re: To get a tag value in XML [message #378646 is a reply to message #378642] Wed, 31 December 2008 03:49 Go to previous messageGo to next message
sathyam2627
Messages: 52
Registered: November 2006
Member
Did you mean to post the complete plsql code.
Re: To get a tag value in XML [message #378652 is a reply to message #378646] Wed, 31 December 2008 04:08 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Ah, you got the result from a PL/SQL code, maybe it was worth to mention it and yes post the code related to the test case and result you mentionned.
Actually I don't understand what is your problem, you can generate what you want with PL/SQL.

And I'm still waiting for the test case, including what you want from these data.

Regards
Michel
Previous Topic: Problem with XMLNS
Next Topic: simple validation issue
Goto Forum:
  


Current Time: Fri Mar 29 04:52:53 CDT 2024