org.apache.tuscany.sdo.helper
Class XMLDocumentImpl

java.lang.Object
  extended by org.apache.tuscany.sdo.helper.XMLDocumentImpl
All Implemented Interfaces:
commonj.sdo.helper.XMLDocument

public class XMLDocumentImpl
extends java.lang.Object
implements commonj.sdo.helper.XMLDocument

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.


Field Summary
protected  org.eclipse.emf.ecore.EObject documentRoot
           
protected  org.eclipse.emf.ecore.util.ExtendedMetaData extendedMetaData
           
protected  org.eclipse.emf.ecore.xmi.XMLResource resource
           
protected  org.eclipse.emf.ecore.EStructuralFeature rootElement
           
protected  org.eclipse.emf.ecore.EObject rootObject
           
protected static java.lang.String WHITESPACE_REGEX
           
 
Constructor Summary
protected XMLDocumentImpl(org.eclipse.emf.ecore.util.ExtendedMetaData extendedMetaData)
           
protected XMLDocumentImpl(org.eclipse.emf.ecore.util.ExtendedMetaData extendedMetaData, commonj.sdo.DataObject dataObject, java.lang.String rootElementURI, java.lang.String rootElementName)
           
protected XMLDocumentImpl(org.eclipse.emf.ecore.util.ExtendedMetaData extendedMetaData, java.lang.Object options)
           
 
Method Summary
protected  java.lang.String deresolve(java.lang.String value)
           
 java.lang.String getEncoding()
           
 java.lang.String getNoNamespaceSchemaLocation()
           
 java.lang.String getRootElementName()
           
 java.lang.String getRootElementURI()
           
 commonj.sdo.DataObject getRootObject()
           
 java.lang.String getSchemaLocation()
           
protected  org.eclipse.emf.common.util.EMap getSchemaLocationMap()
           
 java.lang.String getXMLVersion()
           
 boolean isXMLDeclaration()
           
protected  void load(org.xml.sax.InputSource inputSource, java.lang.String locationURI, java.lang.Object options)
           
protected  void load(java.io.InputStream inputStream, java.lang.String locationURI, java.lang.Object options)
           
protected  void load(java.io.Reader inputReader, java.lang.String locationURI, java.lang.Object options)
           
protected  void load(javax.xml.stream.XMLStreamReader reader)
           
protected  java.lang.String resolve(java.lang.String value)
           
protected  void save(java.io.OutputStream outputStream, java.lang.Object options)
           
protected  void save(java.io.Writer outputWriter, java.lang.Object options)
           
 void setEncoding(java.lang.String encoding)
           
 void setNoNamespaceSchemaLocation(java.lang.String schemaLocation)
           
 void setSchemaLocation(java.lang.String schemaLocation)
           
 void setXMLDeclaration(boolean xmlDeclaration)
           
 void setXMLVersion(java.lang.String xmlVersion)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

extendedMetaData

protected org.eclipse.emf.ecore.util.ExtendedMetaData extendedMetaData

rootObject

protected org.eclipse.emf.ecore.EObject rootObject

resource

protected org.eclipse.emf.ecore.xmi.XMLResource resource

rootElement

protected org.eclipse.emf.ecore.EStructuralFeature rootElement

documentRoot

protected org.eclipse.emf.ecore.EObject documentRoot

WHITESPACE_REGEX

protected static final java.lang.String WHITESPACE_REGEX
See Also:
Constant Field Values
Constructor Detail

XMLDocumentImpl

protected XMLDocumentImpl(org.eclipse.emf.ecore.util.ExtendedMetaData extendedMetaData,
                          java.lang.Object options)

XMLDocumentImpl

protected XMLDocumentImpl(org.eclipse.emf.ecore.util.ExtendedMetaData extendedMetaData)

XMLDocumentImpl

protected XMLDocumentImpl(org.eclipse.emf.ecore.util.ExtendedMetaData extendedMetaData,
                          commonj.sdo.DataObject dataObject,
                          java.lang.String rootElementURI,
                          java.lang.String rootElementName)
Method Detail

save

protected void save(java.io.OutputStream outputStream,
                    java.lang.Object options)
             throws java.io.IOException
Throws:
java.io.IOException

save

protected void save(java.io.Writer outputWriter,
                    java.lang.Object options)
             throws java.io.IOException
Throws:
java.io.IOException

load

protected void load(java.io.InputStream inputStream,
                    java.lang.String locationURI,
                    java.lang.Object options)
             throws java.io.IOException
Throws:
java.io.IOException

load

protected void load(java.io.Reader inputReader,
                    java.lang.String locationURI,
                    java.lang.Object options)
             throws java.io.IOException
Throws:
java.io.IOException

load

protected void load(javax.xml.stream.XMLStreamReader reader)
             throws java.io.IOException
Throws:
java.io.IOException

load

protected void load(org.xml.sax.InputSource inputSource,
                    java.lang.String locationURI,
                    java.lang.Object options)
             throws java.io.IOException
Throws:
java.io.IOException

getRootObject

public commonj.sdo.DataObject getRootObject()
Specified by:
getRootObject in interface commonj.sdo.helper.XMLDocument

getRootElementURI

public java.lang.String getRootElementURI()
Specified by:
getRootElementURI in interface commonj.sdo.helper.XMLDocument

getRootElementName

public java.lang.String getRootElementName()
Specified by:
getRootElementName in interface commonj.sdo.helper.XMLDocument

getEncoding

public java.lang.String getEncoding()
Specified by:
getEncoding in interface commonj.sdo.helper.XMLDocument

setEncoding

public void setEncoding(java.lang.String encoding)
Specified by:
setEncoding in interface commonj.sdo.helper.XMLDocument

isXMLDeclaration

public boolean isXMLDeclaration()
Specified by:
isXMLDeclaration in interface commonj.sdo.helper.XMLDocument

setXMLDeclaration

public void setXMLDeclaration(boolean xmlDeclaration)
Specified by:
setXMLDeclaration in interface commonj.sdo.helper.XMLDocument

getXMLVersion

public java.lang.String getXMLVersion()
Specified by:
getXMLVersion in interface commonj.sdo.helper.XMLDocument

setXMLVersion

public void setXMLVersion(java.lang.String xmlVersion)
Specified by:
setXMLVersion in interface commonj.sdo.helper.XMLDocument

getSchemaLocationMap

protected org.eclipse.emf.common.util.EMap getSchemaLocationMap()
Returns:
an EMap containing the schema locations or null when no map

deresolve

protected java.lang.String deresolve(java.lang.String value)
Parameters:
value - from schema location map.
Returns:
string form of URI from provided value, deresolved if appropriate.

resolve

protected java.lang.String resolve(java.lang.String value)
Parameters:
value - for schema location from input parameter.
Returns:
string form of URI from provided value, resolved if appropriate.

getSchemaLocation

public java.lang.String getSchemaLocation()
Specified by:
getSchemaLocation in interface commonj.sdo.helper.XMLDocument

setSchemaLocation

public void setSchemaLocation(java.lang.String schemaLocation)
Specified by:
setSchemaLocation in interface commonj.sdo.helper.XMLDocument

getNoNamespaceSchemaLocation

public java.lang.String getNoNamespaceSchemaLocation()
Specified by:
getNoNamespaceSchemaLocation in interface commonj.sdo.helper.XMLDocument

setNoNamespaceSchemaLocation

public void setNoNamespaceSchemaLocation(java.lang.String schemaLocation)
Specified by:
setNoNamespaceSchemaLocation in interface commonj.sdo.helper.XMLDocument


Copyright © 2006 Apache Software Foundation. All Rights Reserved.