*
The moose likes XML and Related Technologies and the fly likes XML parser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML parser" Watch "XML parser" New topic
Author

XML parser

Lee Xu
Ranch Hand

Joined: Aug 24, 2001
Posts: 77
Is XML parser similar to compiler?
Thanks
Stanley Tan
Ranch Hand

Joined: May 17, 2001
Posts: 243
No, not really. It just parses the XML file like a browser parses an HTML file and displays it to the user. Of course, I'm not sure if the Java XML parsers are validating (are they), but if they are then they sort of act like a compiler in that they point out structural errors.
L Goundalkar
Ranch Hand

Joined: Jul 05, 2001
Posts: 395
Hi,
Its not a compiler. Infact even the Validating parsers compare the DTD or Schema of a XML and with the source tree.
I think its more like just checking the XML structure using a Grammer for XML. It doesn't conver the XML tree in to any other file format or so.
It returns the parts of the XML depending upon the conditions given by the program which uses the Parser API like DOM or SAX.
So Parser is just a program which navigates through the XML source tree and returns the result as defined in the API.
Thanks.

------------------
L Goundalkar
lggoundalkar@hotmail.com
Sun Certified Programmer for Java 2 Platform


SCJP, SCWCD
Lee Xu
Ranch Hand

Joined: Aug 24, 2001
Posts: 77
As i remember, the compiler consists of Parser, Lexical Analyser, Linker. So XML parser is just as the first part of compiler, which parse the syntax of the data. Am I right?
Stanley Tan
Ranch Hand

Joined: May 17, 2001
Posts: 243
What compiler are you talking about? The parser checks the syntax and the structure of the XML document.
L Goundalkar
Ranch Hand

Joined: Jul 05, 2001
Posts: 395
Hi Lee & Stanlee
I agree with Satnlee..
As for as my knowledge goes, Compiler is something which converts the given program to Machine code form.
Pasrser never does it.
So please don't compare the both.
Thanks.
------------------
L Goundalkar
lggoundalkar@hotmail.com
Sun Certified Programmer for Java 2 Platform
Stanley Tan
Ranch Hand

Joined: May 17, 2001
Posts: 243
Okay, let me try to explain a parser. Someone please help me out if I go astray. Think of a parser like your internet browser. The browser accepts an HTML document and based on certain tags will do certain things to display information to the user or viewer of the document. The browser does not transform the HTML in any way. It merely accepts the document and transforms it into a human readable format (hopefully)
Cheers and good luck learning!
Kevin Yip
Ranch Hand

Joined: Oct 17, 2000
Posts: 110
According to the XML specification (http://www.w3.org/TR/1998/REC-xml-19980210#sec-intro): "A software module called an XML processor is used to read XML documents and provide access to their content and structure. It is assumed that an XML processor is doing its work on behalf of another module, called the application."
This XML processor is more commonly called parser. Basically an XML parser parses (creates internally without output, just remains in RAM) an XML file into a result-tree so that it can be used by others. For instance, with this result-tree, you can apply XSL to output HTML, another XML, voiceXML etc.
Stanley Tan
Ranch Hand

Joined: May 17, 2001
Posts: 243
I have to ask... what is voiceXML?
Kevin Yip
Ranch Hand

Joined: Oct 17, 2000
Posts: 110
Re: VoiceXML
As the name suggests, VoiceXML is an XML-baesd language designed to enable the development of voice-activated applications. Just like XML, the business logic of voice processing is separate from the data.
You can find more info in http://www.voicexml.org.
Stanley Tan
Ranch Hand

Joined: May 17, 2001
Posts: 243
Since I'm a newbie, this is the first time I've heard of this. It sounds really interesting!!
Abhijit Kulkarni
Greenhorn

Joined: Dec 03, 2000
Posts: 23
Regarding the XML parser... lets say ur XML file is like a database..then ur parser will be a program to access this database, change it and yes even check or validate it.
This is not the exact way to define it but just a mapping to explain the synonimity.
As far as VoiceXml is concerned it is a xml standard for voice interactive programming. visit the IBM developerworks site for more details.
------------------
abhijit from pune.
Ability alone is not enough for success,it must be sparked by ambition and sustained with determination


<b><i>Abhijit</i></b> <br />---------------------------------<br />Give me my share of smile!
Stanley Tan
Ranch Hand

Joined: May 17, 2001
Posts: 243
This is all way too much to handle. I think I'll move voiceXML down the learning road for now. I want to get a good grip on XML basics first
Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

I would like to compare parsers with interpreters rahther than compilers....
------------------
Muhammad Ashikuzzaman (Fahim)
Sun Certified Programmer For Java 2 Platform
--When you learn something, learn it by heart!


Ashik Uzzaman
Senior Member of Technical Staff, Salesforce.com, San Francisco, CA, USA.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML parser