org.eclipse.persistence.sdo
Class SDOXMLDocument
java.lang.Object
org.eclipse.persistence.oxm.XMLRoot
org.eclipse.persistence.sdo.SDOXMLDocument
- All Implemented Interfaces:
- XMLDocument
public class SDOXMLDocument
- extends XMLRoot
- implements XMLDocument
Purpose: Represents an XML Document containing a tree of DataObjects.
An example XMLDocument fragment is:
created from this XML Schema fragment:
Upon loading this XMLDocument:
DataObject is an instance of Type PurchaseOrderType.
RootElementURI is null because the XSD has no targetNamespace URI.
RootElementName is purchaseOrder.
Encoding is null because the document did not specify an encoding.
XMLDeclaration is true because the document contained an XML declaration.
XMLVersion is 1.0
SchemaLocation and noNamespaceSchemaLocation are null because they are
not specified in the document.
When saving the root element, if the type of the root dataObject is not the
type of global element specified by rootElementURI and rootElementName,
or if a global element does not exist for rootElementURI and rootElementName,
then an xsi:type declaration is written to record the root DataObject's Type.
When loading the root element and an xsi:type declaration is found
it is used as the type of the root DataObject. In this case,
if validation is not being performed, it is not an error if the
rootElementName is not a global element.
Method Summary |
java.lang.String |
getEncoding()
Return the XML encoding of the document, or null if not specified. |
NamespaceResolver |
getNamespaceResolver()
INTERNAL:
Return the namespaceResolver to be used with this document. |
java.lang.String |
getNoNamespaceSchemaLocation()
Return the value of the noNamespaceSchemaLocation declaration
for the http://www.w3.org/2001/XMLSchema-instance namespace in the
root element, or null if not present. |
java.lang.String |
getRootElementName()
Return the name of the root element. |
java.lang.String |
getRootElementURI()
Return the targetNamespace URI for the root element. |
DataObject |
getRootObject()
Return the root DataObject for the XMLDocument. |
java.lang.String |
getSchemaLocation()
Return the value of the schemaLocation declaration
for the http://www.w3.org/2001/XMLSchema-instance namespace in the
root element, or null if not present. |
java.lang.String |
getXMLVersion()
Return the XML version of the document, or null if not specified. |
boolean |
isXMLDeclaration()
Return the XML declaration of the document. |
void |
setEncoding(java.lang.String encoding)
Set the XML encoding of the document, or null if not specified. |
void |
setNamespaceResolver(NamespaceResolver namespaceResolver)
INTERNAL:
Set the namespaceresolver of the document |
void |
setNoNamespaceSchemaLocation(java.lang.String schemaLocation)
Sets the value of the noNamespaceSchemaLocation declaration
for the http://www.w3.org/2001/XMLSchema-instance namespace in the
root element, or null if it should not be present. |
void |
setRootElementName(java.lang.String rootElementName)
INTERNAL:
Set the root element name of the document |
void |
setRootElementURI(java.lang.String rootElementUri)
INTERNAL:
Set the root element uri of the document |
void |
setRootObject(DataObject rootObject)
INTERNAL:
Set the root data object corresponding to the document |
void |
setSchemaLocation(java.lang.String schemaLocation)
Sets the value of the schemaLocation declaration
for the http://www.w3.org/2001/XMLSchema-instance namespace in the
root element, or null if it should not be present. |
void |
setXMLDeclaration(boolean xmlDeclaration)
Set the XML declaration version of the document. |
void |
setXMLVersion(java.lang.String xmlVersion)
Set the XML version of the document, or null if not specified. |
Methods inherited from class org.eclipse.persistence.oxm.XMLRoot |
getDeclaredType, getLocalName, getNamespaceURI, getObject, getRootFragment, getSchemaType, isNil, setDeclaredType, setLocalName, setNamespaceURI, setNil, setObject, setSchemaType, setVersion |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_XML_ENCODING
public static final java.lang.String DEFAULT_XML_ENCODING
- See Also:
- Constant Field Values
DEFAULT_XML_VERSION
public static final java.lang.String DEFAULT_XML_VERSION
- See Also:
- Constant Field Values
SDOXMLDocument
public SDOXMLDocument()
getRootObject
public DataObject getRootObject()
- Return the root DataObject for the XMLDocument.
- Specified by:
getRootObject
in interface XMLDocument
- Returns:
- root DataObject for the XMLDocument.
getRootElementURI
public java.lang.String getRootElementURI()
- Return the targetNamespace URI for the root element.
If there is no targetNamespace URI, the value is null.
The root element is a global element of the XML Schema
with a type compatible to the DataObject.
- Specified by:
getRootElementURI
in interface XMLDocument
- Returns:
- the targetNamespace URI for the root element.
getRootElementName
public java.lang.String getRootElementName()
- Return the name of the root element.
The root element is a global element of the XML Schema
with a type compatible to the DataObject.
- Specified by:
getRootElementName
in interface XMLDocument
- Returns:
- the name of the root element.
getEncoding
public java.lang.String getEncoding()
- Return the XML encoding of the document, or null if not specified.
The default value is "UTF-8".
Specification of other values is implementation-dependent.
- Specified by:
getEncoding
in interface XMLDocument
- Overrides:
getEncoding
in class XMLRoot
- Returns:
- the XML encoding of the document, or null if not specified.
setEncoding
public void setEncoding(java.lang.String encoding)
- Set the XML encoding of the document, or null if not specified.
- Specified by:
setEncoding
in interface XMLDocument
- Overrides:
setEncoding
in class XMLRoot
- Parameters:
encoding
-
isXMLDeclaration
public boolean isXMLDeclaration()
- Return the XML declaration of the document. If true,
XMLHelper save() will produce a declaration of the form:
Encoding will be suppressed if getEncoding() is null.
The default value is true.
- Specified by:
isXMLDeclaration
in interface XMLDocument
- Returns:
- the XML declaration of the document.
setXMLDeclaration
public void setXMLDeclaration(boolean xmlDeclaration)
- Set the XML declaration version of the document.
- Specified by:
setXMLDeclaration
in interface XMLDocument
- Parameters:
xmlDeclaration
- the XML declaration version of the document.
getXMLVersion
public java.lang.String getXMLVersion()
- Return the XML version of the document, or null if not specified.
The default value is "1.0".
Specification of other values is implementation-dependent.
- Specified by:
getXMLVersion
in interface XMLDocument
- Overrides:
getXMLVersion
in class XMLRoot
- Returns:
- the XML version of the document, or null if not specified.
setXMLVersion
public void setXMLVersion(java.lang.String xmlVersion)
- Set the XML version of the document, or null if not specified.
- Specified by:
setXMLVersion
in interface XMLDocument
- Parameters:
xmlVersion
- the XML version of the document, or null if not specified.
getSchemaLocation
public java.lang.String getSchemaLocation()
- Return the value of the schemaLocation declaration
for the http://www.w3.org/2001/XMLSchema-instance namespace in the
root element, or null if not present.
- Specified by:
getSchemaLocation
in interface XMLDocument
- Overrides:
getSchemaLocation
in class XMLRoot
- Returns:
- the value of the schemaLocation declaration,
or null if not present.
setSchemaLocation
public void setSchemaLocation(java.lang.String schemaLocation)
- Sets the value of the schemaLocation declaration
for the http://www.w3.org/2001/XMLSchema-instance namespace in the
root element, or null if it should not be present.
- Specified by:
setSchemaLocation
in interface XMLDocument
- Overrides:
setSchemaLocation
in class XMLRoot
- Parameters:
schemaLocation
- the value of the schemaLocation declaration, or null.
getNoNamespaceSchemaLocation
public java.lang.String getNoNamespaceSchemaLocation()
- Return the value of the noNamespaceSchemaLocation declaration
for the http://www.w3.org/2001/XMLSchema-instance namespace in the
root element, or null if not present.
- Specified by:
getNoNamespaceSchemaLocation
in interface XMLDocument
- Overrides:
getNoNamespaceSchemaLocation
in class XMLRoot
- Returns:
- the value of the noNamespaceSchemaLocation declaration,
or null if not present.
setNoNamespaceSchemaLocation
public void setNoNamespaceSchemaLocation(java.lang.String schemaLocation)
- Sets the value of the noNamespaceSchemaLocation declaration
for the http://www.w3.org/2001/XMLSchema-instance namespace in the
root element, or null if it should not be present.
- Specified by:
setNoNamespaceSchemaLocation
in interface XMLDocument
- Overrides:
setNoNamespaceSchemaLocation
in class XMLRoot
- Parameters:
schemaLocation
- the value of the noNamespaceSchemaLocation declaration, or null.
setRootObject
public void setRootObject(DataObject rootObject)
- INTERNAL:
Set the root data object corresponding to the document
- Parameters:
rootObject
- the root DataObject corresponding to the document
setRootElementName
public void setRootElementName(java.lang.String rootElementName)
- INTERNAL:
Set the root element name of the document
- Parameters:
rootElementName
- the root element name of the document
setRootElementURI
public void setRootElementURI(java.lang.String rootElementUri)
- INTERNAL:
Set the root element uri of the document
- Parameters:
rootElementURI
- the root element uri of the document
setNamespaceResolver
public void setNamespaceResolver(NamespaceResolver namespaceResolver)
- INTERNAL:
Set the namespaceresolver of the document
- Parameters:
namespaceResolver
- the namespaceResolver to be used with the document
getNamespaceResolver
public NamespaceResolver getNamespaceResolver()
- INTERNAL:
Return the namespaceResolver to be used with this document.
- Returns:
- the value of the namespaceResolver being used with this document