• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

parse the whole subnode as Texts, How?

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I faced with a problem:
In the source XML: i.g.:
<A>
<B>
Text<P>blabla...</P>
</B>
</A>
I want to use a standard XML parser to get all information
under the A Node as a Text, it will validate other xml tags except for
any subNode under <A>.
what should I use in <B> and <P> like CDATA?
Thanks,
Roy
 
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
I understand your question to be how to get the text without parsing tne <B> etc tags. In that case your only option is to start a CDATA section immediately after the opening <A> tag and close it immediately before the </A> - be sure not to leave a linebreak after the opening tag or you will get a Text node containing crlf.
Bill
 
Roy Huang
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Bill,
what you siad is exactly the points I should take care of.
But I have a further question: How can I use a XSLT
to transform the
.....
<source>
<![CDATA[<p>]]>3421/2003<![CDATA[</p>]]>
</source>
.....
to
<TEXT>
<![CDATA[<p>]]>3421/2003<![CDATA[</p>]]>
</TEXT>
then with the output xml I will use the parser which I asked you before to handle it.
But it seems all the CDATA is missing after XSLT ?

Thanks,
Roy
[ January 28, 2004: Message edited by: Roy Huang ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic