|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface XMLHelper
Configuration class for XML. It holds the EPackage to use when XML namespaces are not used in an XML file. It also holds the XMLMap to be used when serializing an XML file. The XML deserializer and serializer uses this class when an XML file is loaded and saved.
Nested Class Summary | |
---|---|
static interface |
XMLHelper.ManyReference
|
Field Summary | |
---|---|
static int |
DATATYPE_IS_MANY
|
static int |
DATATYPE_SINGLE
These are the kinds of features that are important when loading XMI files. |
static int |
IS_MANY_ADD
|
static int |
IS_MANY_MOVE
|
static int |
OTHER
|
Method Summary | |
---|---|
void |
addPrefix(java.lang.String prefix,
java.lang.String uri)
Records the prefix to URI mapping while loading an XML document. |
java.lang.String |
convertToString(EFactory factory,
EDataType dataType,
java.lang.Object data)
Converts the given data value to a string while saving an XML document. |
EObject |
createObject(EFactory eFactory,
EClassifier type)
Create an object given an EFactory and a type |
EObject |
createObject(EFactory eFactory,
java.lang.String name)
Deprecated. since 2.2. Instead use #createObject(EFactory, EClassifier) and #getType(EFactory, String) |
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. |
java.lang.String |
getHREF(EObject eObject)
Returns an HREF to this object from this resource |
java.lang.String |
getID(EObject eObject)
Returns the xmi:id or null to supress |
java.lang.String |
getIDREF(EObject eObject)
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 eNamedElement)
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. |
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 eClass)
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 eDataType)
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(EStructuralFeature feature)
By default, this method returns the name of the feature. |
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. |
java.lang.Object |
getValue(EObject eObject,
EStructuralFeature eStructuralFeature)
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. |
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 eClass)
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)
|
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 |
setValue(EObject eObject,
EStructuralFeature eStructuralFeature,
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. |
Field Detail |
---|
static final int DATATYPE_SINGLE
static final int DATATYPE_IS_MANY
static final int IS_MANY_ADD
static final int IS_MANY_MOVE
static final int OTHER
Method Detail |
---|
void setOptions(java.util.Map<?,?> options)
void setNoNamespacePackage(EPackage pkg)
EPackage getNoNamespacePackage()
void setAnySimpleType(EClass type)
XMLResource.OPTION_ANY_SIMPLE_TYPE
void setXMLMap(XMLResource.XMLMap map)
XMLResource.XMLMap getXMLMap()
void setExtendedMetaData(ExtendedMetaData extendedMetaData)
ExtendedMetaData getExtendedMetaData()
XMLResource getResource()
java.lang.Object getValue(EObject eObject, EStructuralFeature eStructuralFeature)
java.lang.String getName(ENamedElement eNamedElement)
java.lang.String getQName(EClass eClass)
void populateNameInfo(NameInfo nameInfo, EClass eClass)
NameInfo
with name information, resetting all the current
values in the nameInfo
nameInfo
- the name information to populateeClass
- the EClass for which name has to be computedgetQName(EClass)
java.lang.String getQName(EDataType eDataType)
void populateNameInfo(NameInfo nameInfo, EDataType eDataType)
NameInfo
with name information, resetting all the current
values in the nameInfo
nameInfo
- the name information to fill ineDataType
- the EDataType for which name has to be computedgetQName(EDataType)
java.lang.String getQName(EStructuralFeature feature)
void populateNameInfo(NameInfo nameInfo, EStructuralFeature feature)
NameInfo
with name information, resetting all the current
values in the nameInfo
nameInfo
- the name information to fill infeature
- the EStructuralFeature for which name has to be computedgetQName(EStructuralFeature)
java.lang.String getPrefix(java.lang.String namespaceURI)
java.lang.String getPrefix(EPackage ePackage)
java.lang.String getNamespaceURI(java.lang.String prefix)
java.util.List<java.lang.String> getPrefixes(EPackage ePackage)
java.lang.String getID(EObject eObject)
java.lang.String getIDREF(EObject eObject)
java.lang.String getHREF(EObject eObject)
URI deresolve(URI uri)
EPackage[] packages()
@Deprecated EObject createObject(EFactory eFactory, java.lang.String name)
EObject createObject(EFactory eFactory, EClassifier type)
eFactory
- type
-
createObject(EFactory, String)
EClassifier getType(EFactory eFactory, java.lang.String typeName)
eFactory
- typeName
- createObject(EFactory, String)
void setValue(EObject eObject, EStructuralFeature eStructuralFeature, java.lang.Object value, int position)
EStructuralFeature getFeature(EClass eClass, java.lang.String namespaceURI, java.lang.String name)
EStructuralFeature getFeature(EClass eClass, java.lang.String namespaceURI, java.lang.String name, boolean isElement)
int getFeatureKind(EStructuralFeature feature)
java.lang.String getXMLEncoding(java.lang.String javaEncoding)
java.lang.String getJavaEncoding(java.lang.String xmlEncoding)
java.util.List<XMIException> setManyReference(XMLHelper.ManyReference reference, java.lang.String location)
void setCheckForDuplicates(boolean checkForDuplicates)
void setProcessDanglingHREF(java.lang.String value)
DanglingHREFException getDanglingHREFException()
URI resolve(URI relative, URI base)
void addPrefix(java.lang.String prefix, java.lang.String uri)
java.util.Map<java.lang.String,java.lang.String> getAnyContentPrefixToURIMapping()
void recordPrefixToURIMapping()
java.lang.String getURI(java.lang.String prefix)
void pushContext()
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.
void popContext()
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.
void popContext(java.util.Map<java.lang.String,EFactory> prefixesToFactories)
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.
java.lang.String convertToString(EFactory factory, EDataType dataType, java.lang.Object data)
EMap<java.lang.String,java.lang.String> getPrefixToNamespaceMap()
void setPrefixToNamespaceMap(EMap<java.lang.String,java.lang.String> prefixToNamespaceMap)
void setMustHavePrefix(boolean mustHavePrefix)
mustHavePrefix
-
|
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 |