org.eclipse.emf.ecore.xmi.impl
Class XMLHelperImpl

java.lang.Object
  extended by org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl
All Implemented Interfaces:
XMLHelper
Direct Known Subclasses:
EMOFHelperImpl, XMIHelperImpl

public class XMLHelperImpl
extends java.lang.Object
implements XMLHelper

This class handles the package to use when there is no XML namespace in an XML file.


Nested Class Summary
protected static class XMLHelperImpl.NamespaceSupport
          A helper to encode namespace prefix mappings.
 
Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.xmi.XMLHelper
XMLHelper.ManyReference
 
Field Summary
protected  java.util.List<java.lang.String> allPrefixToURI
           
protected  java.util.Map<java.lang.String,java.lang.String> anyPrefixesToURIs
           
protected  EClass anySimpleType
           
protected  boolean checkForDuplicates
           
protected  DanglingHREFException danglingHREFException
           
protected  boolean deresolve
           
protected  ExtendedMetaData extendedMetaData
           
protected  java.util.Map<EStructuralFeature,java.lang.Integer> featuresToKinds
           
protected  java.lang.String[] fragmentPrefixes
           
protected static java.lang.Integer INTEGER_DATATYPE_IS_MANY
           
protected static java.lang.Integer INTEGER_DATATYPE_SINGLE
           
protected static java.lang.Integer INTEGER_IS_MANY_ADD
           
protected static java.lang.Integer INTEGER_IS_MANY_MOVE
           
protected static java.lang.Integer INTEGER_OTHER
           
protected  boolean laxFeatureProcessing
           
protected  boolean mustHavePrefix
           
protected  XMLHelperImpl.NamespaceSupport namespaceSupport
           
protected  EPackage noNamespacePackage
           
protected  EPackage.Registry packageRegistry
           
protected  java.util.Map<EPackage,java.lang.String> packages
           
protected  EMap<java.lang.String,java.lang.String> prefixesToURIs
           
protected  java.lang.String processDanglingHREF
           
protected  XMLResource resource
           
protected  URI resourceURI
           
protected  java.util.List<? extends EObject> roots
           
protected  boolean seenEmptyStringMapping
           
protected  XMLResource.URIHandler uriHandler
           
protected  java.util.Map<java.lang.String,java.util.List<java.lang.String>> urisToPrefixes
           
protected  XMLResource.XMLMap xmlMap
           
protected  EPackage xmlSchemaTypePackage
           
 
Fields inherited from interface org.eclipse.emf.ecore.xmi.XMLHelper
DATATYPE_IS_MANY, DATATYPE_SINGLE, IS_MANY_ADD, IS_MANY_MOVE, OTHER
 
Constructor Summary
XMLHelperImpl()
           
XMLHelperImpl(XMLResource resource)
           
 
Method Summary
protected  void addNSDeclaration(java.lang.String prefix, java.lang.String uri)
           
 void addPrefix(java.lang.String prefix, java.lang.String uri)
          Records the prefix to URI mapping while loading an XML document.
protected  void computeFeatureKind(EStructuralFeature feature)
           
 java.lang.String convertToString(EFactory factory, EDataType dataType, java.lang.Object value)
          Converts the given data value to a string while saving an XML document.
protected  java.lang.Object createFromString(EFactory eFactory, EDataType eDataType, java.lang.String value)
           
 EObject createObject(EFactory eFactory, EClassifier type)
          Create an object given an EFactory and a type
 EObject createObject(EFactory eFactory, java.lang.String classXMIName)
          Deprecated. since 2.2
 URI deresolve(URI uri)
          Returns a relative URI if necessary and if possible.
 java.util.Map<java.lang.String,java.lang.String> getAnyContentPrefixToURIMapping()
          Returns a map of prefixes to URI mapping for elements with any content
 DanglingHREFException getDanglingHREFException()
           
 ExtendedMetaData getExtendedMetaData()
          Gets the ExtendedMetaData to use when serializing an XML file.
 EStructuralFeature getFeature(EClass eClass, java.lang.String namespaceURI, java.lang.String name)
          Returns the structural feature for the XML element/attribute with the given namespaceURI and name.
 EStructuralFeature getFeature(EClass eClass, java.lang.String namespaceURI, java.lang.String name, boolean isElement)
          Returns the structural feature for the XML element/attribute with the given namespaceURI and name.
 int getFeatureKind(EStructuralFeature feature)
          Return the kind of feature.
protected  EStructuralFeature getFeatureWithoutMap(EClass eClass, java.lang.String name)
           
 java.lang.String getHREF(EObject obj)
          Returns an HREF to this object from this resource
protected  URI getHREF(Resource otherResource, EObject obj)
           
 java.lang.String getID(EObject obj)
          Returns the xmi:id or null to supress
 java.lang.String getIDREF(EObject obj)
          Returns an IDREF to this object
 java.lang.String getJavaEncoding(java.lang.String xmlEncoding)
          Return a Java encoding corresponding to the given XML encoding.
 java.lang.String getName(ENamedElement obj)
          Returns the XML name of the ENamedElement
 java.lang.String getNamespaceURI(java.lang.String prefix)
          Returns the namespaceURI in scope for the prefix.
 EPackage getNoNamespacePackage()
          Gets the package to use when there is no XML namespace in an XML file.
 java.lang.String getPrefix(EPackage ePackage)
          Return the prefix used for this package.
protected  java.lang.String getPrefix(EPackage ePackage, boolean mustHavePrefix)
           
 java.lang.String getPrefix(java.lang.String namespaceURI)
           
 java.util.List<java.lang.String> getPrefixes(EPackage ePackage)
          Return all the prefixes used for this package.
 EMap<java.lang.String,java.lang.String> getPrefixToNamespaceMap()
           
 java.lang.String getQName(EClass c)
          Returns the nsName:name c.ePackage().nsName() : c.eName() If there is an XMLMap, and the target namespace is null for this eClass, just the name is returned.
 java.lang.String getQName(EDataType c)
          Returns the nsName:name c.ePackage().nsName() : c.eName() If there is an XMLMap, and the target namespace is null for this eClass, just the name is returned.
protected  java.lang.String getQName(EPackage ePackage, java.lang.String name)
           
protected  java.lang.String getQName(EPackage ePackage, java.lang.String name, boolean mustHavePrefix)
           
 java.lang.String getQName(EStructuralFeature feature)
          By default, this method returns the name of the feature.
protected  java.lang.String getQName(NameInfo nameInfo, EPackage ePackage, java.lang.String name)
           
protected  java.lang.String getQName(NameInfo nameInfo, EPackage ePackage, java.lang.String name, boolean mustHavePrefix)
           
protected  java.lang.String getQName(java.lang.String uri, java.lang.String name)
           
 XMLResource getResource()
          Returns the resource
 EClassifier getType(EFactory eFactory, java.lang.String typeName)
          Given an EFactory and a type name, find and return the type
 java.lang.String getURI(java.lang.String prefix)
          Returns the namespace prefix that's in effect while loading an XML document.
protected  java.lang.String getURIFragment(Resource containingResource, EObject object)
           
protected  java.lang.String getURIFragmentQuery(Resource containingResource, EObject object)
           
 java.lang.Object getValue(EObject obj, EStructuralFeature f)
          Returns the XMI value of the EObject's feature
 java.lang.String getXMLEncoding(java.lang.String javaEncoding)
          Return an XML encoding corresponding to the given Java encoding.
 XMLResource.XMLMap getXMLMap()
          Gets the XMLMap to use when serializing an XML file.
protected  URI handleDanglingHREF(EObject object)
           
 EPackage[] packages()
          Returns the packages in getQName()
 void popContext()
          Reverts to the previous namespace context while loading XML document.
 void popContext(java.util.Map<java.lang.String,EFactory> prefixesToFactories)
          Reverts to the previous namespace context while loading XML document and removes from the map, prefixes that have gone out of scope.
 void populateNameInfo(NameInfo nameInfo, EClass c)
          This method populates the given NameInfo with name information, resetting all the current values in the nameInfo
 void populateNameInfo(NameInfo nameInfo, EDataType eDataType)
          This method populates the given NameInfo with name information, resetting all the current values in the nameInfo
 void populateNameInfo(NameInfo nameInfo, EStructuralFeature feature)
          This method populates the given NameInfo with name information, resetting all the current values in the nameInfo
 void pushContext()
          Starts a new namespace context while loading an XML document.
 void recordPrefixToURIMapping()
          Must be called during endDocument to record all the prefix to URI mappings that have been seen in the document during loading
 URI resolve(URI relative, URI base)
           
static java.lang.String saveString(java.util.Map<?,?> options, java.util.List<? extends EObject> contents, java.lang.String encoding, XMLHelper helper)
           
 void setAnySimpleType(EClass type)
          Sets the any simple type class.
 void setCheckForDuplicates(boolean checkForDuplicates)
           
 void setExtendedMetaData(ExtendedMetaData extendedMetaData)
          Sets the ExtendedMetaData to use when serializing an XML file.
 java.util.List<XMIException> setManyReference(XMLHelper.ManyReference reference, java.lang.String location)
           
 void setMustHavePrefix(boolean mustHavePrefix)
          Specify if qualified names must have a prefix or could use default namespace (if possible)
 void setNoNamespacePackage(EPackage pkg)
          Sets the package to use when there is no XML namespace in an XML file.
 void setOptions(java.util.Map<?,?> options)
          Sets various resource options on the helper
 void setPrefixToNamespaceMap(EMap<java.lang.String,java.lang.String> prefixToNamespaceMap)
           
 void setProcessDanglingHREF(java.lang.String value)
           
 void setResource(XMLResource resource)
           
 void setValue(EObject object, EStructuralFeature feature, java.lang.Object value, int position)
          Set the value of the feature for the object.
 void setXMLMap(XMLResource.XMLMap map)
          Sets the XMLMap to use when serializing an XML file.
protected  java.lang.String updateQNamePrefix(EFactory factory, EDataType dataType, java.lang.Object value, boolean list)
           
protected  java.lang.Object updateQNameURI(java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTEGER_DATATYPE_IS_MANY

protected static final java.lang.Integer INTEGER_DATATYPE_IS_MANY

INTEGER_DATATYPE_SINGLE

protected static final java.lang.Integer INTEGER_DATATYPE_SINGLE

INTEGER_IS_MANY_ADD

protected static final java.lang.Integer INTEGER_IS_MANY_ADD

INTEGER_IS_MANY_MOVE

protected static final java.lang.Integer INTEGER_IS_MANY_MOVE

INTEGER_OTHER

protected static final java.lang.Integer INTEGER_OTHER

noNamespacePackage

protected EPackage noNamespacePackage

xmlMap

protected XMLResource.XMLMap xmlMap

extendedMetaData

protected ExtendedMetaData extendedMetaData

laxFeatureProcessing

protected boolean laxFeatureProcessing

packageRegistry

protected EPackage.Registry packageRegistry

resource

protected XMLResource resource

resourceURI

protected URI resourceURI

deresolve

protected boolean deresolve

packages

protected java.util.Map<EPackage,java.lang.String> packages

featuresToKinds

protected java.util.Map<EStructuralFeature,java.lang.Integer> featuresToKinds

processDanglingHREF

protected java.lang.String processDanglingHREF

danglingHREFException

protected DanglingHREFException danglingHREFException

prefixesToURIs

protected EMap<java.lang.String,java.lang.String> prefixesToURIs

urisToPrefixes

protected java.util.Map<java.lang.String,java.util.List<java.lang.String>> urisToPrefixes

anyPrefixesToURIs

protected java.util.Map<java.lang.String,java.lang.String> anyPrefixesToURIs

namespaceSupport

protected XMLHelperImpl.NamespaceSupport namespaceSupport

anySimpleType

protected EClass anySimpleType

seenEmptyStringMapping

protected boolean seenEmptyStringMapping

xmlSchemaTypePackage

protected EPackage xmlSchemaTypePackage

allPrefixToURI

protected java.util.List<java.lang.String> allPrefixToURI

checkForDuplicates

protected boolean checkForDuplicates

mustHavePrefix

protected boolean mustHavePrefix

uriHandler

protected XMLResource.URIHandler uriHandler

roots

protected java.util.List<? extends EObject> roots

fragmentPrefixes

protected java.lang.String[] fragmentPrefixes
Constructor Detail

XMLHelperImpl

public XMLHelperImpl()

XMLHelperImpl

public XMLHelperImpl(XMLResource resource)
Method Detail

saveString

public static java.lang.String saveString(java.util.Map<?,?> options,
                                          java.util.List<? extends EObject> contents,
                                          java.lang.String encoding,
                                          XMLHelper helper)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

setOptions

public void setOptions(java.util.Map<?,?> options)
Description copied from interface: XMLHelper
Sets various resource options on the helper

Specified by:
setOptions in interface XMLHelper

setNoNamespacePackage

public void setNoNamespacePackage(EPackage pkg)
Description copied from interface: XMLHelper
Sets the package to use when there is no XML namespace in an XML file.

Specified by:
setNoNamespacePackage in interface XMLHelper

getNoNamespacePackage

public EPackage getNoNamespacePackage()
Description copied from interface: XMLHelper
Gets the package to use when there is no XML namespace in an XML file.

Specified by:
getNoNamespacePackage in interface XMLHelper

setXMLMap

public void setXMLMap(XMLResource.XMLMap map)
Description copied from interface: XMLHelper
Sets the XMLMap to use when serializing an XML file.

Specified by:
setXMLMap in interface XMLHelper

getXMLMap

public XMLResource.XMLMap getXMLMap()
Description copied from interface: XMLHelper
Gets the XMLMap to use when serializing an XML file.

Specified by:
getXMLMap in interface XMLHelper

setExtendedMetaData

public void setExtendedMetaData(ExtendedMetaData extendedMetaData)
Description copied from interface: XMLHelper
Sets the ExtendedMetaData to use when serializing an XML file.

Specified by:
setExtendedMetaData in interface XMLHelper

getExtendedMetaData

public ExtendedMetaData getExtendedMetaData()
Description copied from interface: XMLHelper
Gets the ExtendedMetaData to use when serializing an XML file.

Specified by:
getExtendedMetaData in interface XMLHelper

getResource

public XMLResource getResource()
Description copied from interface: XMLHelper
Returns the resource

Specified by:
getResource in interface XMLHelper

setResource

public void setResource(XMLResource resource)

getValue

public java.lang.Object getValue(EObject obj,
                                 EStructuralFeature f)
Description copied from interface: XMLHelper
Returns the XMI value of the EObject's feature

Specified by:
getValue in interface XMLHelper

getQName

public java.lang.String getQName(EClass c)
Description copied from interface: XMLHelper
Returns the nsName:name c.ePackage().nsName() : c.eName() If there is an XMLMap, and the target namespace is null for this eClass, just the name is returned. If the map has a target namespace specified, that target namespace is used rather than the namespace from the EPackage.

Specified by:
getQName in interface XMLHelper

populateNameInfo

public void populateNameInfo(NameInfo nameInfo,
                             EClass c)
Description copied from interface: XMLHelper
This method populates the given NameInfo with name information, resetting all the current values in the nameInfo

Specified by:
populateNameInfo in interface XMLHelper
Parameters:
nameInfo - the name information to populate
c - the EClass for which name has to be computed
See Also:
XMLHelper.getQName(EClass)

getQName

public java.lang.String getQName(EDataType c)
Description copied from interface: XMLHelper
Returns the nsName:name c.ePackage().nsName() : c.eName() If there is an XMLMap, and the target namespace is null for this eClass, just the name is returned. If the map has a target namespace specified, that target namespace is used rather than the namespace from the EPackage.

Specified by:
getQName in interface XMLHelper

populateNameInfo

public void populateNameInfo(NameInfo nameInfo,
                             EDataType eDataType)
Description copied from interface: XMLHelper
This method populates the given NameInfo with name information, resetting all the current values in the nameInfo

Specified by:
populateNameInfo in interface XMLHelper
Parameters:
nameInfo - the name information to fill in
eDataType - the EDataType for which name has to be computed
See Also:
XMLHelper.getQName(EDataType)

getQName

public java.lang.String getQName(EStructuralFeature feature)
Description copied from interface: XMLHelper
By default, this method returns the name of the feature. However, if there is an XMLMap, and the map specifies a target namespace, the nsPrefix:name is returned.

Specified by:
getQName in interface XMLHelper

populateNameInfo

public void populateNameInfo(NameInfo nameInfo,
                             EStructuralFeature feature)
Description copied from interface: XMLHelper
This method populates the given NameInfo with name information, resetting all the current values in the nameInfo

Specified by:
populateNameInfo in interface XMLHelper
Parameters:
nameInfo - the name information to fill in
feature - the EStructuralFeature for which name has to be computed
See Also:
XMLHelper.getQName(EStructuralFeature)

getQName

protected java.lang.String getQName(NameInfo nameInfo,
                                    EPackage ePackage,
                                    java.lang.String name)

getQName

protected java.lang.String getQName(NameInfo nameInfo,
                                    EPackage ePackage,
                                    java.lang.String name,
                                    boolean mustHavePrefix)

getQName

protected java.lang.String getQName(EPackage ePackage,
                                    java.lang.String name)

getQName

protected java.lang.String getQName(EPackage ePackage,
                                    java.lang.String name,
                                    boolean mustHavePrefix)

getPrefix

public java.lang.String getPrefix(EPackage ePackage)
Description copied from interface: XMLHelper
Return the prefix used for this package.

Specified by:
getPrefix in interface XMLHelper

getNamespaceURI

public java.lang.String getNamespaceURI(java.lang.String prefix)
Description copied from interface: XMLHelper
Returns the namespaceURI in scope for the prefix.

Specified by:
getNamespaceURI in interface XMLHelper

getPrefix

protected java.lang.String getPrefix(EPackage ePackage,
                                     boolean mustHavePrefix)

getPrefixes

public java.util.List<java.lang.String> getPrefixes(EPackage ePackage)
Description copied from interface: XMLHelper
Return all the prefixes used for this package.

Specified by:
getPrefixes in interface XMLHelper

getQName

protected java.lang.String getQName(java.lang.String uri,
                                    java.lang.String name)

getName

public java.lang.String getName(ENamedElement obj)
Description copied from interface: XMLHelper
Returns the XML name of the ENamedElement

Specified by:
getName in interface XMLHelper

getID

public java.lang.String getID(EObject obj)
Description copied from interface: XMLHelper
Returns the xmi:id or null to supress

Specified by:
getID in interface XMLHelper

getURIFragmentQuery

protected java.lang.String getURIFragmentQuery(Resource containingResource,
                                               EObject object)

getURIFragment

protected java.lang.String getURIFragment(Resource containingResource,
                                          EObject object)

getIDREF

public java.lang.String getIDREF(EObject obj)
Description copied from interface: XMLHelper
Returns an IDREF to this object

Specified by:
getIDREF in interface XMLHelper

handleDanglingHREF

protected URI handleDanglingHREF(EObject object)

getHREF

public java.lang.String getHREF(EObject obj)
Description copied from interface: XMLHelper
Returns an HREF to this object from this resource

Specified by:
getHREF in interface XMLHelper

getHREF

protected URI getHREF(Resource otherResource,
                      EObject obj)

deresolve

public URI deresolve(URI uri)
Description copied from interface: XMLHelper
Returns a relative URI if necessary and if possible.

Specified by:
deresolve in interface XMLHelper

getFeatureKind

public int getFeatureKind(EStructuralFeature feature)
Description copied from interface: XMLHelper
Return the kind of feature.

Specified by:
getFeatureKind in interface XMLHelper

createObject

public EObject createObject(EFactory eFactory,
                            EClassifier type)
Description copied from interface: XMLHelper
Create an object given an EFactory and a type

Specified by:
createObject in interface XMLHelper
Returns:
the created object.
See Also:
XMLHelper.createObject(EFactory, String)

getType

public EClassifier getType(EFactory eFactory,
                           java.lang.String typeName)
Description copied from interface: XMLHelper
Given an EFactory and a type name, find and return the type

Specified by:
getType in interface XMLHelper
See Also:
XMLHelper.createObject(EFactory, String)

createObject

@Deprecated
public EObject createObject(EFactory eFactory,
                                       java.lang.String classXMIName)
Deprecated. since 2.2

Description copied from interface: XMLHelper
Create an object given an EFactory and a type name.

Specified by:
createObject in interface XMLHelper

getFeature

public EStructuralFeature getFeature(EClass eClass,
                                     java.lang.String namespaceURI,
                                     java.lang.String name)
Description copied from interface: XMLHelper
Returns the structural feature for the XML element/attribute with the given namespaceURI and name.

Specified by:
getFeature in interface XMLHelper

getFeature

public EStructuralFeature getFeature(EClass eClass,
                                     java.lang.String namespaceURI,
                                     java.lang.String name,
                                     boolean isElement)
Description copied from interface: XMLHelper
Returns the structural feature for the XML element/attribute with the given namespaceURI and name.

Specified by:
getFeature in interface XMLHelper

getFeatureWithoutMap

protected EStructuralFeature getFeatureWithoutMap(EClass eClass,
                                                  java.lang.String name)

computeFeatureKind

protected void computeFeatureKind(EStructuralFeature feature)

getJavaEncoding

public java.lang.String getJavaEncoding(java.lang.String xmlEncoding)
Description copied from interface: XMLHelper
Return a Java encoding corresponding to the given XML encoding. By default, the XML encoding is returned.

Specified by:
getJavaEncoding in interface XMLHelper

getXMLEncoding

public java.lang.String getXMLEncoding(java.lang.String javaEncoding)
Description copied from interface: XMLHelper
Return an XML encoding corresponding to the given Java encoding. By default, the Java encoding is returned.

Specified by:
getXMLEncoding in interface XMLHelper

packages

public EPackage[] packages()
Description copied from interface: XMLHelper
Returns the packages in getQName()

Specified by:
packages in interface XMLHelper

setValue

public void setValue(EObject object,
                     EStructuralFeature feature,
                     java.lang.Object value,
                     int position)
Description copied from interface: XMLHelper
Set the value of the feature for the object.

Specified by:
setValue in interface XMLHelper

setManyReference

public java.util.List<XMIException> setManyReference(XMLHelper.ManyReference reference,
                                                     java.lang.String location)
Specified by:
setManyReference in interface XMLHelper

setCheckForDuplicates

public void setCheckForDuplicates(boolean checkForDuplicates)
Specified by:
setCheckForDuplicates in interface XMLHelper

setProcessDanglingHREF

public void setProcessDanglingHREF(java.lang.String value)
Specified by:
setProcessDanglingHREF in interface XMLHelper

getDanglingHREFException

public DanglingHREFException getDanglingHREFException()
Specified by:
getDanglingHREFException in interface XMLHelper

resolve

public URI resolve(URI relative,
                   URI base)
Specified by:
resolve in interface XMLHelper

pushContext

public void pushContext()
Description copied from interface: XMLHelper
Starts a new namespace context while loading an XML document.

A new context should be pushed at the beginning of each XML element. The new context will automatically inherit the declarations of its parent context, but it will also keep track of which declarations were made within this context.

Specified by:
pushContext in interface XMLHelper

popContext

public void popContext()
Description copied from interface: XMLHelper
Reverts to the previous namespace context while loading XML document.

The context should be popped at the end of each XML element. After popping the context, all namespace prefix mappings that were previously in scope are restored.

Specified by:
popContext in interface XMLHelper

popContext

public void popContext(java.util.Map<java.lang.String,EFactory> prefixesToFactories)
Description copied from interface: XMLHelper
Reverts to the previous namespace context while loading XML document and removes from the map, prefixes that have gone out of scope.

The context should be popped at the end of each XML element. After popping the context, all namespace prefix mappings that were previously in scope are restored.

Specified by:
popContext in interface XMLHelper

addPrefix

public void addPrefix(java.lang.String prefix,
                      java.lang.String uri)
Description copied from interface: XMLHelper
Records the prefix to URI mapping while loading an XML document.

Specified by:
addPrefix in interface XMLHelper

getPrefix

public java.lang.String getPrefix(java.lang.String namespaceURI)
Specified by:
getPrefix in interface XMLHelper

getAnyContentPrefixToURIMapping

public java.util.Map<java.lang.String,java.lang.String> getAnyContentPrefixToURIMapping()
Description copied from interface: XMLHelper
Returns a map of prefixes to URI mapping for elements with any content

Specified by:
getAnyContentPrefixToURIMapping in interface XMLHelper

getURI

public java.lang.String getURI(java.lang.String prefix)
Description copied from interface: XMLHelper
Returns the namespace prefix that's in effect while loading an XML document.

Specified by:
getURI in interface XMLHelper

getPrefixToNamespaceMap

public EMap<java.lang.String,java.lang.String> getPrefixToNamespaceMap()
Specified by:
getPrefixToNamespaceMap in interface XMLHelper

recordPrefixToURIMapping

public void recordPrefixToURIMapping()
Description copied from interface: XMLHelper
Must be called during endDocument to record all the prefix to URI mappings that have been seen in the document during loading

Specified by:
recordPrefixToURIMapping in interface XMLHelper

setPrefixToNamespaceMap

public void setPrefixToNamespaceMap(EMap<java.lang.String,java.lang.String> prefixToNamespaceMap)
Specified by:
setPrefixToNamespaceMap in interface XMLHelper

setAnySimpleType

public void setAnySimpleType(EClass type)
Description copied from interface: XMLHelper
Sets the any simple type class.

Specified by:
setAnySimpleType in interface XMLHelper
See Also:
XMLResource.OPTION_ANY_SIMPLE_TYPE

convertToString

public java.lang.String convertToString(EFactory factory,
                                        EDataType dataType,
                                        java.lang.Object value)
Description copied from interface: XMLHelper
Converts the given data value to a string while saving an XML document.

Specified by:
convertToString in interface XMLHelper

createFromString

protected java.lang.Object createFromString(EFactory eFactory,
                                            EDataType eDataType,
                                            java.lang.String value)

updateQNameURI

protected java.lang.Object updateQNameURI(java.lang.Object value)

updateQNamePrefix

protected java.lang.String updateQNamePrefix(EFactory factory,
                                             EDataType dataType,
                                             java.lang.Object value,
                                             boolean list)
Parameters:
factory -
dataType -
value - a data value to be converted to string
list - if the value is part of the list of values
Returns:
if the value is not part of the list, return string corresponding to value, otherwise return null

addNSDeclaration

protected void addNSDeclaration(java.lang.String prefix,
                                java.lang.String uri)

setMustHavePrefix

public void setMustHavePrefix(boolean mustHavePrefix)
Description copied from interface: XMLHelper
Specify if qualified names must have a prefix or could use default namespace (if possible)

Specified by:
setMustHavePrefix in interface XMLHelper

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