|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
org.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.MyEObjectStack
|
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 EObject |
createDocumentRoot(String prefix,
String uri,
String name,
EFactory eFactory,
boolean top)
|
protected EcoreBuilder |
createEcoreBuilder(Map options,
ExtendedMetaData extendedMetaData)
|
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)
Deprecated. since 2.2 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 |
endDTD()
|
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 |
endEntity(String name)
|
void |
endPrefixMapping(String prefix)
|
void |
error(SAXParseException e)
|
void |
error(XMIException e)
|
void |
fatalError(SAXParseException 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 void |
handleNamespaceAttribs()
Deprecated. since 2.2 |
protected abstract void |
handleObjectAttribs(EObject obj)
Process the XML attributes for the newly created object. |
protected void |
handleProxy(InternalEObject proxy,
String uriLiteral)
|
protected void |
handleSchemaLocation()
|
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)
|
void |
ignorableWhitespace(char[] ch,
int start,
int length)
|
protected boolean |
isError()
Returns true if there was an error in the last XML element; false otherwise. |
protected boolean |
isNull()
Returns true if the xsi:nil attribute is in the list of attributes. |
protected boolean |
isTextFeatureValue(Object type)
|
void |
notationDecl(String name,
String publicId,
String systemId)
|
void |
prepare(XMLResource resource,
XMLHelper helper,
Map options)
|
protected void |
processElement(String name,
String prefix,
String localName)
|
void |
processingInstruction(String target,
String data)
|
protected void |
processObject(EObject object)
Add object to appropriate stacks. |
protected void |
processSchemaLocations(String prefix,
String name)
|
protected void |
processTopObject(EObject object)
Add object to extent and call processObject. |
protected EMap |
recordNamespacesSchemaLocations(EObject root)
|
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)
|
void |
reset()
|
InputSource |
resolveEntity(String publicId,
String systemId)
|
protected 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. |
void |
setDocumentLocator(Locator locator)
|
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 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 |
skippedEntity(String name)
|
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 |
startElement(String uri,
String localName,
String qName,
Attributes attributes)
|
void |
startEntity(String name)
|
void |
startPrefixMapping(String prefix,
String uri)
|
protected XMIException |
toXMIException(SAXParseException e)
|
void |
unparsedEntityDecl(String name,
String publicId,
String systemId,
String notationName)
|
protected void |
validateCreateObjectFromFactory(EFactory factory,
String typeName,
EObject newObject)
|
protected EObject |
validateCreateObjectFromFactory(EFactory factory,
String typeName,
EObject newObject,
boolean top)
|
protected EObject |
validateCreateObjectFromFactory(EFactory factory,
String typeName,
EObject newObject,
EStructuralFeature feature)
|
void |
warning(SAXParseException e)
|
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.MyEObjectStack objects
protected XMLHandler.MyStack types
protected XMLHandler.MyStack mixedTargets
protected Map prefixesToFactories
protected Map urisToLocations
protected Map externalURIToLocations
protected boolean processSchemaLocations
protected InternalEList extent
protected List deferredExtent
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 boolean useNewMethods
protected boolean recordAnyTypeNSDecls
protected Map eObjectToExtensionMap
protected EStructuralFeature contextFeature
protected EPackage xmlSchemaTypePackage
protected boolean deferIDREFResolution
protected boolean processAnyXML
protected EcoreBuilder ecoreBuilder
protected boolean isRoot
protected Locator locator
protected Attributes attribs
protected Map featuresToKinds
protected boolean useConfigurationCache
protected boolean needsPushContext
Constructor Detail |
public XMLHandler(XMLResource xmlResource, XMLHelper helper, Map options)
Method Detail |
protected void setExtendedMetaDataOption(Object extendedMetaDataOption)
public void prepare(XMLResource resource, XMLHelper helper, Map options)
prepare
in interface XMLDefaultHandler
public void reset()
reset
in interface XMLDefaultHandler
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
ignorableWhitespace
in interface ContentHandler
SAXException
public void skippedEntity(String name) throws SAXException
skippedEntity
in interface ContentHandler
SAXException
protected XMIException toXMIException(SAXParseException e)
public void warning(SAXParseException e) throws SAXException
warning
in interface ErrorHandler
SAXException
public void error(SAXParseException e) throws SAXException
error
in interface ErrorHandler
SAXException
public void fatalError(SAXParseException e) throws SAXException
fatalError
in interface ErrorHandler
SAXException
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
SAXException
public void startEntity(String name)
startEntity
in interface LexicalHandler
public void endEntity(String name)
endEntity
in interface LexicalHandler
public void comment(char[] ch, int start, int length)
comment
in interface LexicalHandler
public void startCDATA()
startCDATA
in interface LexicalHandler
public void endCDATA()
endCDATA
in interface LexicalHandler
public void startDTD(String name, String publicId, String systemId)
startDTD
in interface LexicalHandler
public void endDTD()
endDTD
in interface LexicalHandler
public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName) throws SAXException
unparsedEntityDecl
in interface DTDHandler
SAXException
public void notationDecl(String name, String publicId, String systemId) throws SAXException
notationDecl
in interface DTDHandler
SAXException
public InputSource resolveEntity(String publicId, String systemId) throws SAXException
resolveEntity
in interface EntityResolver
SAXException
protected abstract String getXSIType()
protected abstract void handleObjectAttribs(EObject obj)
protected void handleNamespaceAttribs()
protected void handleSchemaLocation()
protected boolean isNull()
protected Object setAttributes(Object attributes)
protected void setLocator(Object locator)
public void startDocument()
startDocument
in interface ContentHandler
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()
endDocument
in interface ContentHandler
protected EMap recordNamespacesSchemaLocations(EObject root)
protected EObject createObjectByType(String prefix, String name, boolean top)
protected EObject createDocumentRoot(String prefix, String uri, String name, EFactory eFactory, boolean top)
protected void createTopObject(String prefix, String name)
protected void processTopObject(EObject object)
public void endElement(String uri, String localName, String name)
endElement
in interface ContentHandler
protected boolean isTextFeatureValue(Object type)
public void startPrefixMapping(String prefix, String uri)
startPrefixMapping
in interface ContentHandler
public void endPrefixMapping(String prefix)
endPrefixMapping
in interface ContentHandler
public void characters(char[] ch, int start, int length)
characters
in interface ContentHandler
public void processingInstruction(String target, String data)
processingInstruction
in interface ContentHandler
protected void handleXMLNSAttribute(String attrib, String value)
protected void handleXSISchemaLocation(String schemaLocations)
protected void handleXSINoNamespaceSchemaLocation(String noNamespaceSchemaLocation)
protected void processSchemaLocations(String prefix, String name)
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 EObject validateCreateObjectFromFactory(EFactory factory, String typeName, EObject newObject, boolean top)
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()
protected EcoreBuilder createEcoreBuilder(Map options, ExtendedMetaData extendedMetaData)
|
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 |