Save This Page
Home » xmlbeans-2.4.0-src » org.apache.xmlbeans.samples.substitutiongroup » [javadoc | source]
org.apache.xmlbeans.samples.substitutiongroup
public class: SubstitutionGroup [javadoc | source]
java.lang.Object
   org.apache.xmlbeans.samples.substitutiongroup.SubstitutionGroup
This sample illustrates how you can access substitution group element names and values defined in the XML document. This sample also demonstrates how to write substitution group elements. The schema used by this sample are defined in EasyPo.xsd
Method from org.apache.xmlbeans.samples.substitutiongroup.SubstitutionGroup Summary:
createDocument,   main,   parseXml,   printComments,   validateXml
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.xmlbeans.samples.substitutiongroup.SubstitutionGroup Detail:
 public PurchaseOrderDocument createDocument(PurchaseOrderDocument poDoc,
    String file) 
    This method creates an new invoice-header element and attaches to the existing XML Instance, and saves the new Instance to a file(args[1]).
 public static  void main(String[] args) 
    Receives an XML Instance and prints the substitution group element names and values, Also creates a new XML Instance.
 public PurchaseOrderDocument parseXml(String file) 
 public  void printComments(PurchaseOrderDocument poDoc) 
    This method prints the substitution group element names(local part) and values for each Invoice-header element in the XML Instance. (The rest of elements are ignored for the sake of simplicity)
 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.