Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get value of an xml node which contains another xml

 
sahidul karim
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I get value of an XML node which is internally represents another XML.
My xml :-

<?xml version="1.0"?>
<Entity name = "RuleSetInfo">
<Column name="definition">
<RuleSet>
<Product comment="" id="PRODUCT_10" legislationbase="" producttype="RT1">
<Label highlightonfailure="true">
<RuleName>
<Text locale="en_US" value="Liability Overbilling"/>
</RuleName>
<SuccessText>
<Text locale="en_US" value="Product Succeeded"/>
</SuccessText>
</Product>
</RuleSet>
</Column>
</Entity>

I want to retrieve value inside the <Column> VALUE</Column> tag and I am using SAX parser.

VALUE:- represents another XML which is
<RuleSet>
<Product comment="" id="PRODUCT_10" legislationbase="" producttype="RT1">
<Label highlightonfailure="true">
<RuleName>
<Text locale="en_US" value="Liability Overbilling"/>
</RuleName>
<SuccessText>
<Text locale="en_US" value="Product Succeeded"/>
</SuccessText>
</Product>
</RuleSet>
How can I get this inner XML as VALUE of <Column> node?

Regards,
sahidul
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say you want to "get" the XML, exactly what do you mean by that? Do you want the XML rendered as text, or in some internal form, or what?
 
sahidul karim
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to get that xml as a textual representation ( I need to store the vale as a string).
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems to me that all you need to do is start a new StringBuffer when you get the startElement event.
Collect what you need from the following events in the StringBuffer until you hit the endElement event and bingo.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic