Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 26970
85
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to get that xml as a textual representation ( I need to store the vale as a string).
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic