- java.lang.Object
-
- org.glassfish.jaxb.core.unmarshaller.DOMScanner
-
- All Implemented Interfaces:
InfosetScanner<Node>
,LocatorEx
,Locator
public class DOMScanner extends Object implements LocatorEx, InfosetScanner<Node>
Visits a W3C DOM tree and generates SAX2 events from it.This class is just intended to be used by
AbstractUnmarshallerImpl
. The jakarta.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 org.glassfish.jaxb.core.v2.runtime.unmarshaller.LocatorEx
LocatorEx.Snapshot
-
-
Constructor Summary
Constructors Constructor Description DOMScanner()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
getColumnNumber()
ContentHandler
getContentHandler()
Node
getCurrentElement()
Gets the current element we are parsing.Node
getCurrentLocation()
The same asgetCurrentElement()
but better typed.int
getLineNumber()
jakarta.xml.bind.ValidationEventLocator
getLocation()
Gets the current location in aValidationEventLocator
object.LocatorEx
getLocator()
String
getPublicId()
String
getSystemId()
void
parse(Element e, ContentHandler handler)
Deprecated, for removal: This API element is subject to removal in a future version.in JAXB 2.0 Usescan(Element)
void
parseWithContext(Element e, ContentHandler handler)
Deprecated, for removal: This API element is subject to removal in a future version.in JAXB 2.0 Usescan(Element)
void
scan(Document doc)
void
scan(Element e)
void
scan(Node node)
Parses the given DOM-ish element/document and generates SAX events.void
setContentHandler(ContentHandler handler)
Sets theContentHandler
.void
setLocator(Locator loc)
Configures the locator object that the SAXContentHandler
will see.void
visit(Element e)
Visits an element and its subtree.
-
-
-
Method Detail
-
setLocator
public void setLocator(Locator loc)
Configures the locator object that the SAXContentHandler
will see.
-
scan
public void scan(Node node) throws SAXException
Description copied from interface:InfosetScanner
Parses the given DOM-ish element/document and generates SAX events.- Specified by:
scan
in interfaceInfosetScanner<Node>
- 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
public void scan(Document doc) throws SAXException
- Throws:
SAXException
-
scan
public void scan(Element e) throws SAXException
- Throws:
SAXException
-
parse
@Deprecated(since="2.0", forRemoval=true) public void parse(Element e, ContentHandler handler) throws SAXException
Deprecated, for removal: This API element is subject to removal in a future version.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(since="2.0", forRemoval=true) public void parseWithContext(Element e, ContentHandler handler) throws SAXException
Deprecated, for removal: This API element is subject to removal in a future version.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
public void visit(Element e) throws SAXException
Visits an element and its subtree.- Throws:
SAXException
-
getCurrentLocation
public Node getCurrentLocation()
The same asgetCurrentElement()
but better typed.
-
getCurrentElement
public Node 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<Node>
- Returns:
- never return null.
-
getLocator
public LocatorEx getLocator()
- Specified by:
getLocator
in interfaceInfosetScanner<Node>
-
setContentHandler
public void setContentHandler(ContentHandler handler)
Description copied from interface:InfosetScanner
Sets theContentHandler
. This handler receives the SAX events.- Specified by:
setContentHandler
in interfaceInfosetScanner<Node>
-
getContentHandler
public ContentHandler getContentHandler()
- Specified by:
getContentHandler
in interfaceInfosetScanner<Node>
-
getPublicId
public String getPublicId()
- Specified by:
getPublicId
in interfaceLocator
-
getSystemId
public String 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
public jakarta.xml.bind.ValidationEventLocator getLocation()
Description copied from interface:LocatorEx
Gets the current location in aValidationEventLocator
object.- Specified by:
getLocation
in interfaceLocatorEx
-
-