public class XMLResourceImpl extends ResourceImpl implements XMLResource
XMLResource.ElementHandler, XMLResource.MissingPackageHandler, XMLResource.ResourceEntityHandler, XMLResource.ResourceHandler, XMLResource.URIHandler, XMLResource.XMLInfo, XMLResource.XMLMap| Modifier and Type | Field and Description |
|---|---|
protected static java.util.Map<EObject,java.lang.String> |
DETACHED_EOBJECT_TO_ID_MAP
The map from
EObject to ID. |
protected DOMHandler |
domHandler |
protected java.lang.String |
encoding |
protected java.util.Map<EObject,AnyType> |
eObjectToExtensionMap |
protected java.util.Map<EObject,java.lang.String> |
eObjectToIDMap
The map from
EObject to ID. |
protected java.util.Map<java.lang.String,EObject> |
idToEObjectMap
The map from
ID to EObject. |
protected java.lang.String |
publicId |
protected java.lang.String |
systemId |
protected boolean |
useZip |
protected java.lang.String |
xmlVersion |
HREF, NIL, NO_NAMESPACE_SCHEMA_LOCATION, OPTION_ANY_SIMPLE_TYPE, OPTION_ANY_TYPE, OPTION_BINARY, OPTION_CONFIGURATION_CACHE, OPTION_DECLARE_XML, OPTION_DEFER_ATTACHMENT, OPTION_DEFER_IDREF_RESOLUTION, OPTION_DISABLE_NOTIFY, OPTION_DOM_USE_NAMESPACES_IN_SCOPE, OPTION_ELEMENT_HANDLER, OPTION_ENCODING, OPTION_ESCAPE_USING_CDATA, OPTION_EXTENDED_META_DATA, OPTION_FLUSH_THRESHOLD, OPTION_FORMATTED, OPTION_KEEP_DEFAULT_CONTENT, OPTION_LAX_FEATURE_PROCESSING, OPTION_LAX_WILDCARD_PROCESSING, OPTION_LINE_WIDTH, OPTION_MISSING_PACKAGE_HANDLER, OPTION_PARSER_FEATURES, OPTION_PARSER_PROPERTIES, OPTION_PROCESS_DANGLING_HREF, OPTION_PROCESS_DANGLING_HREF_DISCARD, OPTION_PROCESS_DANGLING_HREF_RECORD, OPTION_PROCESS_DANGLING_HREF_THROW, OPTION_PROXY_ATTRIBUTES, OPTION_RECORD_ANY_TYPE_NAMESPACE_DECLARATIONS, OPTION_RECORD_UNKNOWN_FEATURE, OPTION_RESOURCE_ENTITY_HANDLER, OPTION_RESOURCE_HANDLER, OPTION_ROOT_OBJECTS, OPTION_SAVE_DOCTYPE, OPTION_SAVE_TYPE_INFORMATION, OPTION_SCHEMA_LOCATION, OPTION_SCHEMA_LOCATION_IMPLEMENTATION, OPTION_SKIP_ESCAPE, OPTION_SKIP_ESCAPE_URI, OPTION_SUPPRESS_DOCUMENT_ROOT, OPTION_URI_HANDLER, OPTION_USE_CACHED_LOOKUP_TABLE, OPTION_USE_DEPRECATED_METHODS, OPTION_USE_ENCODED_ATTRIBUTE_STYLE, OPTION_USE_FILE_BUFFER, OPTION_USE_LEXICAL_HANDLER, OPTION_USE_PACKAGE_NS_URI_AS_LOCATION, OPTION_USE_PARSER_POOL, OPTION_USE_XML_NAME_TO_FEATURE_MAP, OPTION_XML_MAP, OPTION_XML_OPTIONS, OPTION_XML_VERSION, SCHEMA_LOCATION, TYPE, XML_NS, XML_SCHEMA_URI, XSI_NS, XSI_URI| Constructor and Description |
|---|
XMLResourceImpl()
Constructor for XMLResourceImpl.
|
XMLResourceImpl(URI uri)
Constructor for XMLResourceImpl.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
assignIDsWhileLoading() |
protected void |
attachedHelper(EObject eObject) |
protected EObjectInputStream |
createEObjectInputStream(java.io.InputStream inputStream,
java.util.Map<?,?> options,
XMLResource.URIHandler uriHandler) |
protected EObjectOutputStream |
createEObjectOutputStream(java.io.OutputStream outputStream,
java.util.Map<?,?> options,
BinaryResourceImpl.BinaryIO.Version version,
XMLResource.URIHandler uriHandler) |
protected XMLHelper |
createXMLHelper() |
protected XMLLoad |
createXMLLoad() |
protected XMLLoad |
createXMLLoad(java.util.Map<?,?> options) |
protected XMLSave |
createXMLSave() |
protected XMLSave |
createXMLSave(java.util.Map<?,?> options) |
protected void |
detachedHelper(EObject eObject) |
void |
doLoad(org.xml.sax.InputSource inputSource,
java.util.Map<?,?> options) |
void |
doLoad(java.io.InputStream inputStream,
java.util.Map<?,?> options) |
void |
doLoad(org.w3c.dom.Node node,
java.util.Map<?,?> options) |
void |
doSave(java.io.OutputStream outputStream,
java.util.Map<?,?> options) |
void |
doSave(java.io.Writer writer,
java.util.Map<?,?> options) |
protected void |
doUnload()
Does all the work of unloading the resource.
|
java.util.Map<java.lang.Object,java.lang.Object> |
getDefaultLoadOptions()
Returns the map of options that, in addition to the overriding options specified during load,
are used to to control load behavior.
|
java.util.Map<java.lang.Object,java.lang.Object> |
getDefaultSaveOptions()
Returns the map of options that, in addition to the overriding options specified during save,
are used to to control save behavior.
|
DOMHelper |
getDOMHelper()
Returns the
DOMHelper |
java.lang.String |
getEncoding()
Get the XML encoding for this resource.
|
protected EObject |
getEObjectByID(java.lang.String id) |
java.util.Map<EObject,AnyType> |
getEObjectToExtensionMap()
Returns the map with
EObject as keys and corresponding org.eclipse.emf.ecore.xml.type.AnyTypes as the values. |
java.util.Map<EObject,java.lang.String> |
getEObjectToIDMap()
Returns the Map of EObjects as keys and IDs as values.
|
java.lang.String |
getID(EObject eObject)
Returns the ID that was assigned with
XMLResource.setID(EObject, String); if there is
no ID, it returns null. |
protected java.lang.String |
getIDForEObject(EObject eObject) |
java.util.Map<java.lang.String,EObject> |
getIDToEObjectMap()
Returns the Map with IDs as keys and EObjects as values.
|
java.lang.String |
getPublicId()
Returns public identifier specified on the doctype.
|
java.lang.String |
getSystemId()
Returns system identifier specified on the doctype.
|
java.lang.String |
getURIFragment(EObject eObject) |
java.lang.String |
getXMLVersion()
Returns the XML version for this resource.
|
protected void |
init() |
protected boolean |
isAttachedDetachedHelperRequired() |
protected boolean |
isPath(java.lang.String uriFragment) |
void |
load(org.xml.sax.InputSource inputSource,
java.util.Map<?,?> options) |
void |
load(org.w3c.dom.Node node,
java.util.Map<?,?> options)
Loads the resource from the DOM node, either an Element or Document, using the specified options.
|
org.w3c.dom.Document |
save(org.w3c.dom.Document doc,
java.util.Map<?,?> options,
DOMHandler handler)
Create a DOM tree representing contents of this resource.
|
void |
save(java.io.Writer writer,
java.util.Map<?,?> options)
Saves the resource to the writer using the specified options.
|
void |
setDoctypeInfo(java.lang.String publicId,
java.lang.String systemId)
|
void |
setEncoding(java.lang.String encoding)
Set the XML encoding for this resource.
|
void |
setID(EObject eObject,
java.lang.String id)
Sets the ID of the object.
|
void |
setUseZip(boolean useZip)
Set whether the contents will be zipped.
|
void |
setXMLVersion(java.lang.String version)
Set the XML version for this resource
|
java.lang.String |
toKeyString()
Returns a string representation of the
ID map. |
protected boolean |
useIDAttributes() |
protected boolean |
useIDs() |
protected boolean |
useUUIDs() |
boolean |
useZip()
Returns whether the contents will be zipped.
|
protected java.util.Map<java.lang.String,EObject> idToEObjectMap
ID to EObject.
It is used to store IDs during a load or if the user
sets the ID of an object.protected java.util.Map<EObject,java.lang.String> eObjectToIDMap
EObject to ID.
It is used to store IDs during a load or if the user
sets the ID of an object.protected java.util.Map<EObject,AnyType> eObjectToExtensionMap
protected java.lang.String encoding
protected java.lang.String xmlVersion
protected boolean useZip
protected java.lang.String publicId
protected java.lang.String systemId
protected DOMHandler domHandler
protected static final java.util.Map<EObject,java.lang.String> DETACHED_EOBJECT_TO_ID_MAP
EObject to ID. It is used to store
IDs for objects that have been detached.public XMLResourceImpl()
public XMLResourceImpl(URI uri)
uri - protected void init()
protected boolean useIDs()
protected boolean useIDAttributes()
protected boolean useUUIDs()
protected boolean assignIDsWhileLoading()
public java.util.Map<java.lang.Object,java.lang.Object> getDefaultSaveOptions()
XMLResourcegetDefaultSaveOptions in interface XMLResourcepublic java.util.Map<java.lang.Object,java.lang.Object> getDefaultLoadOptions()
XMLResourcegetDefaultLoadOptions in interface XMLResourceprotected XMLHelper createXMLHelper()
protected XMLLoad createXMLLoad()
protected XMLLoad createXMLLoad(java.util.Map<?,?> options)
protected XMLSave createXMLSave()
protected XMLSave createXMLSave(java.util.Map<?,?> options)
public void doLoad(java.io.InputStream inputStream,
java.util.Map<?,?> options)
throws java.io.IOException
java.io.IOExceptionprotected EObjectInputStream createEObjectInputStream(java.io.InputStream inputStream,
java.util.Map<?,?> options,
XMLResource.URIHandler uriHandler)
throws java.io.IOException
java.io.IOExceptionpublic void doSave(java.io.OutputStream outputStream,
java.util.Map<?,?> options)
throws java.io.IOException
java.io.IOExceptionprotected EObjectOutputStream createEObjectOutputStream(java.io.OutputStream outputStream,
java.util.Map<?,?> options,
BinaryResourceImpl.BinaryIO.Version version,
XMLResource.URIHandler uriHandler)
throws java.io.IOException
java.io.IOExceptionpublic final void save(java.io.Writer writer,
java.util.Map<?,?> options)
throws java.io.IOException
This implementation is final;
clients should override doSave.
save in interface XMLResourcewriter - the writeroptions - the save options.java.io.IOExceptiondoSave(Writer, Map)public void doSave(java.io.Writer writer,
java.util.Map<?,?> options)
throws java.io.IOException
java.io.IOExceptionpublic org.w3c.dom.Document save(org.w3c.dom.Document doc,
java.util.Map<?,?> options,
DOMHandler handler)
XMLResourcesave in interface XMLResourcedoc - an empty Document to use or null. If no document is specified, the
new Document will be created using JAXP API.options - the "save" optionshandler - the DOMHandler to record mappings or null.
If no DOMHandler is passed, the default DOMHandler will be created.Document. In the case the document is specified as a parameter,
the returned document is the same as the one specified, otherwise the newly created document is returned.public DOMHelper getDOMHelper()
XMLResourceDOMHelpergetDOMHelper in interface XMLResourcepublic boolean useZip()
XMLResourceuseZip in interface XMLResourcepublic void setUseZip(boolean useZip)
XMLResourcesetUseZip in interface XMLResourcepublic java.lang.String getPublicId()
XMLResourcegetPublicId in interface XMLResourcepublic java.lang.String getSystemId()
XMLResourcegetSystemId in interface XMLResourcepublic void setDoctypeInfo(java.lang.String publicId,
java.lang.String systemId)
XMLResourcesetDoctypeInfo in interface XMLResourcepublic java.lang.String getEncoding()
XMLResourcegetEncoding in interface XMLResourcepublic void setEncoding(java.lang.String encoding)
XMLResourcesetEncoding in interface XMLResourcepublic java.lang.String getXMLVersion()
XMLResourcegetXMLVersion in interface XMLResourcepublic void setXMLVersion(java.lang.String version)
XMLResourcesetXMLVersion in interface XMLResourcepublic java.util.Map<java.lang.String,EObject> getIDToEObjectMap()
XMLResourcegetIDToEObjectMap in interface XMLResourcepublic java.util.Map<EObject,java.lang.String> getEObjectToIDMap()
XMLResourcegetEObjectToIDMap in interface XMLResourcepublic java.util.Map<EObject,AnyType> getEObjectToExtensionMap()
XMLResourceEObject as keys and corresponding org.eclipse.emf.ecore.xml.type.AnyTypes as the values.
It's used to record unrecognized elements and attributes.getEObjectToExtensionMap in interface XMLResourceprotected java.lang.String getIDForEObject(EObject eObject)
public java.lang.String getID(EObject eObject)
XMLResourceXMLResource.setID(EObject, String); if there is
no ID, it returns null.getID in interface XMLResourcepublic void setID(EObject eObject,
java.lang.String id)
eObjectToIDMap.
Clients may override it to set the ID as an actual attribute object the object.setID in interface XMLResourceeObject - the object.id - the object's ID.public java.lang.String getURIFragment(EObject eObject)
protected EObject getEObjectByID(java.lang.String id)
protected boolean isPath(java.lang.String uriFragment)
protected boolean isAttachedDetachedHelperRequired()
protected void attachedHelper(EObject eObject)
protected void detachedHelper(EObject eObject)
protected void doUnload()
idToEObjectMap and eObjectToIDMap as necessary.public java.lang.String toKeyString()
ID map.public final void load(org.w3c.dom.Node node,
java.util.Map<?,?> options)
throws java.io.IOException
XMLResourceThis method assumes that no namespace fixup needs to be done. To process comments and CDATA section nodes, please set XMLResource.OPTION_USE_LEXICAL_HANDLER option to Boolean.TRUE.
load in interface XMLResourcenode - DOM Element or Document node.options - the load options.java.io.IOExceptionXMLResource.save(Document, Map, DOMHandler)public void doLoad(org.w3c.dom.Node node,
java.util.Map<?,?> options)
throws java.io.IOException
java.io.IOExceptionpublic final void load(org.xml.sax.InputSource inputSource,
java.util.Map<?,?> options)
throws java.io.IOException
load in interface XMLResourcejava.io.IOExceptionpublic void doLoad(org.xml.sax.InputSource inputSource,
java.util.Map<?,?> options)
throws java.io.IOException
java.io.IOExceptionCopyright © 2018. Licensed under the Eclipse Public License v1.0. All rights reserved.
Submit a bug or feature