|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.emf.ecore.xmi.impl.XMLHandler
This class is a generic interface for loading XML files and creating EObjects from them. Its subclasses include the SAXXMLHandler class, which wraps this class in a SAX default handler.
Nested Class Summary | |
protected static class |
XMLHandler.ManyReference
|
protected static class |
XMLHandler.MyStack
|
protected static class |
XMLHandler.SingleReference
For unresolved forward references, the line number where the incorrect id appeared in an XML resource is needed, so the Value for the forward reference and the line number where the forward reference occurred must be saved until the end of the XML resource is encountered. |
Constructor Summary | |
XMLHandler(XMLResource xmlResource,
XMLHelper helper,
Map options)
|
Method Summary | |
void |
characters(char[] ch,
int start,
int length)
|
void |
comment(char[] ch,
int start,
int length)
|
protected void |
createObject(EObject peekObject,
EStructuralFeature feature)
Create an object based on the given feature and attributes. |
protected EObject |
createObjectByType(String prefix,
String name,
boolean top)
Create an object based on the prefix and type name. |
protected EObject |
createObjectFromFactory(EFactory factory,
String typeName)
Create an object given a content helper, a factory, and a type name, and process the XML attributes. |
protected EObject |
createObjectFromFeatureType(EObject peekObject,
EStructuralFeature feature)
Create an object based on the type of the given feature. |
protected EObject |
createObjectFromTypeName(EObject peekObject,
String typeQName,
EStructuralFeature feature)
Create an object from the given qualified type name. |
protected void |
createTopObject(String prefix,
String name)
|
void |
endCDATA()
|
void |
endDocument()
Check if the values of the forward references have been set (they may have been set due to a bi-directional reference being set). |
void |
endElement(String uri,
String localName,
String name)
Pop the appropriate stacks and set features whose values are in the content of XML elements. |
void |
endPrefixMapping(String prefix)
|
void |
error(XMIException e)
|
void |
fatalError(XMIException e)
|
protected int |
getColumnNumber()
|
protected AnyType |
getExtension(EObject peekObject)
|
protected EFactory |
getFactoryForPrefix(String prefix)
|
protected EStructuralFeature |
getFeature(EObject object,
String prefix,
String name)
Deprecated. |
protected EStructuralFeature |
getFeature(EObject object,
String prefix,
String name,
boolean isElement)
Get the EStructuralFeature from the metaObject for the given object and feature name. |
protected int |
getLineNumber()
|
protected String |
getLocation()
|
protected EPackage |
getPackageForURI(String uriString)
Attempt to get the namespace for the given prefix, then return ERegister.getPackage() or null. |
protected URIConverter |
getURIConverter()
|
static String |
getXMLEncoding(byte[] bytes)
Searches the array of bytes to determine the XML encoding. |
protected abstract String |
getXSIType()
Returns the xsi type attribute's value. |
protected void |
growArrays()
|
protected void |
handleCDATA()
|
protected void |
handleComment(String comment)
|
protected void |
handleFeature(String prefix,
String name)
The XML element represents a feature. |
protected void |
handleForwardReferences()
|
protected void |
handleForwardReferences(boolean isEndDocument)
Check if the values of the forward references have been set (they may have been set due to a bi-directional reference being set). |
protected EPackage |
handleMissingPackage(String uriString)
|
protected void |
handleMixedText()
|
protected abstract void |
handleNamespaceAttribs()
Process the XML namespace declarations. |
protected abstract void |
handleObjectAttribs(EObject obj)
Process the XML attributes for the newly created object. |
protected void |
handleProxy(InternalEObject proxy,
String uriLiteral)
|
protected void |
handleTopLocations(String prefix,
String name)
|
protected void |
handleUnknownFeature(String prefix,
String name,
boolean isElement,
EObject peekObject,
String value)
|
protected void |
handleXMLNSAttribute(String attrib,
String value)
|
protected void |
handleXSINoNamespaceSchemaLocation(String noNamespaceSchemaLocation)
|
protected void |
handleXSISchemaLocation(String schemaLocations)
|
protected boolean |
isError()
Returns true if there was an error in the last XML element; false otherwise. |
protected abstract boolean |
isNull()
Returns true if the xsi:nil attribute is in the list of attributes. |
protected boolean |
isTextFeatureValue(Object type)
|
protected void |
processElement(String name,
String prefix,
String localName)
|
protected void |
processObject(EObject object)
Add object to appropriate stacks. |
protected void |
processTopObject(EObject object)
Add object to extent and call processObject. |
protected void |
recordUnknownFeature(String prefix,
String name,
boolean isElement,
EObject peekObject,
String value)
|
protected void |
reportUnknownFeature(String prefix,
String name,
boolean isElement,
EObject peekObject,
String value)
|
protected abstract Object |
setAttributes(Object attributes)
Sets the current attributes and returns the old ones. |
protected void |
setAttribValue(EObject object,
String name,
String value)
Create a feature with the given name for the given object with the given values. |
protected void |
setExtendedMetaDataOption(Object extendedMetaDataOption)
|
protected void |
setFeatureValue(EObject object,
EStructuralFeature feature,
Object value)
|
protected void |
setFeatureValue(EObject object,
EStructuralFeature feature,
Object value,
int position)
Set the given feature of the given object to the given value. |
protected void |
setFeatureValues(XMLHandler.ManyReference reference)
Set the values for the given multi-valued forward reference. |
protected abstract void |
setLocator(Object locator)
Sets the object that might be used for determining the line and column number. |
protected void |
setValueFromId(EObject object,
EReference eReference,
String ids)
Create a ValueLine object and put it in the list of references to resolve at the end of the document. |
void |
startCDATA()
|
void |
startDocument()
|
void |
startDTD(String name,
String publicId,
String systemId)
|
void |
startElement(String uri,
String localName,
String name)
This method determines whether to make an object or not, then makes an object based on the XML attributes and the metamodel. |
void |
startPrefixMapping(String prefix,
String uri)
|
protected void |
validateCreateObjectFromFactory(EFactory factory,
String typeName,
EObject newObject)
|
protected EObject |
validateCreateObjectFromFactory(EFactory factory,
String typeName,
EObject newObject,
EStructuralFeature feature)
|
void |
warning(XMIException e)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final String ERROR_TYPE
protected static final String OBJECT_TYPE
protected static final String UNKNOWN_FEATURE_TYPE
protected static final String DOCUMENT_ROOT_TYPE
protected static final String TYPE_ATTRIB
protected static final String NIL_ATTRIB
protected static final String SCHEMA_LOCATION_ATTRIB
protected static final String NO_NAMESPACE_SCHEMA_LOCATION_ATTRIB
protected static final boolean DEBUG_DEMANDED_PACKAGES
protected XMLResource xmlResource
protected XMLHelper helper
protected XMLHandler.MyStack elements
protected XMLHandler.MyStack objects
protected XMLHandler.MyStack types
protected XMLHandler.MyStack mixedTargets
protected Map prefixesToFactories
protected Map urisToLocations
protected InternalEList extent
protected ResourceSet resourceSet
protected EPackage.Registry packageRegistry
protected URI resourceURI
protected boolean resolve
protected boolean oldStyleProxyURIs
protected boolean disableNotify
protected StringBuffer text
protected boolean isIDREF
protected boolean isSimpleFeature
protected List sameDocumentProxies
protected List forwardSingleReferences
protected List forwardManyReferences
protected Object[] identifiers
protected int[] positions
protected static final int ARRAY_SIZE
protected static final int REFERENCE_THRESHOLD
protected int capacity
protected Set notFeatures
protected String idAttribute
protected String hrefAttribute
protected XMLResource.XMLMap xmlMap
protected ExtendedMetaData extendedMetaData
protected EClass anyType
protected EClass anySimpleType
protected boolean recordUnknownFeature
protected Map eObjectToExtensionMap
protected EStructuralFeature contextFeature
protected EPackage xmlSchemaTypePackage
Constructor Detail |
public XMLHandler(XMLResource xmlResource, XMLHelper helper, Map options)
Method Detail |
protected void setExtendedMetaDataOption(Object extendedMetaDataOption)
protected abstract void handleObjectAttribs(EObject obj)
protected abstract void handleNamespaceAttribs()
protected abstract boolean isNull()
protected abstract Object setAttributes(Object attributes)
protected abstract void setLocator(Object locator)
protected abstract String getXSIType()
public void startDocument()
public void startElement(String uri, String localName, String name)
protected void processElement(String name, String prefix, String localName)
protected void handleForwardReferences()
protected void handleForwardReferences(boolean isEndDocument)
public void endDocument()
protected EObject createObjectByType(String prefix, String name, boolean top)
protected void createTopObject(String prefix, String name)
protected void processTopObject(EObject object)
public void endElement(String uri, String localName, String name)
protected boolean isTextFeatureValue(Object type)
public void startPrefixMapping(String prefix, String uri)
public void endPrefixMapping(String prefix)
public void characters(char[] ch, int start, int length)
public void comment(char[] ch, int start, int length)
public void startCDATA()
public void endCDATA()
public void startDTD(String name, String publicId, String systemId)
protected void handleXMLNSAttribute(String attrib, String value)
protected void handleXSISchemaLocation(String schemaLocations)
protected void handleXSINoNamespaceSchemaLocation(String noNamespaceSchemaLocation)
protected void handleTopLocations(String prefix, String name)
protected void handleFeature(String prefix, String name)
protected int getLineNumber()
protected int getColumnNumber()
protected String getLocation()
protected AnyType getExtension(EObject peekObject)
protected void handleUnknownFeature(String prefix, String name, boolean isElement, EObject peekObject, String value)
protected void recordUnknownFeature(String prefix, String name, boolean isElement, EObject peekObject, String value)
protected void reportUnknownFeature(String prefix, String name, boolean isElement, EObject peekObject, String value)
public void error(XMIException e)
public void warning(XMIException e)
public void fatalError(XMIException e)
protected void createObject(EObject peekObject, EStructuralFeature feature)
protected EObject createObjectFromTypeName(EObject peekObject, String typeQName, EStructuralFeature feature)
protected EObject createObjectFromFeatureType(EObject peekObject, EStructuralFeature feature)
protected EObject createObjectFromFactory(EFactory factory, String typeName)
protected void validateCreateObjectFromFactory(EFactory factory, String typeName, EObject newObject)
protected EObject validateCreateObjectFromFactory(EFactory factory, String typeName, EObject newObject, EStructuralFeature feature)
protected void processObject(EObject object)
protected EFactory getFactoryForPrefix(String prefix)
protected EPackage getPackageForURI(String uriString)
protected EPackage handleMissingPackage(String uriString)
protected URIConverter getURIConverter()
protected void setFeatureValue(EObject object, EStructuralFeature feature, Object value)
protected void setFeatureValue(EObject object, EStructuralFeature feature, Object value, int position)
protected void setFeatureValues(XMLHandler.ManyReference reference)
protected void setAttribValue(EObject object, String name, String value)
protected void setValueFromId(EObject object, EReference eReference, String ids)
protected void handleProxy(InternalEObject proxy, String uriLiteral)
protected void growArrays()
protected boolean isError()
protected EStructuralFeature getFeature(EObject object, String prefix, String name)
protected EStructuralFeature getFeature(EObject object, String prefix, String name, boolean isElement)
public static String getXMLEncoding(byte[] bytes)
protected void handleComment(String comment)
protected void handleMixedText()
protected void handleCDATA()
|
Copyright 2001-2004 IBM Corporation and others. All Rights Reserved. |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |