XML & Web services: Difference between XML parser and binder
- Posted by: A JP
- Posted on: August 14 2002 15:38 EDT
1. What is the difference between XML parser and binder.
2. My understanding is, a XML document is necessary for a parser to process. Can the parser be used to create a XML file. Am I right ???
3. This is my understanding too. A binder is a higher level which inturn has a parser. A binder could also work as a parser. Is it true ??
Do throw some light on this.
I hope this helps.
1. XML parser is used to parse ( basically read or write ) an xml document
2. The read / write can also be done using a xml binder .
In case of parsers it works more like a file reader , reading a file like a stream etc.
In case of binder, based on the xml file, binder creates java objects for the xml nodes and then u use these java objects to get / set values of the nodes in xml file.
Can you point me to some tutorials on using binding? When you say I'll have a set of objects containing the values of the entities, what do these objects look like? How does one get their value? Newbie to binding, here, and I'd like to have a basic idea of what i'm getting into before i get into it.
Currently, I'm parsing an xml document with DOM and putting the values into a hashtable. It'd be nice to have java take care of this variable-making for me, and it sounds like that's what using a binder will do.
thanks so much.
What you are attempting to do can probably be acheived better using Java's JAXB Architecture. Basically JAXB uses the XML DTD or Schema to create a set of classes that represent the nodes in the XML hierarchy.
IMHO It works very nicely.
For more info see http://java.sun.com/xml/jaxb/