Class Factory

    • Field Detail

      • xmlFile

        protected String xmlFile
      • packageName

        protected String packageName
      • encoding

        protected String encoding
      • encodingTag

        protected String encodingTag
      • dtdFileName

        protected String dtdFileName
      • dtdPublicId

        protected String dtdPublicId
      • xsdFileName

        protected String xsdFileName
      • xsdNamespaceURI

        protected String xsdNamespaceURI
      • importedFileHashtable

        protected Hashtable importedFileHashtable
    • Constructor Detail

      • Factory

        public Factory()
    • Method Detail

      • setPackageName

        public void setPackageName​(String packageName)
        Set the name of the Java package
      • getPackageName

        public String getPackageName()
        Get the name of the Java package
      • setXMLFilename

        public void setXMLFilename​(String filename)
        Set the name of the XML instance document
      • getXMLFilename

        public String getXMLFilename()
        Get the name of the XML instance document
      • setEncoding

        public void setEncoding​(String encoding)
        Set the encoding that will be used to output the xml document
        Parameters:
        encoding - the encoding value for the OutputStreamWriter
      • getEncoding

        public String getEncoding()
        Get the encoding that will be used to output the xml document
      • setEncodingTag

        public void setEncodingTag​(String encodingTag)
        Set the IANA value to be used in the XML declaration
        Parameters:
        encodingTag - the encoding tag to be used in the XML declaration
      • getEncodingTag

        public String getEncodingTag​(String encodingTag)
        Get the IANA value to be used in the XML declaration
      • setDTDFileName

        public void setDTDFileName​(String dtdFilename)
        Set the DTD file name so that a DOCTYPE will be generated If this is set, the XSD filename should not be set.
      • getDTDFileName

        public String getDTDFileName()
        Get the DTD file name
      • setPublicId

        public void setPublicId​(String publicId)
        Set the public identifier in the DOCTYPE
      • getPublicId

        public String getPublicId()
        Get the public identifier in the DOCTYPE
      • setXSDFileName

        public void setXSDFileName​(String xsdFilename)
        Set the XSD file name. If this is set, the DTD filename should not be set
      • getXSDFileName

        public String getXSDFileName()
        Get the XSD file name
      • setNamespaceURI

        public void setNamespaceURI​(String namespaceURI)
        Set the namespace URI for this XSD file.
      • getNamespaceURI

        public String getNamespaceURI()
        Get the namespace URI
      • addImportedFileInfo

        public void addImportedFileInfo​(String filename,
                                        String nsprefix,
                                        String nsURI)
        Store the prefix and the namespace information for each imported file
        Parameters:
        filename - The filename for the imported schema
        nsprefix - The prefix for the imported schemar
        nsURI - The namespace URI for the imported schema
      • loadDocument

        public BaseType loadDocument​(String classname,
                                     String xmlFile)
        Load an existing instance document
      • loadDocument

        public BaseType loadDocument​(String classname,
                                     String xmlFile,
                                     boolean validate)
      • loadDocument

        public BaseType loadDocument​(String classname,
                                     InputSource source)
        Load an existing instance document from an InputSource
      • loadDocument

        public BaseType loadDocument​(String classname,
                                     Element element)
        Load an existing instance document from an Element.
      • save

        public void save​(String filename)
        Save the DOM to the specified file name
      • save

        public void save()
        Save the DOM to disk
      • createRootDOMFromComplexType

        public ComplexType createRootDOMFromComplexType​(String classname,
                                                        String rootElementName)
        Create a new root element from a complex type
        Parameters:
        classname - - the name of the Java class that corresponds to the root element
        rootElementName - - the root element name, it might contain a prefix e.g. po:purchaseOrder or purchaseOrder
        Returns:
        ComplexType a Java bean that extends the ComplexType class
      • createRootDOMFromSimpleType

        public SimpleType createRootDOMFromSimpleType​(String classname,
                                                      String rootElementName)
        Create a new root element from a simple type
        Parameters:
        classname - - the name of the Java class that corresponds to the root element
        rootElementName - - the root element name, it might contain a prefix e.g. po:purchaseOrder or purchaseOrder
        Returns:
        SimpleType a Java bean that extends the SimpleType class
      • createDOMElementFromComplexType

        public ComplexType createDOMElementFromComplexType​(String classname,
                                                           String elementName)
        Create a new DOM element and the corresponding Java bean. Called by the generated Factory class.
        Parameters:
        classname - The name of the Java bean that corresponds to this element
        elementName - The name of the element
        Returns:
        ComplexType A Java bean that extends the ComplexType class
      • createDOMElementFromSimpleType

        public SimpleType createDOMElementFromSimpleType​(String classname,
                                                         String elementName)
        Create a new DOM element and the corresponding Java bean. Called by the generated Factory class.
        Parameters:
        classname - The name of the Java bean that corresponds to this element
        elementName - The name of the element
        Returns:
        SimpleType A Java bean that extends the ComplexType class
      • newInstance

        protected BaseType newInstance​(Node node,
                                       String className)
        Create a new Java object for the input Node
        Parameters:
        node - - can be an element or an attribute
        className - - the corresponding Java class name
      • createXMLElementAndText

        protected Element createXMLElementAndText​(String elementName,
                                                  String elementValue)
        Create a new element and its text node
        Parameters:
        elementName - - the name of the new element
        elementValue - - the value of the new element
      • createAttribute

        protected Attr createAttribute​(String name,
                                       Element parentElement)
        Create a new attribute and add it to the parent element
      • createText

        protected Text createText​(Element parentElement,
                                  String value)
        Create a new Text node and add it to the parent element