## org.eclipse.emf.ecore.xmi
Interface XMLResource

All Superinterfaces:
  Notifier, Resource

All Known Subinterfaces:
  Ecore2XMLResource, XMIResource

All Known Implementing Classes:
  Ecore2EcoreResourceImpl, Ecore2XMLResourceImpl, EMOFResourceImpl, GenericXMLResourceImpl, XMIResourceImpl, XMLResourceImpl

    public interface XMLResource

extends Resource

This interface represents an XML resource. You can use it to load and save XML documents.

Nested Class Summary
`static interface` `XMLResource.ElementHandler` An interface for an element handle that is used to deduce an appropriate feature when serializing a value of a specific type.
`static interface` `XMLResource.ResourceEntityHandler` An interface for a resource entity handler.
`static interface` `XMLResource.ResourceHandler` An interface for a resource handler that can be registered to receive call backs for loading from an input stream or for saving to an output stream.
`static interface` `XMLResource.URIHandler` An interface for a URI handler that is used to `resolve` and `deresolve` URIs.
`static interface` `XMLResource.XMLInfo` This interface is used with the XMLMap interface to describe how to serialize objects and features.
`static interface` `XMLResource.XMLMap` This interface represents a mapping from Ecore constructs to the XML representation of those constructs.

Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.resource.Resource
`Resource.Diagnostic, Resource.Factory, Resource.Internal, Resource.IOWrappedException`

