org.eclipse.emf.ecore.xmi
Interface XMLHelper

All Known Implementing Classes:
XMLHelperImpl

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.


Inner 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)
           
 EObject createObject(EFactory eFactory, java.lang.String name)
          Create an object given an EFactory and a type name.
 DanglingHREFException getDanglingHREFException()
           
 EStructuralFeature getFeature(EClass eClass, java.lang.String namespaceURI, java.lang.String name)
          Returns the structural feature for 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
 EPackage getNoNamespacePackage()
          Gets the package to use when there is no XML namespace in an XML file.
 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(EStructuralFeature feature)
          By default, this method returns the name of the feature.
 XMLResource getResource()
          Returns the resource
 java.lang.String getURI(java.lang.String prefix)
           
 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()
 URI resolve(URI relative, URI base)
           
 java.util.List setManyReference(XMLHelper.ManyReference reference, java.lang.String location)
           
 void setNoNamespacePackage(EPackage pkg)
          Sets the package to use when there is no XML namespace in an XML file.
 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

DATATYPE_SINGLE

public static final int DATATYPE_SINGLE
These are the kinds of features that are important when loading XMI files.

DATATYPE_IS_MANY

public static final int DATATYPE_IS_MANY

IS_MANY_ADD

public static final int IS_MANY_ADD

IS_MANY_MOVE

public static final int IS_MANY_MOVE

OTHER

public static final int OTHER
Method Detail

setNoNamespacePackage

public void setNoNamespacePackage(EPackage pkg)
Sets the package to use when there is no XML namespace in an XML file.

getNoNamespacePackage

public EPackage getNoNamespacePackage()
Gets the package to use when there is no XML namespace in an XML file.

setXMLMap

public void setXMLMap(XMLResource.XMLMap map)
Sets the XMLMap to use when serializing an XML file.

getXMLMap

public XMLResource.XMLMap getXMLMap()
Gets the XMLMap to use when serializing an XML file.

getResource

public XMLResource getResource()
Returns the resource

getValue

public java.lang.Object getValue(EObject eObject,
                                 EStructuralFeature eStructuralFeature)
Returns the XMI value of the EObject's feature

getName

public java.lang.String getName(ENamedElement eNamedElement)
Returns the XML name of the ENamedElement

getQName

public 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. If the map has a target namespace specified, that target namespace is used rather than the namespace from the EPackage.

getQName

public java.lang.String getQName(EStructuralFeature feature)
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.

getID

public java.lang.String getID(EObject eObject)
Returns the xmi:id or null to supress

getIDREF

public java.lang.String getIDREF(EObject eObject)
Returns an IDREF to this object

getHREF

public java.lang.String getHREF(EObject eObject)
Returns an HREF to this object from this resource

packages

public EPackage[] packages()
Returns the packages in getQName()

createObject

public EObject createObject(EFactory eFactory,
                            java.lang.String name)
Create an object given an EFactory and a type name.

setValue

public void setValue(EObject eObject,
                     EStructuralFeature eStructuralFeature,
                     java.lang.Object value,
                     int position)
Set the value of the feature for the object.

getFeature

public EStructuralFeature getFeature(EClass eClass,
                                     java.lang.String namespaceURI,
                                     java.lang.String name)
Returns the structural feature for the given namespaceURI and name.

getFeatureKind

public int getFeatureKind(EStructuralFeature feature)
Return the kind of feature.

getXMLEncoding

public java.lang.String getXMLEncoding(java.lang.String javaEncoding)
Return an XML encoding corresponding to the given Java encoding. By default, the Java encoding is returned.

getJavaEncoding

public java.lang.String getJavaEncoding(java.lang.String xmlEncoding)
Return a Java encoding corresponding to the given XML encoding. By default, the XML encoding is returned.

setManyReference

public java.util.List setManyReference(XMLHelper.ManyReference reference,
                                       java.lang.String location)

setProcessDanglingHREF

public void setProcessDanglingHREF(java.lang.String value)

getDanglingHREFException

public DanglingHREFException getDanglingHREFException()

resolve

public URI resolve(URI relative,
                   URI base)

addPrefix

public void addPrefix(java.lang.String prefix,
                      java.lang.String uri)

getURI

public java.lang.String getURI(java.lang.String prefix)

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