Package com.sun.xml.bind.unmarshaller
Class DOMScanner
java.lang.Object
com.sun.xml.bind.unmarshaller.DOMScanner
- All Implemented Interfaces:
InfosetScanner
,LocatorEx
,Locator
Visits a W3C DOM tree and generates SAX2 events from it.
This class is just intended to be used by AbstractUnmarshallerImpl
.
The javax.xml.bind.helpers package is generally a wrong place to put
classes like this.
- Since:
- JAXB 1.0
- Author:
- Kohsuke Kawaguchi, Sun Microsystems, Inc.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.sun.xml.bind.v2.runtime.unmarshaller.LocatorEx
LocatorEx.Snapshot
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the current element we are parsing.The same asgetCurrentElement()
but better typed.int
Gets the current location in aValidationEventLocator
object.void
parse
(Element e, ContentHandler handler) Deprecated.void
parseWithContext
(Element e, ContentHandler handler) Deprecated.in JAXB 2.0 Usescan(Element)
void
Parses the given DOM-ish element/document and generates SAX events.void
void
void
setContentHandler
(ContentHandler handler) Sets theContentHandler
.void
setLocator
(Locator loc) Configures the locator object that the SAXContentHandler
will see.void
Visits an element and its subtree.
-
Constructor Details
-
DOMScanner
public DOMScanner()
-
-
Method Details
-
setLocator
Configures the locator object that the SAXContentHandler
will see. -
scan
Description copied from interface:InfosetScanner
Parses the given DOM-ish element/document and generates SAX events.- Specified by:
scan
in interfaceInfosetScanner
- Throws:
SAXException
- If theContentHandler
throws aSAXException
. Do not throw an exception just because the scanner failed (if that can happen we need to change the API.)
-
scan
- Throws:
SAXException
-
scan
- Throws:
SAXException
-
parse
Deprecated.in JAXB 2.0 Usescan(Element)
Parses a subtree starting from the element e and reports SAX2 events to the specified handler.- Throws:
SAXException
-
parseWithContext
Deprecated.in JAXB 2.0 Usescan(Element)
Similar to the parse method but it visits the ancestor nodes and properly emulate the all in-scope namespace declarations.- Throws:
SAXException
-
visit
Visits an element and its subtree.- Throws:
SAXException
-
getCurrentLocation
The same asgetCurrentElement()
but better typed. -
getCurrentElement
Description copied from interface:InfosetScanner
Gets the current element we are parsing.This method could be called from the
ContentHandler.startElement(String, String, String, Attributes)
orContentHandler.endElement(String, String, String)
.Otherwise the behavior of this method is undefined.
- Specified by:
getCurrentElement
in interfaceInfosetScanner
- Returns:
- never return null.
-
getLocator
- Specified by:
getLocator
in interfaceInfosetScanner
-
setContentHandler
Description copied from interface:InfosetScanner
Sets theContentHandler
. This handler receives the SAX events.- Specified by:
setContentHandler
in interfaceInfosetScanner
-
getContentHandler
- Specified by:
getContentHandler
in interfaceInfosetScanner
-
getPublicId
- Specified by:
getPublicId
in interfaceLocator
-
getSystemId
- Specified by:
getSystemId
in interfaceLocator
-
getLineNumber
public int getLineNumber()- Specified by:
getLineNumber
in interfaceLocator
-
getColumnNumber
public int getColumnNumber()- Specified by:
getColumnNumber
in interfaceLocator
-
getLocation
Description copied from interface:LocatorEx
Gets the current location in aValidationEventLocator
object.- Specified by:
getLocation
in interfaceLocatorEx
- Returns:
-
scan(Element)