Field Summary
`static java.lang.String` `HREF`
`static java.lang.String` `NIL`
`static java.lang.String` `NO_NAMESPACE_SCHEMA_LOCATION`
`static java.lang.String` `OPTION_ANY_SIMPLE_TYPE` This option allows to specify an EClass for the implementation for anySimpleType.
`static java.lang.String` `OPTION_ANY_TYPE` This option allows to specify an EClass for the implementation for anyType.
`static java.lang.String` `OPTION_CONFIGURATION_CACHE` Generic option for enable caching (during save and load) to improve performance.
`static java.lang.String` `OPTION_DECLARE_XML` Begin a save with this line:
`static java.lang.String` `OPTION_DEFER_ATTACHMENT` Defer adding the root object to the resource until the end of the load when the tree is complete.
`static java.lang.String` `OPTION_DEFER_IDREF_RESOLUTION` Defer resolution of same document references until the end of the document is reached.
`static java.lang.String` `OPTION_DISABLE_NOTIFY` Disable notifications during load, and enable them at the end of a load.
`static java.lang.String` `OPTION_DOM_USE_NAMESPACES_IN_SCOPE` This is option should be used when loading a resource from a DOM Element node, to specify that load method should take into account all the namespaces declarations in scope for this node (by visiting parents of the node being loaded).
`static java.lang.String` `OPTION_ELEMENT_HANDLER` This option is used to specify an `XMLResource.ElementHandler` for deducing the feature used to serialize a specific type of value.
`static java.lang.String` `OPTION_ENCODING` Specify the XML encoding to be used during save.
`static java.lang.String` `OPTION_ESCAPE_USING_CDATA` Serialized element content that needs escaping and doesn't contain `"]]>"`, will be escaped using CDATA.
`static java.lang.String` `OPTION_EXTENDED_META_DATA` This option allows you to tailor the XML serialization of objects.
`static java.lang.String` `OPTION_FLUSH_THRESHOLD` Flush the output stream whenever the number of characters/bytes pending exceeds the specified Integer value.
`static java.lang.String` `OPTION_FORMATTED` Break lines and add indentation to produce a readable document.
`static java.lang.String` `OPTION_KEEP_DEFAULT_CONTENT` Keep default content ( e.g. default attributes).
`static java.lang.String` `OPTION_LAX_FEATURE_PROCESSING` Turn this load option on to indicate that a feature should be populated from either an attribute or an element even if its feature kind is specified (e.g. element).
`static java.lang.String` `OPTION_LAX_WILDCARD_PROCESSING` This load option set to `Boolean.TRUE` will cause all wildcards to handled as if they explicitly specified `lax processing`.
`static java.lang.String` `OPTION_LINE_WIDTH` Attribute formatting that exceeds the specified width will cause a line break so that formatting will continue indented on the next line.
`static java.lang.String` `OPTION_PARSER_FEATURES` Specify parser features with their corresponding values, i.e., `true` or `false` using `Map`.
`static java.lang.String` `OPTION_PARSER_PROPERTIES` Specify parser properties with their corresponding values using a `Map`.
`static java.lang.String` `OPTION_PROCESS_DANGLING_HREF` This can be one of "THROW", "DISCARD", "RECORD", where "THROW" is the default.
`static java.lang.String` `OPTION_PROCESS_DANGLING_HREF_DISCARD`
`static java.lang.String` `OPTION_PROCESS_DANGLING_HREF_RECORD`
`static java.lang.String` `OPTION_PROCESS_DANGLING_HREF_THROW`
`static java.lang.String` `OPTION_RECORD_ANY_TYPE_NAMESPACE_DECLARATIONS` Enable preserving namespace declarations on elements of type `AnyType`
`static java.lang.String` `OPTION_RECORD_UNKNOWN_FEATURE` This options allows you to record unknown features during deserialization/loading.
`static java.lang.String` `OPTION_RESOURCE_ENTITY_HANDLER` A `XMLResource.ResourceEntityHandler` value that will be used during load to record entity definitions and during save to encode cross document reference URIs as entities; the default value is null, in which case entities will not be defined at all.
`static java.lang.String` `OPTION_RESOURCE_HANDLER` A `XMLResource.ResourceHandler` value that can be registered to receive call backs for loading from an input stream or saving to an output stream.
`static java.lang.String` `OPTION_ROOT_OBJECTS` Write only the subtree starting at the specified list of EObjects, which must be objects contained by the resource.
`static java.lang.String` `OPTION_SAVE_DOCTYPE` Save a `doctype` declaration using systemId and publicId values specified on the resource
`static java.lang.String` `OPTION_SAVE_TYPE_INFORMATION` Use XMLTypeInfo to determine whether type information (xsi:type/xmi:type) is to be serialized for references.
`static java.lang.String` `OPTION_SCHEMA_LOCATION` Produce an xsi:schemaLocation/xsi:noNamespaceSchemaLocation in the saved result.
`static java.lang.String` `OPTION_SCHEMA_LOCATION_IMPLEMENTATION` Produce an xsi:schemaLocation/xsi:noNamespaceSchemaLocation in the saved result to encode the name of the Java interface that declares the eINSTANCE of the EPackage implementation for those cases where OPTION_SCHEMA_LOCATION would not produce a physical location URI.
`static java.lang.String` `OPTION_SKIP_ESCAPE` Skip processing for values that contain characters special to XML Faster for large computer-generated files
`static java.lang.String` `OPTION_SKIP_ESCAPE_URI` Skip escaping special characters, such as '&' char, in URIs during XML serialization.
`static java.lang.String` `OPTION_SUPPRESS_DOCUMENT_ROOT` When `OPTION_EXTENDED_META_DATA` is used, this load option set to Boolean.TRUE will direct the deserializer to suppress creating a document root instance.
`static java.lang.String` `OPTION_URI_HANDLER` A `XMLResource.URIHandler` value that will be used to control how URIs are `resolved` during load and `deresolved` during save.
`static java.lang.String` `OPTION_USE_CACHED_LOOKUP_TABLE` Specify a place holder `List` for caching information during the subsequent saving of XML documents.
`static java.lang.String` `OPTION_USE_DEPRECATED_METHODS` Use deprecated methods - the default is `true`.
`static java.lang.String` `OPTION_USE_ENCODED_ATTRIBUTE_STYLE` All EObject references will be uniformly encoded as one or more QName URI pairs, where the QName is optional depending on whether the referenced object's type is not identicle to that of the feature.
`static java.lang.String` `OPTION_USE_FILE_BUFFER` Write the intermediate results of serialization to the file system rather to an in-memory buffer.
`static java.lang.String` `OPTION_USE_LEXICAL_HANDLER` Determines whether comments and CDATA will be preserved in any mixed text processing.
`static java.lang.String` `OPTION_USE_PARSER_POOL` Specify a parser pool to be used for loading XML documents from InputStream.
`static java.lang.String` `OPTION_USE_XML_NAME_TO_FEATURE_MAP` Specify a map `Map` to be used during the subsequent loading of XML documents.
`static java.lang.String` `OPTION_XML_MAP` This save option allows you to tailor the XML serialization of objects.
`static java.lang.String` `OPTION_XML_OPTIONS` Allows the user to specify XML options `XMLOptions` and default implementation you can use `XMLOptionsImpl`
`static java.lang.String` `OPTION_XML_VERSION` Specify the XML version to be used during save.
`static java.lang.String` `SCHEMA_LOCATION`
`static java.lang.String` `TYPE`
`static java.lang.String` `XML_NS`
`static java.lang.String` `XML_SCHEMA_URI`
`static java.lang.String` `XSI_NS`
`static java.lang.String` `XSI_URI`

