Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

how to get data from XML ?

Thread view: 
marvin.im@gmail.com - 06 Aug 2006 21:34 GMT
hi,
i have the following XML message, i a way to get a list of pairs of the
values of Type & NumberOfPayments.

<Content>

<list CustomerId ="123456" city = "NewYork" >

<Order OrderId = "3" Type = "Credit" NumberOfPayments ="15" category =
"electronics" discountValue = "0.10"><title>Telephone</title> </Order>
<Order OrderId = "2" Type = "Cash" NumeberOfPayments = "0" category =
"shoes" discountValue = "0.2"><title>sport_shoes</title> </order>
<Order OrderId = "5" Type = "Cash" NumeberOfPayments = "0" category =
"sweets" discountValue = "0"><title>pop_ice</title> </order>
<Order OrderId = "1" Type = "Credit" NumeberOfPayments = "2" category =
"electronics" discountValue = "0.65"><title>MP3_Player</title> </Order>
<Order OrderId = "4" Type = "Credit" NumeberOfPayments = "6" category =
"electronics" discountValue = "0"><title>MP3_Player</title> </Order>
</list>

</Content>

I am facing a problem in that, please help in a way to make it.
regards.

Marvin
Andreas Wollschlaeger - 06 Aug 2006 21:58 GMT
> hi,
> i have the following XML message, i a way to get a list of pairs of the
> values of Type & NumberOfPayments.

I would use Commons Digester
(http://jakarta.apache.org/commons/digester/) or dom4j
(http://www.dom4j.org).

Both allow to access the content of XML using XPath expressions - no
free lunch, but if you master either of these, you will never be afraid
of XML again :-)

Possibly check out the dom4j cookbook first
(http://www.dom4j.org/cookbook.html, "Using XPath"), maybe this is
enough to get your job done..

HTH
Andreas

> <Content>
>
[quoted text clipped - 18 lines]
>
> Marvin
sweetsuresh - 07 Aug 2006 02:02 GMT
try JAXP 1.3 . comes with java 5.

sureshbabu
Tony - 07 Aug 2006 20:12 GMT
Hello Andreas
thank you for the fast reply,
is there any site with a near example of extracting attributes values
from a element ?

Marvin

> > hi,
> > i have the following XML message, i a way to get a list of pairs of the
[quoted text clipped - 37 lines]
> >
> > Marvin


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.