1. We can use DTD or XSD files for providing the information for about the xml tags that has to be used in our xml files.
  2. To read the information from an xml document, xml parsers like SAX(Simple API for XML parsing) and DOM(Document Object Model) can be used.
  3. SAX,DOM parsers are provided as part of JAXP(java API for xml processing).
  4. To read an XML document,we can use JAXP directly or we can use the solutions like XML Beans,JAXB.
  5. XML Beans,JAXB internally uses JAXP.

Schema Compiler:

Schema compiler reads the information in XSD files and generates the classes and interfaces.

Steps to generate classes and interfaces from XSD using schema compiler.

  1. Download the current xml beans(xmlbeans-2.6.0.zip).
  2. Create a directory (E:\xml) and copy the downloaded ZIP file.
  3. Use cd command and move to the directory created in step 2.
  4. Extract the content of ZIP file using the command jar xf xmlbeans-2.6.0.zip
  5. A directory with the name xmlbeans-2.6.0 will be created and all the files related to xml beans will be copied.
  6. Create the classes,source directories under E:\xml>
  7. Run the following 2 commands.
  8. E:\xml>set PATH=E:\xml\xmlbeans-2.6.0\xmlbeans-2.6.0\bin;
    E:\xml>set CLASSPATH=classes;E:\xml\xmlbeans-2.6.0\xmlbeans-2.6.0\lib\xbean.jar

  9. Copy the XSD file under E:\xml and run the following command.
  10. E:\xml>scomp -d classes -src source customer.xsd