Fields inherited from interface org.eclipse.emf.ecore.resource.Resource
`OPTION_CIPHER, OPTION_SAVE_ONLY_IF_CHANGED, OPTION_SAVE_ONLY_IF_CHANGED_FILE_BUFFER, OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER, OPTION_ZIP, RESOURCE__CONTENTS, RESOURCE__ERRORS, RESOURCE__IS_LOADED, RESOURCE__IS_MODIFIED, RESOURCE__IS_TRACKING_MODIFICATION, RESOURCE__RESOURCE_SET, RESOURCE__TIME_STAMP, RESOURCE__URI, RESOURCE__WARNINGS`

Method Summary
`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.
`java.util.Map<EObject,AnyType>` `getEObjectToExtensionMap()` Returns the map with `EObject` as keys and corresponding `AnyType`s as the values.
`java.util.Map<EObject,java.lang.String>` `getEObjectToIDMap()` Deprecated. since 2.1.0 This map should not be manipulated directly. Use `setID(EObject, String)` and `getID(EObject)` or `Resource.getEObject(String)` instead. This method may be removed from this interface.
`java.lang.String` `getID(EObject eObject)` Returns the ID that was assigned with `setID(EObject, String)`; if there is no ID, it returns null.
`java.util.Map<java.lang.String,EObject>` `getIDToEObjectMap()` Deprecated. since 2.1.0 This map should not be manipulated directly. Use `setID(EObject, String)` and `getID(EObject)` or `Resource.getEObject(String)` instead. This method may be removed from this interface.
`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` `getXMLVersion()` Returns the XML version for this resource.
`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 document, 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)` Sets the values of system and public identifiers on this resource.
`void` `setEncoding(java.lang.String encoding)` Set the XML encoding for this resource.
`void` `setID(EObject eObject, java.lang.String id)` Sets the ID for the given 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
`boolean` `useZip()` Returns whether the contents will be zipped.

Methods inherited from interface org.eclipse.emf.ecore.resource.Resource
`delete, getAllContents, getContents, getEObject, getErrors, getResourceSet, getTimeStamp, getURI, getURIFragment, getWarnings, isLoaded, isModified, isTrackingModification, load, load, save, save, setModified, setTimeStamp, setTrackingModification, setURI, unload`

Methods inherited from interface org.eclipse.emf.common.notify.Notifier
`eAdapters, eDeliver, eNotify, eSetDeliver`

Field Detail

### OPTION_USE_PARSER_POOL

    static final java.lang.String OPTION_USE_PARSER_POOL

  Specify a parser pool to be used for loading XML documents from InputStream. You need to provide a XMLParserPool as the value of this option.

  This option can dramatically improve performance for deserialization (loading) of XML resource.

  See Also:
    `XMLParserPool`, Constant Field Values

### OPTION_USE_XML_NAME_TO_FEATURE_MAP

    static final java.lang.String OPTION_USE_XML_NAME_TO_FEATURE_MAP

  Specify a map `Map` to be used during the subsequent loading of XML documents. This is mapping between XML name, namespace and an EClass to the corresponding EStructuralFeature.

  This option can significantly improve performance for deserialization (loading) of multiple XML resources which are based on the same model (XML Schema or Ecore).

  See Also:
    `EClass`, `EStructuralFeature`, Constant Field Values

### OPTION_USE_CACHED_LOOKUP_TABLE

    static final java.lang.String OPTION_USE_CACHED_LOOKUP_TABLE

  Specify a place holder `List` for caching information during the subsequent saving of XML documents. This option can improve performance for serialization (saving) of multiple XML resources. This option is similar to the OPTION_USE_XML_NAME_TO_FEATURE_MAP which is used for deserialization (loading).

  See Also:
    Constant Field Values

### OPTION_USE_DEPRECATED_METHODS

    static final java.lang.String OPTION_USE_DEPRECATED_METHODS

  Use deprecated methods - the default is `true`. To improve deserialization performance turn this option to `false`. The methods affected are:
  - XMLHelper#createObject(org.eclipse.emf.ecore.EFactory, EClassifier)
  ,
  - XMLHander#handleNamespaceAttribs()
  ,
  - XMLHandler#createObjectFromFactory(EFactory factory, String typeName),
  - XMLLoadImpl#getEncoding()

  Note: if you use this option the SAX parser used for parsing documents must be namespace-aware parser, i.e. the namespaces should be turned on for the parser used. The default parser implementation is not namespace-aware. To turn on namespaces, either use OPTION_USE_PARSER_POOL or overwrite XMLLoadImpl#makeParser()

  See Also:
    Constant Field Values

### OPTION_CONFIGURATION_CACHE

    static final java.lang.String OPTION_CONFIGURATION_CACHE

  Generic option for enable caching (during save and load) to improve performance. This option uses `ConfigurationCache` to cache the following things:
  - Escape class used during serialization
  - Printer class used during serialization
  - DocumentRoot class per EPackage - useful during loading of XML document

  See Also:
    Constant Field Values

### OPTION_SAVE_TYPE_INFORMATION

    static final java.lang.String OPTION_SAVE_TYPE_INFORMATION

  Use XMLTypeInfo to determine whether type information (xsi:type/xmi:type) is to be serialized for references.

  See Also:
    Constant Field Values

### OPTION_PARSER_FEATURES

    static final java.lang.String OPTION_PARSER_FEATURES

  Specify parser features with their corresponding values, i.e., `true` or `false` using `Map`. This option is applicable during loading of XML resources from an InputStream

  See Also:
    Constant Field Values

### OPTION_PARSER_PROPERTIES

    static final java.lang.String OPTION_PARSER_PROPERTIES

  Specify parser properties with their corresponding values using a `Map`. This option is applicable during loading of XML resources from an InputStream.

  See Also:
    Constant Field Values

### OPTION_USE_LEXICAL_HANDLER

    static final java.lang.String OPTION_USE_LEXICAL_HANDLER

  Determines whether comments and CDATA will be preserved in any mixed text processing. This option is applicable for loading XML resources (from DOM node or an InputStream)

  See Also:
    Constant Field Values

### OPTION_DOM_USE_NAMESPACES_IN_SCOPE

    static final java.lang.String OPTION_DOM_USE_NAMESPACES_IN_SCOPE

  This is option should be used when loading a resource from a DOM Element node, to specify that load method should take into account all the namespaces declarations in scope for this node (by visiting parents of the node being loaded). Otherwise, user have to make sure that Element node being loaded has namespace well-formed content.

  Note that loading will only succeed if the subset of DOM being loaded could be treated as a valid resource according to the model.

  See Also:
    Constant Field Values

### OPTION_EXTENDED_META_DATA

    static final java.lang.String OPTION_EXTENDED_META_DATA

  This option allows you to tailor the XML serialization of objects. You should provide an ExtendedMetaData as the value of this option.

  See Also:
    `BasicExtendedMetaData`, Constant Field Values

### OPTION_ANY_TYPE

    static final java.lang.String OPTION_ANY_TYPE

  This option allows to specify an EClass for the implementation for anyType. As an example, see `org.eclipse.emf.ecore.sdo.SDOPackage` `getEDataObjectAnyType()`.

  See Also:
    `OPTION_ANY_SIMPLE_TYPE`, Constant Field Values

### OPTION_ANY_SIMPLE_TYPE

    static final java.lang.String OPTION_ANY_SIMPLE_TYPE

  This option allows to specify an EClass for the implementation for anySimpleType. As an example, see `org.eclipse.emf.ecore.sdo.SDOPackage` `getEDataObjectSimpleAnyType()` method.

  See Also:
    `OPTION_ANY_TYPE`, Constant Field Values

### OPTION_XML_MAP

    static final java.lang.String OPTION_XML_MAP

  This save option allows you to tailor the XML serialization of objects. You should provide an XMLMap as the value of this option.

  It is strongly suggested to use instead of this option the ExtendedMetaData.

  See Also:
    `OPTION_EXTENDED_META_DATA`, Constant Field Values

### OPTION_USE_ENCODED_ATTRIBUTE_STYLE

    static final java.lang.String OPTION_USE_ENCODED_ATTRIBUTE_STYLE

  All EObject references will be uniformly encoded as one or more QName URI pairs, where the QName is optional depending on whether the referenced object's type is not identicle to that of the feature. This option on save and load means the same: if it is set to true, "href" attributes will be treated as actual data - i.e. as if your model had a feature named "href".

  See Also:
    Constant Field Values

### OPTION_FORMATTED

    static final java.lang.String OPTION_FORMATTED

  Break lines and add indentation to produce a readable document. The default is `Boolean.TRUE` unless set to `Boolean.FALSE` explicitly.

  See Also:
    Constant Field Values

### OPTION_LINE_WIDTH

    static final java.lang.String OPTION_LINE_WIDTH

  Attribute formatting that exceeds the specified width will cause a line break so that formatting will continue indented on the next line.

  See Also:
    Constant Field Values

### OPTION_DECLARE_XML

    static final java.lang.String OPTION_DECLARE_XML

  Begin a save with this line:

  See Also:
    Constant Field Values

### OPTION_KEEP_DEFAULT_CONTENT

    static final java.lang.String OPTION_KEEP_DEFAULT_CONTENT

  Keep default content ( e.g. default attributes). This applies to saving and converting contents to DOM. By default the default content is discarded. To save the default content, set this option to `Boolean.TRUE`.

  See Also:
    Constant Field Values

### OPTION_SAVE_DOCTYPE

    static final java.lang.String OPTION_SAVE_DOCTYPE

  Save a `doctype` declaration using systemId and publicId values specified on the resource

  See Also:
    `getSystemId()`, `getPublicId()`, `setDoctypeInfo(String,String)`, Constant Field Values

### OPTION_RESOURCE_ENTITY_HANDLER

    static final java.lang.String OPTION_RESOURCE_ENTITY_HANDLER

  A `XMLResource.ResourceEntityHandler` value that will be used during load to record entity definitions and during save to encode cross document reference URIs as entities; the default value is null, in which case entities will not be defined at all. DOM does not support creating entities in the document type declaration, so this option does nothing when converting directly to DOM.

  See Also:
    `ResourceEntityHandlerImpl`, Constant Field Values

### OPTION_SKIP_ESCAPE

    static final java.lang.String OPTION_SKIP_ESCAPE

  Skip processing for values that contain characters special to XML Faster for large computer-generated files

  See Also:
    Constant Field Values

### OPTION_SKIP_ESCAPE_URI

    static final java.lang.String OPTION_SKIP_ESCAPE_URI

  Skip escaping special characters, such as '&' char, in URIs during XML serialization. The default is `Boolean.TRUE`. To enforce escaping special characters, set this option to `Boolean.FALSE`.

  See Also:
    Constant Field Values

### OPTION_PROCESS_DANGLING_HREF

    static final java.lang.String OPTION_PROCESS_DANGLING_HREF

  This can be one of "THROW", "DISCARD", "RECORD", where "THROW" is the default.

  See Also:
    Constant Field Values

### OPTION_PROCESS_DANGLING_HREF_THROW

    static final java.lang.String OPTION_PROCESS_DANGLING_HREF_THROW

See Also:
  Constant Field Values

### OPTION_PROCESS_DANGLING_HREF_DISCARD

    static final java.lang.String OPTION_PROCESS_DANGLING_HREF_DISCARD

See Also:
  Constant Field Values

### OPTION_PROCESS_DANGLING_HREF_RECORD

    static final java.lang.String OPTION_PROCESS_DANGLING_HREF_RECORD

See Also:
  Constant Field Values

### OPTION_RECORD_UNKNOWN_FEATURE

    static final java.lang.String OPTION_RECORD_UNKNOWN_FEATURE

  This options allows you to record unknown features during deserialization/loading. The default is `Boolean.FALSE` unless set to `Boolean.TRUE` explicitly. The unknown features and their values can be accessed via getEObjectToExtensionMap().

  See Also:
    `getEObjectToExtensionMap()`, Constant Field Values

### OPTION_LAX_FEATURE_PROCESSING

    static final java.lang.String OPTION_LAX_FEATURE_PROCESSING

  Turn this load option on to indicate that a feature should be populated from either an attribute or an element even if its feature kind is specified (e.g. element). The default is `Boolean.FALSE` unless set to `Boolean.TRUE` explicitly.

  See Also:
    Constant Field Values

### OPTION_LAX_WILDCARD_PROCESSING

    static final java.lang.String OPTION_LAX_WILDCARD_PROCESSING

  This load option set to `Boolean.TRUE` will cause all wildcards to handled as if they explicitly specified `lax processing`. The default is `Boolean.FALSE`.

  See Also:
    Constant Field Values

### OPTION_XML_OPTIONS

    static final java.lang.String OPTION_XML_OPTIONS

  Allows the user to specify XML options `XMLOptions` and default implementation you can use `XMLOptionsImpl`

  See Also:
    Constant Field Values

### OPTION_DISABLE_NOTIFY

    static final java.lang.String OPTION_DISABLE_NOTIFY

  Disable notifications during load, and enable them at the end of a load.

  See Also:
    Constant Field Values

### OPTION_SCHEMA_LOCATION

    static final java.lang.String OPTION_SCHEMA_LOCATION

  Produce an xsi:schemaLocation/xsi:noNamespaceSchemaLocation in the saved result.

  See Also:
    Constant Field Values

### OPTION_SCHEMA_LOCATION_IMPLEMENTATION

    static final java.lang.String OPTION_SCHEMA_LOCATION_IMPLEMENTATION

  Produce an xsi:schemaLocation/xsi:noNamespaceSchemaLocation in the saved result to encode the name of the Java interface that declares the eINSTANCE of the EPackage implementation for those cases where OPTION_SCHEMA_LOCATION would not produce a physical location URI.

  See Also:
    Constant Field Values

### OPTION_ENCODING

    static final java.lang.String OPTION_ENCODING

  Specify the XML encoding to be used during save.

  See Also:
    Constant Field Values

### OPTION_XML_VERSION

    static final java.lang.String OPTION_XML_VERSION

  Specify the XML version to be used during save.

  See Also:
    Constant Field Values

### OPTION_RECORD_ANY_TYPE_NAMESPACE_DECLARATIONS

    static final java.lang.String OPTION_RECORD_ANY_TYPE_NAMESPACE_DECLARATIONS

  Enable preserving namespace declarations on elements of type `AnyType`

  See Also:
    Constant Field Values

### OPTION_FLUSH_THRESHOLD

    static final java.lang.String OPTION_FLUSH_THRESHOLD

  Flush the output stream whenever the number of characters/bytes pending exceeds the specified Integer value. This helps to reduce memory requirements for serializing a large file, but it's slower. The default value is Integer.MAX_VALUE. I.e., the stream is never flushed.

  See Also:
    Constant Field Values

### OPTION_USE_FILE_BUFFER

    static final java.lang.String OPTION_USE_FILE_BUFFER

  Write the intermediate results of serialization to the file system rather to an in-memory buffer. This helps to reduce memory requirements for serializing a large file, but it's slower. The default is `Boolean.FALSE` unless set to `Boolean.TRUE` explicitly.

  See Also:
    Constant Field Values

### OPTION_DEFER_IDREF_RESOLUTION

    static final java.lang.String OPTION_DEFER_IDREF_RESOLUTION

  Defer resolution of same document references until the end of the document is reached.

  See Also:
    Constant Field Values

### OPTION_ROOT_OBJECTS

    static final java.lang.String OPTION_ROOT_OBJECTS

  Write only the subtree starting at the specified list of EObjects, which must be objects contained by the resource.

  See Also:
    Constant Field Values

### OPTION_RESOURCE_HANDLER

    static final java.lang.String OPTION_RESOURCE_HANDLER

  A `XMLResource.ResourceHandler` value that can be registered to receive call backs for loading from an input stream or saving to an output stream.

  See Also:
    `XMLResource.ResourceHandler`, `BasicResourceHandler`, Constant Field Values

### OPTION_DEFER_ATTACHMENT

    static final java.lang.String OPTION_DEFER_ATTACHMENT

  Defer adding the root object to the resource until the end of the load when the tree is complete. The default value is Boolean.FALSE. It's often a good idea to set OPTION_DEFER_IDREF_RESOLUTION true Boolean.TRUE if this option is set to Boolean.TRUE.

  See Also:
    Constant Field Values

### OPTION_URI_HANDLER

    static final java.lang.String OPTION_URI_HANDLER

  A `XMLResource.URIHandler` value that will be used to control how URIs are `resolved` during load and `deresolved` during save.

  See Also:
    `URI`, `XMLResource.URIHandler`, `XMLHelper.resolve(URI, URI)`, `XMLHelper.deresolve(URI)`, `URIHandlerImpl`, Constant Field Values

### OPTION_ELEMENT_HANDLER

    static final java.lang.String OPTION_ELEMENT_HANDLER

  This option is used to specify an `XMLResource.ElementHandler` for deducing the feature used to serialize a specific type of value.

  Since:
    2.4
  See Also:
    `XMLResource.ElementHandler`, Constant Field Values

### OPTION_SUPPRESS_DOCUMENT_ROOT

    static final java.lang.String OPTION_SUPPRESS_DOCUMENT_ROOT

  When `OPTION_EXTENDED_META_DATA` is used, this load option set to Boolean.TRUE will direct the deserializer to suppress creating a document root instance. This option is typically used in combination with `OPTION_ELEMENT_HANDLER`.

  Since:
    2.4
  See Also:
    Constant Field Values

### OPTION_ESCAPE_USING_CDATA

    static final java.lang.String OPTION_ESCAPE_USING_CDATA

  Serialized element content that needs escaping and doesn't contain `"]]>"`, will be escaped using CDATA. The default value is false.

  Since:
    `OPTION_SKIP_ESCAPE`, 2.4
  See Also:
    Constant Field Values

### HREF

    static final java.lang.String HREF

See Also:
  Constant Field Values

### NIL

    static final java.lang.String NIL

See Also:
  Constant Field Values

### TYPE

    static final java.lang.String TYPE

See Also:
  Constant Field Values

### SCHEMA_LOCATION

    static final java.lang.String SCHEMA_LOCATION

See Also:
  Constant Field Values

### NO_NAMESPACE_SCHEMA_LOCATION

    static final java.lang.String NO_NAMESPACE_SCHEMA_LOCATION

See Also:
  Constant Field Values

### XML_NS

    static final java.lang.String XML_NS

See Also:
  Constant Field Values

### XSI_NS

    static final java.lang.String XSI_NS

See Also:
  Constant Field Values

### XSI_URI

    static final java.lang.String XSI_URI

See Also:
  Constant Field Values

### XML_SCHEMA_URI

    static final java.lang.String XML_SCHEMA_URI

See Also:
  Constant Field Values

Method Detail

### useZip

    boolean useZip()

  Returns whether the contents will be zipped.

### setUseZip

    void setUseZip(boolean useZip)

  Set whether the contents will be zipped.

### getDefaultSaveOptions

    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.

### getDefaultLoadOptions

    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.

### getPublicId

    java.lang.String getPublicId()

  Returns public identifier specified on the doctype.

### getSystemId

    java.lang.String getSystemId()

  Returns system identifier specified on the doctype.

### setDoctypeInfo

    void setDoctypeInfo(java.lang.String publicId,
                        java.lang.String systemId)

  Sets the values of system and public identifiers on this resource.

  Parameters:
    `publicId` -
    `systemId` -

### getEncoding

    java.lang.String getEncoding()

  Get the XML encoding for this resource. The default is ASCII.

### setEncoding

    void setEncoding(java.lang.String encoding)

  Set the XML encoding for this resource.

### getXMLVersion

    java.lang.String getXMLVersion()

  Returns the XML version for this resource. The default is 1.0.

  Returns:
    the XML version.

### setXMLVersion

    void setXMLVersion(java.lang.String version)

  Set the XML version for this resource

### getIDToEObjectMap

    @Deprecated
    java.util.Map<java.lang.String,EObject> getIDToEObjectMap()

  Deprecated. since 2.1.0 This map should not be manipulated directly. Use `setID(EObject, String)` and `getID(EObject)` or `Resource.getEObject(String)` instead. This method may be removed from this interface.

  Returns the Map with IDs as keys and EObjects as values.

### getEObjectToIDMap

    @Deprecated
    java.util.Map<EObject,java.lang.String> getEObjectToIDMap()

  Deprecated. since 2.1.0 This map should not be manipulated directly. Use `setID(EObject, String)` and `getID(EObject)` or `Resource.getEObject(String)` instead. This method may be removed from this interface.

  Returns the Map of EObjects as keys and IDs as values.

### getID

    java.lang.String getID(EObject eObject)

  Returns the ID that was assigned with `setID(EObject, String)`; if there is no ID, it returns null.

### setID

    void setID(EObject eObject,
               java.lang.String id)

  Sets the ID for the given object. If you are storing the ID with the object itself, you should override this method. You can remove the ID of a given eObject by using `null` as the id value.

### getEObjectToExtensionMap

    java.util.Map<EObject,AnyType> getEObjectToExtensionMap()

  Returns the map with `EObject` as keys and corresponding `AnyType`s as the values. It's used to record unrecognized elements and attributes.

### save

    org.w3c.dom.Document save(org.w3c.dom.Document document,
                              java.util.Map<?,?> options,
                              DOMHandler handler)

  Create a DOM tree representing contents of this resource.

  Parameters:
    `document` - an empty `Document` to use or null. If no document is specified, the new `Document` will be created using JAXP API.
    `options` - the "save" options
    `handler` - the `DOMHandler` to record mappings or null. If no DOMHandler is passed, the default DOMHandler will be created.
  Returns:
    the `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.
  Since:
    2.1.0

### save

    void save(java.io.Writer writer,
              java.util.Map<?,?> options)
              throws java.io.IOException

  Saves the resource to the writer using the specified options.

  Parameters:
    `writer` - the writer
    `options` - the save options.
  Throws:
    `java.io.IOException`

### getDOMHelper

    DOMHelper getDOMHelper()

  Returns the `DOMHelper`

  Since:
    2.1.0

### load

    void load(org.w3c.dom.Node node,
              java.util.Map<?,?> options)
              throws java.io.IOException

  Loads the resource from the DOM node, either an Element or Document, using the specified options.

  This 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.

  Parameters:
    `node` - DOM Element or Document node.
    `options` - the load options.
  Throws:
    `java.io.IOException`
  Since:
    2.1.0
  See Also:
    `save(Document, Map, DOMHandler)`

### load

    void load(org.xml.sax.InputSource inputSource,
              java.util.Map<?,?> options)
              throws java.io.IOException

  Throws:
    `java.io.IOException`

Copyright 2001-2006 IBM Corporation and others. All Rights Reserved.