public class Factory extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
protected Document |
document |
protected String |
dtdFileName |
protected String |
dtdPublicId |
protected String |
encoding |
protected String |
encodingTag |
protected Hashtable |
importedFileHashtable |
protected String |
packageName |
protected String |
xmlFile |
protected String |
xsdFileName |
protected String |
xsdNamespaceURI |
| Constructor and Description |
|---|
Factory() |
| Modifier and Type | Method and Description |
|---|---|
void |
addImportedFileInfo(String filename,
String nsprefix,
String nsURI)
Store the prefix and the namespace information for each imported file
|
protected Attr |
createAttribute(String name,
Element parentElement)
Create a new attribute and add it to the parent element
|
ComplexType |
createDOMElementFromComplexType(String classname,
String elementName)
Create a new DOM element and the corresponding Java bean.
|
SimpleType |
createDOMElementFromSimpleType(String classname,
String elementName)
Create a new DOM element and the corresponding Java bean.
|
ComplexType |
createRootDOMFromComplexType(String classname,
String rootElementName)
Create a new root element from a complex type
|
SimpleType |
createRootDOMFromSimpleType(String classname,
String rootElementName)
Create a new root element from a simple type
|
protected Text |
createText(Element parentElement,
String value)
Create a new Text node and add it to the parent element
|
protected Element |
createXMLElementAndText(String elementName,
String elementValue)
Create a new element and its text node
|
String |
getDTDFileName()
Get the DTD file name
|
String |
getEncoding()
Get the encoding that will be used to output the xml document
|
String |
getEncodingTag(String encodingTag)
Get the IANA value to be used in the XML declaration
|
String |
getNamespaceURI()
Get the namespace URI
|
String |
getPackageName()
Get the name of the Java package
|
String |
getPublicId()
Get the public identifier in the DOCTYPE
|
String |
getXMLFilename()
Get the name of the XML instance document
|
String |
getXSDFileName()
Get the XSD file name
|
BaseType |
loadDocument(String classname,
Element element)
Load an existing instance document from an Element.
|
BaseType |
loadDocument(String classname,
InputSource source)
Load an existing instance document from an InputSource
|
BaseType |
loadDocument(String classname,
InputSource source,
boolean validate) |
BaseType |
loadDocument(String classname,
String xmlFile)
Load an existing instance document
|
BaseType |
loadDocument(String classname,
String xmlFile,
boolean validate) |
protected BaseType |
newInstance(Node node,
String className)
Create a new Java object for the input Node
|
void |
print(PrintWriter writer,
String prefix) |
void |
save()
Save the DOM to disk
|
void |
save(String filename)
Save the DOM to the specified file name
|
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.
|
void |
setEncoding(String encoding)
Set the encoding that will be used to output the xml document
|
void |
setEncodingTag(String encodingTag)
Set the IANA value to be used in the XML declaration
|
void |
setNamespaceURI(String namespaceURI)
Set the namespace URI for this XSD file.
|
void |
setPackageName(String packageName)
Set the name of the Java package
|
void |
setPublicId(String publicId)
Set the public identifier in the DOCTYPE
|
void |
setXMLFilename(String filename)
Set the name of the XML instance document
|
void |
setXSDFileName(String xsdFilename)
Set the XSD file name.
|
protected String xmlFile
protected String packageName
protected Document document
protected String encoding
protected String encodingTag
protected String dtdFileName
protected String dtdPublicId
protected String xsdFileName
protected String xsdNamespaceURI
protected Hashtable importedFileHashtable
public void setPackageName(String packageName)
public String getPackageName()
public void setXMLFilename(String filename)
public String getXMLFilename()
public void setEncoding(String encoding)
encoding - the encoding value for the OutputStreamWriterpublic String getEncoding()
public void setEncodingTag(String encodingTag)
encodingTag - the encoding tag to be used in the XML declarationpublic String getEncodingTag(String encodingTag)
public void setDTDFileName(String dtdFilename)
public String getDTDFileName()
public void setPublicId(String publicId)
public String getPublicId()
public void setXSDFileName(String xsdFilename)
public String getXSDFileName()
public void setNamespaceURI(String namespaceURI)
public String getNamespaceURI()
public void addImportedFileInfo(String filename, String nsprefix, String nsURI)
filename - The filename for the imported schemansprefix - The prefix for the imported schemarnsURI - The namespace URI for the imported schemapublic BaseType loadDocument(String classname, String xmlFile)
public BaseType loadDocument(String classname, InputSource source)
public BaseType loadDocument(String classname, InputSource source, boolean validate)
public BaseType loadDocument(String classname, Element element)
public void save(String filename)
public void print(PrintWriter writer, String prefix)
public void save()
public ComplexType createRootDOMFromComplexType(String classname, String rootElementName)
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 purchaseOrderpublic SimpleType createRootDOMFromSimpleType(String classname, String rootElementName)
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 purchaseOrderpublic ComplexType createDOMElementFromComplexType(String classname, String elementName)
classname - The name of the Java bean that corresponds to this elementelementName - The name of the elementpublic SimpleType createDOMElementFromSimpleType(String classname, String elementName)
classname - The name of the Java bean that corresponds to this elementelementName - The name of the elementprotected BaseType newInstance(Node node, String className)
node - - can be an element or an attributeclassName - - the corresponding Java class nameprotected Element createXMLElementAndText(String elementName, String elementValue)
elementName - - the name of the new elementelementValue - - the value of the new elementprotected Attr createAttribute(String name, Element parentElement)
Copyright © 2017–2019 Eclipse Foundation. All rights reserved.