SAX Dom parser

Rajendra Sinha

Greenhorn

Posts: 1

posted 16 years ago

Hi i am a new user for xml parser. can anybody please tell me where i can get the sample code for SAX DOM parser so that i can convert my java files field into a xml file. if anybody before this write code in SAX DOM parser for generating xml file from java code please tell me .

William Brogden

Author and all-around good cowpoke
Rancher

Posts: 13078

6

posted 16 years ago

You are actually mixing up two kinds of XML parser. The SAX style parser makes a pass through an XML file, calling your custom code whenever it finds a tag or other important information. The DOM style builds a Document Object Model (DOM) in memory. Frequently, a SAX parser is at the core of the code that creates a DOM, but the DOM user does not see that. There are plenty of parsers with source code - look at the xml.apache.org site for one. These parsers convert XML into Java - not the other way around. A program to convert Java code into XML would not be an XML parser. Bill

A program to convert Java code into XML would not be an XML parser.... Then what would it be called and how is it done. I want to be able to write Java that will become XML with different Schemas there is not a set one. My code should be able to be used for many types of schemas. Thanks, mpap