[jdom-interest] extract info from JDOM tree
Travis, Mark
MTravis at skm.com.au
Tue Dec 10 15:07:08 PST 2002
Have you tried transforming the data. It seems that xsl is perfectly
suited to your requirement.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8"
indent="yes"/>
<xsl:template match="document/group/company">
<xsl:value-of select="../@name" />-<xsl:value-of
select="fullname/text()"/>
</xsl:template>
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>
This will output the following single data line
Europe-LufthansaEurope-Soviet AirlinesEurope-Air
FranceUS-American Airlines
Depending on you requirements, you can change the xsl file to output xml
or html.
Hope this helps
Mark
-----Original Message-----
From: jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org]
On Behalf Of Sylvain.Thevoz at swisscom.com
Sent: Thursday, 5 December 2002 8:42 PM
To: jdom-interest at jdom.org
Subject: [jdom-interest] extract info from JDOM tree
Hello everybody,
I repost my question:
I have a XML file like this
<document>
<group name="Europe">
<company name="LH">
<fullname>Lufthansa</fullname>
</company>
<company name="SA">
<fullname>Soviet Airlines</fullname>
</company>
<company name="AF">
<fullname>Air France</fullname>
</company>
</group>
<group name="US">
<company name="AA">
<fullname>American Airlines</fullname>
</company>
</group>
</document>
I want to retrieve content of this file and create a list of String that
contain: Europe
Europe->Lufthansa
Europe->Soviet Airlines
Europe->Air France
US
US->American Airlines
Anyone has experience or idea?
Thank you very much
Sylvain
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@you
rhost.com
More information about the jdom-interest
mailing list