File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes how to read this kind of xml file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "how to read this kind of xml file?" Watch "how to read this kind of xml file?" New topic
Author

how to read this kind of xml file?

J radolf
Ranch Hand

Joined: Jan 08, 2009
Posts: 121
i know to read a simple xml file in the below format

http://www.developerfusion.com/code/2064/a-simple-way-to-read-an-xml-file-in-java/

i want to know how do i read the xml if it is of the below format.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38896
    
  23
Too difficult a question for us beginners. Moving.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41885
    
  63
By "this kind", do you mean the attributes? If so, check out the DOM methods Node.getAttributes and Element.getAttribute.


Ping & DNS - my free Android networking tools app
J radolf
Ranch Hand

Joined: Jan 08, 2009
Posts: 121
like there are several attributes inside the same DESPROXY tag.

so how would i do that?

because in my case there are several key-value pairs.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Ulf Dittmer wrote:check out the DOM methods Node.getAttributes and Element.getAttribute.
J radolf
Ranch Hand

Joined: Jan 08, 2009
Posts: 121


my xml is as follows..


i do not know and understand how to read the values in DESPROXY element
that is "N" "100" and other values .
please anyone can help me?
J radolf
Ranch Hand

Joined: Jan 08, 2009
Posts: 121
am getting a nullpointerException because it is not reading the values?

what should be my next step?
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3568
    
  15
J radolf wrote:am getting a nullpointerException because it is not reading the values?

what should be my next step?


Reading the responses from Ulf and David would probably be a good first step.


Joanne
J radolf
Ranch Hand

Joined: Jan 08, 2009
Posts: 121

By "this kind", do you mean the attributes? If so, check out the DOM methods Node.getAttributes and Element.getAttribute.



where do i put these methods in my code? after DESPROXY tag value returns?
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3568
    
  15
J radolf wrote:where do i put these methods in my code? after DESPROXY tag value returns?


Well, they are methods of the Node and Element classes, so you will need an instance of one of these classes in order to call them.
Find out where in your code you have these instances and then experiment with calls to these methods and see what data they return.
J radolf
Ranch Hand

Joined: Jan 08, 2009
Posts: 121
Thanks guys.

Finally i solved it.

Thanks Everyone.
 
Don't get me started about those stupid light bulbs.
 
subject: how to read this kind of xml file?