This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get string portion of mixed content with JAXB?

 
L Duperval
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have data with mixed content that looks like this:

<node attr1="1" attr2="1">I want this text only!
<otherNode attr="1" >3</otherNode>
<otherNode attr="2" >9</otherNode>
<otherNode attr="3" >9</otherNode>
<otherNode attr="4" >E</otherNode>
<otherNode attr="5" >4</otherNode>
<otherNode attr="6" >7</otherNode>
<otherNode attr="7" >0</otherNode>
</node>

Using JAXB, is there a way for me to get the String "I want this text only!" with everything else discarded?

I have this situation for a number of the elements in the XSD and I can't rewrite the spec. :-(

Thanks,

L
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic