Home » xmlbeans-2.5.0-src » org.apache.xmlbeans.samples » xsdconfig » [javadoc | source]
org.apache.xmlbeans.samples.xsdconfig
public class: CatalogXsd [javadoc | source]
java.lang.Object
   org.apache.xmlbeans.samples.xsdconfig.CatalogXsd
Method from org.apache.xmlbeans.samples.xsdconfig.CatalogXsd Summary:
main,   parseXml,   printElements,   validateXml
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.xmlbeans.samples.xsdconfig.CatalogXsd Detail:
 public static  void main(String[] args) 
 public CatalogDocument parseXml(String xmlFilePath) 
    Creates a File from the XML path provided in main arguments, then parses the file's contents into a type (CatalogDocument) generated from schema.
 public  void printElements(CatalogDocument catdoc) 
    This method prints all the element values in the given XML document based on Catalog.xsd
 public static boolean validateXml(XmlObject xml) 

    Validates the XML, printing error messages when the XML is invalid. Note that this method will properly validate any instance of a compiled schema type because all of these types extend XmlObject.

    Note that in actual practice, you'll probably want to use an assertion when validating if you want to ensure that your code doesn't pass along invalid XML. This sample prints the generated XML whether or not it's valid so that you can see the result in both cases.