Class Factory
- java.lang.Object
-
- com.sun.xml.rpc.processor.modeler.j2ee.xml.Factory
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
javaWsdlMappingFactory
public class Factory extends Object implements Serializable
This factory class creates/loads Java bean and the corresponding DOM node. The generated factory code extends this class.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Documentdocumentprotected StringdtdFileNameprotected StringdtdPublicIdprotected Stringencodingprotected StringencodingTagprotected HashtableimportedFileHashtableprotected StringpackageNameprotected StringxmlFileprotected StringxsdFileNameprotected StringxsdNamespaceURI
-
Constructor Summary
Constructors Constructor Description Factory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddImportedFileInfo(String filename, String nsprefix, String nsURI)Store the prefix and the namespace information for each imported fileprotected AttrcreateAttribute(String name, Element parentElement)Create a new attribute and add it to the parent elementComplexTypecreateDOMElementFromComplexType(String classname, String elementName)Create a new DOM element and the corresponding Java bean.SimpleTypecreateDOMElementFromSimpleType(String classname, String elementName)Create a new DOM element and the corresponding Java bean.ComplexTypecreateRootDOMFromComplexType(String classname, String rootElementName)Create a new root element from a complex typeSimpleTypecreateRootDOMFromSimpleType(String classname, String rootElementName)Create a new root element from a simple typeprotected TextcreateText(Element parentElement, String value)Create a new Text node and add it to the parent elementprotected ElementcreateXMLElementAndText(String elementName, String elementValue)Create a new element and its text nodeStringgetDTDFileName()Get the DTD file nameStringgetEncoding()Get the encoding that will be used to output the xml documentStringgetEncodingTag(String encodingTag)Get the IANA value to be used in the XML declarationStringgetNamespaceURI()Get the namespace URIStringgetPackageName()Get the name of the Java packageStringgetPublicId()Get the public identifier in the DOCTYPEStringgetXMLFilename()Get the name of the XML instance documentStringgetXSDFileName()Get the XSD file nameBaseTypeloadDocument(String classname, String xmlFile)Load an existing instance documentBaseTypeloadDocument(String classname, String xmlFile, boolean validate)BaseTypeloadDocument(String classname, Element element)Load an existing instance document from an Element.BaseTypeloadDocument(String classname, InputSource source)Load an existing instance document from an InputSourceBaseTypeloadDocument(String classname, InputSource source, boolean validate)protected BaseTypenewInstance(Node node, String className)Create a new Java object for the input Nodevoidprint(PrintWriter writer, String prefix)voidsave()Save the DOM to diskvoidsave(String filename)Save the DOM to the specified file namevoidsetDTDFileName(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.voidsetEncoding(String encoding)Set the encoding that will be used to output the xml documentvoidsetEncodingTag(String encodingTag)Set the IANA value to be used in the XML declarationvoidsetNamespaceURI(String namespaceURI)Set the namespace URI for this XSD file.voidsetPackageName(String packageName)Set the name of the Java packagevoidsetPublicId(String publicId)Set the public identifier in the DOCTYPEvoidsetXMLFilename(String filename)Set the name of the XML instance documentvoidsetXSDFileName(String xsdFilename)Set the XSD file name.
-
-
-
Field Detail
-
xmlFile
protected String xmlFile
-
packageName
protected String packageName
-
document
protected Document document
-
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
-
-
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 schemansprefix- The prefix for the imported schemarnsURI- 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, InputSource source)
Load an existing instance document from an InputSource
-
loadDocument
public BaseType loadDocument(String classname, InputSource source, boolean validate)
-
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
-
print
public void print(PrintWriter writer, String prefix)
-
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 elementrootElementName- - 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 elementrootElementName- - 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 elementelementName- 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 elementelementName- 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 attributeclassName- - 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 elementelementValue- - 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
-
-