Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Print XML documents:HELP

Reply
Thread Tools

Print XML documents:HELP

 
 
Chris Peppas
Guest
Posts: n/a
 
      01-29-2004
> How can I print this xml (with JDOM using Xpath or any other
> methods) without its tags.
>
> <?xml version='1.0' encoding='ISO-8859-1'?>
> <words>
> <word id="word_1">Annotation</word>
> <word id="word_2">tool</word>
> <word id="word_3">in</word>
> <word id="word_4">Java</word>
> <word id="word_5">.</word>
> </words>
>
> I would like to get in a string the sentence that will look like this:
>
> Annotation tool in Java.
> Thank you

 
Reply With Quote
 
 
 
 
BarryNL
Guest
Posts: n/a
 
      01-30-2004
Chris Peppas wrote:
>>How can I print this xml (with JDOM using Xpath or any other
>>methods) without its tags.
>>
>><?xml version='1.0' encoding='ISO-8859-1'?>
>><words>
>> <word id="word_1">Annotation</word>
>> <word id="word_2">tool</word>
>> <word id="word_3">in</word>
>> <word id="word_4">Java</word>
>> <word id="word_5">.</word>
>></words>
>>
>>I would like to get in a string the sentence that will look like this:
>>
>>Annotation tool in Java.
>>Thank you


How about this XSLT?

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="text"/>
<xsl:template match="words">
<xsl:for-each select="word">
<xsl:value-of select="concat(.,' ')"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Just use the Xalan libraries from Apache to run it.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
print a vs print '%s' % a vs print '%f' a David Cournapeau Python 0 12-30-2008 03:19 AM
Problem - I want to print Current Output of Pdf file and should print once.I get print dialog box but it is not working keto Java 0 05-30-2007 11:27 AM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
Print XML parsing to JspWriter (out) Class org.xml.sax.helpers.NewInstance can not access a member of class javax.xml.parsers.SAXParser with modifiers "protected" Per Magnus L?vold Java 0 11-15-2004 02:27 PM
Unlarging the print to print using PDF file to print Bun Mui Computer Support 3 09-13-2004 03:15 AM



Advertisments