aspose file tools*
The moose likes XML and Related Technologies and the fly likes Parsing 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 "Parsing xml file ??" Watch "Parsing xml file ??" New topic
Author

Parsing xml file ??

Bikash Paul
Ranch Hand

Joined: Dec 04, 2001
Posts: 342
Hi all friends,
Iam new to XML I want to clear my some doubts how I can parse my xml file,I have created my own xml and dtd file.I have heard that there is only two ways of parsing xml file is it right ? if it is right then what are the two ways ?
Another question is validation and parsing are same thing ?
Thanks & Regards
Bikash
[ August 31, 2003: Message edited by: Bikash Paul ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I am new to XML I want to clear my some doubts how I can parse my xml file,I have created my own xml and dtd file.I have heard that there is only two ways of parsing xml file is it right ? if it is right then what are the two ways ?

You're probably talking about SAX and DOM. SAX is an event-based approach to parsing (i.e. the XML parser sends your application events when encountering elements, attributes, text nodes, etc.) while DOM is a document-based approach (the XML parser builds a complete document object hierarchy for you to navigate and pick the info you need).
Another question is validation and parsing are same thing ?

No. Parsing is the act of transforming a character stream/file/string/whatever into an XML document while validation is the act of checking that the resulting document follows the structure it should follow (i.e. compare the XML document to its DTD document).


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Bikash Paul
Ranch Hand

Joined: Dec 04, 2001
Posts: 342
Hi,
First of all thanks for your reply.Can I parse my xml file using java and DOM parser.Can you plz give me some help link so that I can take help from there.I want to parse my xml file using java and DOM parser.
Thanks & Regards
Bikash
Johannes de Jong
tumbleweed
Bartender

Joined: Jan 27, 2001
Posts: 5089
The The Java Developers Almanac 1.4 is always a great source for examples.
I do suggest however you first learn more about XML parsing before you proceed to parse you document using DOM. DOM aint easy. see XML Tutorial
It might also want to look at JDom
Good luck.
[ September 01, 2003: Message edited by: Johannes de Jong ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
There is also a JSR for a pull-based Streaming API for XML. Take a look at this article about the differences of these three in the Oracle Technology Network.
Bikash Paul
Ranch Hand

Joined: Dec 04, 2001
Posts: 342
Hi,
Lots of thanks for all of ur's help.
Thanks & Regards
Bikash
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parsing xml file ??