Package com.sun.xml.bind.unmarshaller
Class DOMScanner
- java.lang.Object
-
- com.sun.xml.bind.unmarshaller.DOMScanner
-
- All Implemented Interfaces:
InfosetScanner
,LocatorEx
,org.xml.sax.Locator
public class DOMScanner extends java.lang.Object implements LocatorEx, InfosetScanner
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 Constructor Description DOMScanner()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
getColumnNumber()
org.xml.sax.ContentHandler
getContentHandler()
java.lang.Object
getCurrentElement()
Gets the current element we are parsing.org.w3c.dom.Node
getCurrentLocation()
The same asgetCurrentElement()
but better typed.int
getLineNumber()
javax.xml.bind.ValidationEventLocator
getLocation()
Gets the current location in aValidationEventLocator
object.LocatorEx
getLocator()
java.lang.String
getPublicId()
java.lang.String
getSystemId()
void
parse(org.w3c.dom.Element e, org.xml.sax.ContentHandler handler)
Deprecated.in JAXB 2.0 Usescan(Element)
void
parseWithContext(org.w3c.dom.Element e, org.xml.sax.ContentHandler handler)
Deprecated.in JAXB 2.0 Usescan(Element)
void
scan(java.lang.Object node)
Parses the given DOM-ish element/document and generates SAX events.void
scan(org.w3c.dom.Document doc)
void
scan(org.w3c.dom.Element e)
void
setContentHandler(org.xml.sax.ContentHandler handler)
Sets theContentHandler
.void
setLocator(org.xml.sax.Locator loc)
Configures the locator object that the SAXContentHandler
will see.void
visit(org.w3c.dom.Element e)
Visits an element and its subtree.
-
-
-
Method Detail
-
setLocator
public void setLocator(org.xml.sax.Locator loc)
Configures the locator object that the SAXContentHandler
will see.
-
scan
public void scan(java.lang.Object node) throws org.xml.sax.SAXException
Description copied from interface:InfosetScanner
Parses the given DOM-ish element/document and generates SAX events.- Specified by:
scan
in interfaceInfosetScanner
- Throws:
org.xml.sax.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(org.w3c.dom.Document doc) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
scan
public void scan(org.w3c.dom.Element e) throws org.xml.sax.SAXException
- Throws:
org.xml.sax.SAXException
-
parse
public void parse(org.w3c.dom.Element e, org.xml.sax.ContentHandler handler) throws org.xml.sax.SAXException
Deprecated.in JAXB 2.0 Usescan(Element)
Parses a subtree starting from the element e and reports SAX2 events to the specified handler.- Throws:
org.xml.sax.SAXException
-
parseWithContext
public void parseWithContext(org.w3c.dom.Element e, org.xml.sax.ContentHandler handler) throws org.xml.sax.SAXException
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:
org.xml.sax.SAXException
-
visit
public void visit(org.w3c.dom.Element e) throws org.xml.sax.SAXException
Visits an element and its subtree.- Throws:
org.xml.sax.SAXException
-
getCurrentLocation
public org.w3c.dom.Node getCurrentLocation()
The same asgetCurrentElement()
but better typed.
-
getCurrentElement
public java.lang.Object 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
public LocatorEx getLocator()
- Specified by:
getLocator
in interfaceInfosetScanner
-
setContentHandler
public void setContentHandler(org.xml.sax.ContentHandler handler)
Description copied from interface:InfosetScanner
Sets theContentHandler
. This handler receives the SAX events.- Specified by:
setContentHandler
in interfaceInfosetScanner
-
getContentHandler
public org.xml.sax.ContentHandler getContentHandler()
- Specified by:
getContentHandler
in interfaceInfosetScanner
-
getPublicId
public java.lang.String getPublicId()
- Specified by:
getPublicId
in interfaceorg.xml.sax.Locator
-
getSystemId
public java.lang.String getSystemId()
- Specified by:
getSystemId
in interfaceorg.xml.sax.Locator
-
getLineNumber
public int getLineNumber()
- Specified by:
getLineNumber
in interfaceorg.xml.sax.Locator
-
getColumnNumber
public int getColumnNumber()
- Specified by:
getColumnNumber
in interfaceorg.xml.sax.Locator
-
getLocation
public javax.xml.bind.ValidationEventLocator getLocation()
Description copied from interface:LocatorEx
Gets the current location in aValidationEventLocator
object.- Specified by:
getLocation
in interfaceLocatorEx
- Returns:
-
-