• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How a Parser function?

 
Johnson Jose
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

What exactly a parser will do, once it start parsing an �xml� document?
Can any one provide some light on this?

Regards
Johnson :roll:
 
DW Bolton
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on the type of parser.

The two most common models for parsers will either build a model of the XML in memory (aka DOM parsers), which allows it to be navigated in various ways, or will fire events as it parses the tree sequentially (the SAX specification covers these).

This would cover most needs for a parser, but you could potentially write your own parser to do something strange like parse an XML in reverse, firing off events as it does so.
 
Johnson Jose
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bolton,

Thanks for the information.

Regards
Johnson
 
Hari Vignesh Padmanaban
Ranch Hand
Posts: 578
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by DW Bolton:
It depends on the type of parser.

The two most common models for parsers will either build a model of the XML in memory (aka DOM parsers), which allows it to be navigated in various ways, or will fire events as it parses the tree sequentially (the SAX specification covers these).

This would cover most needs for a parser, but you could potentially write your own parser to do something strange like parse an XML in reverse, firing off events as it does so.


And just to add on to that, a xml parser will make sure that the XMl document is well formed(open-close tags, valid characters ..) also and it it is validating parser, will validate teh contents and structure of the XMl present against a DTD or a Schema

And most of the commercial parsers available today are validating parsers

HTH
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic