Class DOMReader
- java.lang.Object
-
- org.eclipse.persistence.internal.oxm.record.XMLReader
-
- org.eclipse.persistence.internal.oxm.record.XMLReaderAdapter
-
- org.eclipse.persistence.internal.oxm.record.DOMReader
-
- All Implemented Interfaces:
org.xml.sax.XMLReader
- Direct Known Subclasses:
XMLFragmentReader
public class DOMReader extends XMLReaderAdapter
INTERNAL:Purpose: An implementation of XMLReader for parsing DOM Nodes into SAX events.
Responsibilities:
- Walk the DOM tree and report sax events to the provided content handler
- Report lexical events to the lexical handler if it's provided
- Listen for callbacks from the Mapping-Level framework to handle caching nodes for document preservation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classDOMReader.IndexedAttributeListImplementation of Attributes - used to pass along a given node's attributes to the startElement method of the reader's content handler.protected static classDOMReader.LocatorImpl-
Nested classes/interfaces inherited from class org.eclipse.persistence.internal.oxm.record.XMLReaderAdapter
XMLReaderAdapter.Attribute, XMLReaderAdapter.ExtendedContentHandlerAdapter
-
Nested classes/interfaces inherited from class org.eclipse.persistence.internal.oxm.record.XMLReader
XMLReader.ValidatingContentHandler
-
-
Field Summary
-
Fields inherited from class org.eclipse.persistence.internal.oxm.record.XMLReaderAdapter
contentHandler, lexicalHandler
-
Fields inherited from class org.eclipse.persistence.internal.oxm.record.XMLReader
locator, NAMESPACE_PREFIXES_FEATURE, REPORT_IGNORED_ELEMENT_CONTENT_WHITESPACE_FEATURE, validatingContentHandler
-
-
Constructor Summary
Constructors Constructor Description DOMReader()DOMReader(Unmarshaller xmlUnmarshaller)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DOMReader.IndexedAttributeListbuildAttributeList(org.w3c.dom.Element elem)protected voidendDocument()Trigger an endDocument event on the contenthandler.protected voidendPrefixMappings(org.w3c.dom.Element elem)java.lang.ObjectgetCurrentObject(CoreAbstractSession session, Mapping selfRecordMapping)DocumentPreservationPolicygetDocPresPolicy()protected java.lang.StringgetQName(org.w3c.dom.Element elem)protected voidhandleChildNodes(org.w3c.dom.NodeList children)protected voidhandleNewNamespaceDeclaration(org.w3c.dom.Element elem, java.lang.String emptyString, java.lang.String value)protected voidhandlePrefixedAttribute(org.w3c.dom.Element elem)Handle prefixed attribute - may need to declare the namespace URI locally.protected voidhandleXsiTypeAttribute(org.w3c.dom.Attr attr)voidnewObjectEvent(java.lang.Object object, java.lang.Object parent, Mapping selfRecordMapping)An EclipseLink specific callback into the Reader.voidparse(org.w3c.dom.Node node)voidparse(org.w3c.dom.Node node, java.lang.String newURI, java.lang.String newName)voidparse(org.xml.sax.InputSource input)protected voidprocessParentNamespaces(org.w3c.dom.Element element)Process namespace declarations on parent elements if not the root.protected voidreportElementEvents(org.w3c.dom.Element elem)protected voidreportElementEvents(org.w3c.dom.Element elem, java.lang.String newUri, java.lang.String newName)voidsetDocPresPolicy(DocumentPreservationPolicy policy)protected voidsetupLocator(org.w3c.dom.Document doc)protected voidstartDocument()Trigger a startDocument event on the contenthandler.-
Methods inherited from class org.eclipse.persistence.internal.oxm.record.XMLReaderAdapter
getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getLexicalHandler, getProperty, parse, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setLexicalHandler, setProperty
-
Methods inherited from class org.eclipse.persistence.internal.oxm.record.XMLReader
convertValueBasedOnSchemaType, getLocator, getMediaType, getNamespaceSeparator, getValidatorHandler, getValue, isInCollection, isNamespaceAware, isNullRecord, isNullRepresentedByXsiNil, setLocator, setNamespaceAware, setNamespaceSeparator, setValidatorHandler
-
-
-
-
Constructor Detail
-
DOMReader
public DOMReader()
-
DOMReader
public DOMReader(Unmarshaller xmlUnmarshaller)
-
-
Method Detail
-
parse
public void parse(org.xml.sax.InputSource input) throws org.xml.sax.SAXException
-
parse
public void parse(org.w3c.dom.Node node, java.lang.String newURI, java.lang.String newName) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
parse
public void parse(org.w3c.dom.Node node) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
processParentNamespaces
protected void processParentNamespaces(org.w3c.dom.Element element) throws org.xml.sax.SAXExceptionProcess namespace declarations on parent elements if not the root. For each parent node from current to root push each onto a stack, then pop each off, calling startPrefixMapping for each XMLNS attribute. Using a stack ensures that the parent nodes are processed top down.- Parameters:
element-- Throws:
org.xml.sax.SAXException
-
reportElementEvents
protected void reportElementEvents(org.w3c.dom.Element elem) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
reportElementEvents
protected void reportElementEvents(org.w3c.dom.Element elem, java.lang.String newUri, java.lang.String newName) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
buildAttributeList
protected DOMReader.IndexedAttributeList buildAttributeList(org.w3c.dom.Element elem) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
endPrefixMappings
protected void endPrefixMappings(org.w3c.dom.Element elem) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
getQName
protected java.lang.String getQName(org.w3c.dom.Element elem) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
handleNewNamespaceDeclaration
protected void handleNewNamespaceDeclaration(org.w3c.dom.Element elem, java.lang.String emptyString, java.lang.String value)
-
handleXsiTypeAttribute
protected void handleXsiTypeAttribute(org.w3c.dom.Attr attr) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
handlePrefixedAttribute
protected void handlePrefixedAttribute(org.w3c.dom.Element elem) throws org.xml.sax.SAXExceptionHandle prefixed attribute - may need to declare the namespace URI locally.- Throws:
org.xml.sax.SAXException
-
handleChildNodes
protected void handleChildNodes(org.w3c.dom.NodeList children) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
endDocument
protected void endDocument() throws org.xml.sax.SAXExceptionTrigger an endDocument event on the contenthandler.- Throws:
org.xml.sax.SAXException
-
startDocument
protected void startDocument() throws org.xml.sax.SAXExceptionTrigger a startDocument event on the contenthandler.- Throws:
org.xml.sax.SAXException
-
newObjectEvent
public void newObjectEvent(java.lang.Object object, java.lang.Object parent, Mapping selfRecordMapping)An EclipseLink specific callback into the Reader. This allows Objects to be associated with the XML Nodes they came from.- Overrides:
newObjectEventin classXMLReader
-
getCurrentObject
public java.lang.Object getCurrentObject(CoreAbstractSession session, Mapping selfRecordMapping)
- Overrides:
getCurrentObjectin classXMLReader
-
getDocPresPolicy
public DocumentPreservationPolicy getDocPresPolicy()
-
setDocPresPolicy
public void setDocPresPolicy(DocumentPreservationPolicy policy)
-
setupLocator
protected void setupLocator(org.w3c.dom.Document doc)
-
-