|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectorg.eclipse.emf.ecore.xmi.impl.XMLHelperImpl
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 inherited from class org.eclipse.emf.ecore.xmi.XMLHelper |
|---|
XMLHelper.ManyReference |
| Field Summary | |
|---|---|
protected java.util.List |
allPrefixToURI
|
protected java.util.Map |
anyPrefixesToURIs
|
protected EClass |
anySimpleType
|
protected boolean |
checkForDuplicates
|
protected DanglingHREFException |
danglingHREFException
|
protected boolean |
deresolve
|
protected ExtendedMetaData |
extendedMetaData
|
protected java.util.Map |
featuresToKinds
|
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 |
packages
|
protected EMap |
prefixesToURIs
|
protected java.lang.String |
processDanglingHREF
|
protected XMLResource |
resource
|
protected URI |
resourceURI
|
protected boolean |
seenEmptyStringMapping
|
protected java.util.Map |
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 valuevalue to 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)
Create an object given an EFactory and a type name. |
URI |
deresolve(URI uri)
Returns a relative URI if necessary and if possible. |
java.util.Map |
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 |
getPrefixes(EPackage ePackage)
Return all the prefixes used for this package. |
EMap |
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 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 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 |
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 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 void |
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 |
protected static final java.lang.Integer INTEGER_DATATYPE_IS_MANY
protected static final java.lang.Integer INTEGER_DATATYPE_SINGLE
protected static final java.lang.Integer INTEGER_IS_MANY_ADD
protected static final java.lang.Integer INTEGER_IS_MANY_MOVE
protected static final java.lang.Integer INTEGER_OTHER
protected EPackage noNamespacePackage
protected XMLResource.XMLMap xmlMap
protected ExtendedMetaData extendedMetaData
protected boolean laxFeatureProcessing
protected EPackage.Registry packageRegistry
protected XMLResource resource
protected URI resourceURI
protected boolean deresolve
protected java.util.Map packages
protected java.util.Map featuresToKinds
protected java.lang.String processDanglingHREF
protected DanglingHREFException danglingHREFException
protected EMap prefixesToURIs
protected java.util.Map urisToPrefixes
protected java.util.Map anyPrefixesToURIs
protected XMLHelperImpl.NamespaceSupport namespaceSupport
protected EClass anySimpleType
protected boolean seenEmptyStringMapping
protected EPackage xmlSchemaTypePackage
protected java.util.List allPrefixToURI
protected boolean checkForDuplicates
protected boolean mustHavePrefix
| Constructor Detail |
public XMLHelperImpl()
public XMLHelperImpl(XMLResource resource)
| Method Detail |
public static java.lang.String saveString(java.util.Map options,
java.util.List contents,
java.lang.String encoding,
XMLHelper helper)
throws java.lang.Exception
java.lang.Exceptionpublic void setOptions(java.util.Map options)
XMLHelper
setOptions in interface XMLHelperpublic void setNoNamespacePackage(EPackage pkg)
XMLHelper
setNoNamespacePackage in interface XMLHelperpublic EPackage getNoNamespacePackage()
XMLHelper
getNoNamespacePackage in interface XMLHelperpublic void setXMLMap(XMLResource.XMLMap map)
XMLHelper
setXMLMap in interface XMLHelperpublic XMLResource.XMLMap getXMLMap()
XMLHelper
getXMLMap in interface XMLHelperpublic void setExtendedMetaData(ExtendedMetaData extendedMetaData)
XMLHelper
setExtendedMetaData in interface XMLHelperpublic ExtendedMetaData getExtendedMetaData()
XMLHelper
getExtendedMetaData in interface XMLHelperpublic XMLResource getResource()
XMLHelper
getResource in interface XMLHelperpublic void setResource(XMLResource resource)
public java.lang.Object getValue(EObject obj,
EStructuralFeature f)
XMLHelper
getValue in interface XMLHelperpublic java.lang.String getQName(EClass c)
XMLHelper
getQName in interface XMLHelper
public void populateNameInfo(NameInfo nameInfo,
EClass c)
XMLHelperNameInfo with name information, resetting all the current
values in the nameInfo
populateNameInfo in interface XMLHelpernameInfo - the name information to populatec - the EClass for which name has to be computedXMLHelper.getQName(EClass)public java.lang.String getQName(EDataType c)
XMLHelper
getQName in interface XMLHelper
public void populateNameInfo(NameInfo nameInfo,
EDataType eDataType)
XMLHelperNameInfo with name information, resetting all the current
values in the nameInfo
populateNameInfo in interface XMLHelpernameInfo - the name information to fill ineDataType - the EDataType for which name has to be computedXMLHelper.getQName(EDataType)public java.lang.String getQName(EStructuralFeature feature)
XMLHelper
getQName in interface XMLHelper
public void populateNameInfo(NameInfo nameInfo,
EStructuralFeature feature)
XMLHelperNameInfo with name information, resetting all the current
values in the nameInfo
populateNameInfo in interface XMLHelpernameInfo - the name information to fill infeature - the EStructuralFeature for which name has to be computedXMLHelper.getQName(EStructuralFeature)
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(EPackage ePackage,
java.lang.String name)
protected java.lang.String getQName(EPackage ePackage,
java.lang.String name,
boolean mustHavePrefix)
public java.lang.String getPrefix(EPackage ePackage)
XMLHelper
getPrefix in interface XMLHelperpublic java.lang.String getNamespaceURI(java.lang.String prefix)
XMLHelper
getNamespaceURI in interface XMLHelper
protected java.lang.String getPrefix(EPackage ePackage,
boolean mustHavePrefix)
public java.util.List getPrefixes(EPackage ePackage)
XMLHelper
getPrefixes in interface XMLHelper
protected java.lang.String getQName(java.lang.String uri,
java.lang.String name)
public java.lang.String getName(ENamedElement obj)
XMLHelper
getName in interface XMLHelperpublic java.lang.String getID(EObject obj)
XMLHelper
getID in interface XMLHelper
protected java.lang.String getURIFragmentQuery(Resource containingResource,
EObject object)
protected java.lang.String getURIFragment(Resource containingResource,
EObject object)
public java.lang.String getIDREF(EObject obj)
XMLHelper
getIDREF in interface XMLHelperprotected URI handleDanglingHREF(EObject object)
public java.lang.String getHREF(EObject obj)
XMLHelper
getHREF in interface XMLHelper
protected URI getHREF(Resource otherResource,
EObject obj)
public URI deresolve(URI uri)
XMLHelper
deresolve in interface XMLHelperpublic int getFeatureKind(EStructuralFeature feature)
XMLHelper
getFeatureKind in interface XMLHelper
public EObject createObject(EFactory eFactory,
EClassifier type)
XMLHelper
createObject in interface XMLHelpereFactory - type -
XMLHelper.createObject(EFactory, String)
public EClassifier getType(EFactory eFactory,
java.lang.String typeName)
XMLHelper
getType in interface XMLHelpereFactory - typeName - XMLHelper.createObject(EFactory, String)
public EObject createObject(EFactory eFactory,
java.lang.String classXMIName)
XMLHelper
createObject in interface XMLHelper
public EStructuralFeature getFeature(EClass eClass,
java.lang.String namespaceURI,
java.lang.String name)
XMLHelper
getFeature in interface XMLHelper
public EStructuralFeature getFeature(EClass eClass,
java.lang.String namespaceURI,
java.lang.String name,
boolean isElement)
XMLHelper
getFeature in interface XMLHelper
protected EStructuralFeature getFeatureWithoutMap(EClass eClass,
java.lang.String name)
protected void computeFeatureKind(EStructuralFeature feature)
public java.lang.String getJavaEncoding(java.lang.String xmlEncoding)
XMLHelper
getJavaEncoding in interface XMLHelperpublic java.lang.String getXMLEncoding(java.lang.String javaEncoding)
XMLHelper
getXMLEncoding in interface XMLHelperpublic EPackage[] packages()
XMLHelper
packages in interface XMLHelper
public void setValue(EObject object,
EStructuralFeature feature,
java.lang.Object value,
int position)
XMLHelper
setValue in interface XMLHelper
public java.util.List setManyReference(XMLHelper.ManyReference reference,
java.lang.String location)
setManyReference in interface XMLHelperpublic void setCheckForDuplicates(boolean checkForDuplicates)
setCheckForDuplicates in interface XMLHelperpublic void setProcessDanglingHREF(java.lang.String value)
setProcessDanglingHREF in interface XMLHelperpublic DanglingHREFException getDanglingHREFException()
getDanglingHREFException in interface XMLHelper
public URI resolve(URI relative,
URI base)
resolve in interface XMLHelperpublic void pushContext()
XMLHelperA 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.
pushContext in interface XMLHelperpublic void popContext()
XMLHelperThe 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.
popContext in interface XMLHelperpublic void popContext(java.util.Map prefixesToFactories)
XMLHelperThe 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.
popContext in interface XMLHelper
public void addPrefix(java.lang.String prefix,
java.lang.String uri)
XMLHelper
addPrefix in interface XMLHelperpublic java.lang.String getPrefix(java.lang.String namespaceURI)
getPrefix in interface XMLHelperpublic java.util.Map getAnyContentPrefixToURIMapping()
XMLHelper
getAnyContentPrefixToURIMapping in interface XMLHelperpublic java.lang.String getURI(java.lang.String prefix)
XMLHelper
getURI in interface XMLHelperpublic EMap getPrefixToNamespaceMap()
getPrefixToNamespaceMap in interface XMLHelperpublic void recordPrefixToURIMapping()
XMLHelper
recordPrefixToURIMapping in interface XMLHelperpublic void setPrefixToNamespaceMap(EMap prefixToNamespaceMap)
setPrefixToNamespaceMap in interface XMLHelperpublic void setAnySimpleType(EClass type)
XMLHelper
setAnySimpleType in interface XMLHelperXMLResource.OPTION_ANY_SIMPLE_TYPE
public java.lang.String convertToString(EFactory factory,
EDataType dataType,
java.lang.Object value)
XMLHelper
convertToString in interface XMLHelper
protected java.lang.Object createFromString(EFactory eFactory,
EDataType eDataType,
java.lang.String value)
protected void updateQNameURI(java.lang.Object value)
protected java.lang.String updateQNamePrefix(EFactory factory,
EDataType dataType,
java.lang.Object value,
boolean list)
factory - dataType - value - a data value to be converted to stringlist - if the value is part of the list of values
protected void addNSDeclaration(java.lang.String prefix,
java.lang.String uri)
public void setMustHavePrefix(boolean mustHavePrefix)
XMLHelper
setMustHavePrefix in interface XMLHelpermustHavePrefix -
|
Copyright 2001-2006 IBM Corporation and others. All Rights Reserved. |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||