- All Implemented Interfaces:
XMLDocument
Purpose: Represents an XML Document containing a tree of DataObjects.
An example XMLDocument fragment is:
<?xml version="1.0"?>
<purchaseOrder orderDate="1999-10-20">
created from this XML Schema fragment:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="purchaseOrder" type="PurchaseOrderType"/>
<xsd:complexType name="PurchaseOrderType">
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.
-
Field Summary
FieldsFields inherited from class org.eclipse.persistence.internal.oxm.Root
declaredType, encoding, localName, namespaceUri, nil, noNamespaceSchemaLocation, prefix, rootObject, schemaLocation, schemaType, xmlVersion -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn the XML encoding of the document, or null if not specified.org.eclipse.persistence.oxm.NamespaceResolverINTERNAL: Return the namespaceResolver to be used with this document.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.Return the name of the root element.Return the targetNamespace URI for the root element.Return the root DataObject for the XMLDocument.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.Return the XML version of the document, or null if not specified.booleanReturn the XML declaration of the document.voidsetEncoding(String encoding) Set the XML encoding of the document, or null if not specified.voidsetNamespaceResolver(org.eclipse.persistence.oxm.NamespaceResolver namespaceResolver) INTERNAL: Set the namespaceresolver of the documentvoidsetNoNamespaceSchemaLocation(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.voidsetRootElementName(String rootElementName) INTERNAL: Set the root element name of the documentvoidsetRootElementURI(String rootElementUri) INTERNAL: Set the root element uri of the documentvoidsetRootObject(DataObject rootObject) INTERNAL: Set the root data object corresponding to the documentvoidsetSchemaLocation(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.voidsetXMLDeclaration(boolean xmlDeclaration) Set the XML declaration version of the document.voidsetXMLVersion(String xmlVersion) Set the XML version of the document, or null if not specified.Methods inherited from class org.eclipse.persistence.internal.oxm.Root
equals, getDeclaredType, getLocalName, getNamespaceURI, getObject, getSchemaType, hashCode, isNil, setDeclaredType, setLocalName, setNamespaceURI, setNil, setObject, setSchemaType, setVersion
-
Field Details
-
DEFAULT_XML_ENCODING
- See Also:
-
DEFAULT_XML_VERSION
- See Also:
-
-
Constructor Details
-
SDOXMLDocument
public SDOXMLDocument()
-
-
Method Details
-
getRootObject
Return the root DataObject for the XMLDocument.- Specified by:
getRootObjectin interfaceXMLDocument- Returns:
- root DataObject for the XMLDocument.
-
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:
getRootElementURIin interfaceXMLDocument- Returns:
- the targetNamespace URI for the root element.
-
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:
getRootElementNamein interfaceXMLDocument- Returns:
- the name of the root element.
-
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:
getEncodingin interfaceXMLDocument- Overrides:
getEncodingin classorg.eclipse.persistence.internal.oxm.Root- Returns:
- the XML encoding of the document, or null if not specified.
-
setEncoding
Set the XML encoding of the document, or null if not specified.- Specified by:
setEncodingin interfaceXMLDocument- Overrides:
setEncodingin classorg.eclipse.persistence.internal.oxm.Root- Parameters:
encoding-
-
isXMLDeclaration
public boolean isXMLDeclaration()Return the XML declaration of the document. If true, XMLHelper save() will produce a declaration of the form: <?xml version="1.0" encoding="UTF-8"?> Encoding will be suppressed if getEncoding() is null. The default value is true.- Specified by:
isXMLDeclarationin interfaceXMLDocument- Returns:
- the XML declaration of the document.
-
setXMLDeclaration
public void setXMLDeclaration(boolean xmlDeclaration) Set the XML declaration version of the document.- Specified by:
setXMLDeclarationin interfaceXMLDocument- Parameters:
xmlDeclaration- the XML declaration version of the document.
-
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:
getXMLVersionin interfaceXMLDocument- Overrides:
getXMLVersionin classorg.eclipse.persistence.internal.oxm.Root- Returns:
- the XML version of the document, or null if not specified.
-
setXMLVersion
Set the XML version of the document, or null if not specified.- Specified by:
setXMLVersionin interfaceXMLDocument- Parameters:
xmlVersion- the XML version of the document, or null if not specified.
-
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:
getSchemaLocationin interfaceXMLDocument- Overrides:
getSchemaLocationin classorg.eclipse.persistence.internal.oxm.Root- Returns:
- the value of the schemaLocation declaration, or null if not present.
-
setSchemaLocation
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:
setSchemaLocationin interfaceXMLDocument- Overrides:
setSchemaLocationin classorg.eclipse.persistence.internal.oxm.Root- Parameters:
schemaLocation- the value of the schemaLocation declaration, or null.
-
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:
getNoNamespaceSchemaLocationin interfaceXMLDocument- Overrides:
getNoNamespaceSchemaLocationin classorg.eclipse.persistence.internal.oxm.Root- Returns:
- the value of the noNamespaceSchemaLocation declaration, or null if not present.
-
setNoNamespaceSchemaLocation
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:
setNoNamespaceSchemaLocationin interfaceXMLDocument- Overrides:
setNoNamespaceSchemaLocationin classorg.eclipse.persistence.internal.oxm.Root- Parameters:
schemaLocation- the value of the noNamespaceSchemaLocation declaration, or null.
-
setRootObject
INTERNAL: Set the root data object corresponding to the document- Parameters:
rootObject- the root DataObject corresponding to the document
-
setRootElementName
INTERNAL: Set the root element name of the document- Parameters:
rootElementName- the root element name of the document
-
setRootElementURI
INTERNAL: Set the root element uri of the document- Parameters:
rootElementUri- the root element uri of the document
-
setNamespaceResolver
public void setNamespaceResolver(org.eclipse.persistence.oxm.NamespaceResolver namespaceResolver) INTERNAL: Set the namespaceresolver of the document- Parameters:
namespaceResolver- the namespaceResolver to be used with the document
-
getNamespaceResolver
public org.eclipse.persistence.oxm.NamespaceResolver getNamespaceResolver()INTERNAL: Return the namespaceResolver to be used with this document.- Returns:
- the value of the namespaceResolver being used with this document
-