SAX Examples: Difference between revisions
Jump to navigation
Jump to search
Line 16: | Line 16: | ||
=Location in an XML Document= | =Location in an XML Document= | ||
The SAX parser provide document location information via an <tt>org.xml.sax.Locator</tt> implementation, injected into the <tt>ContentHandler</tt> with: | |||
<pre> | |||
public void setDocumentLocator(Locator locator) { | |||
... | |||
} | |||
</pre> | |||
Full example: | |||
<blockquote style="background-color: AliceBlue; border: solid thin LightSteelBlue;"> | <blockquote style="background-color: AliceBlue; border: solid thin LightSteelBlue;"> |
Latest revision as of 03:12, 10 November 2016
External
- Parsing an XML File Using SAX https://docs.oracle.com/javase/tutorial/jaxp/sax/parsing.html
- Handling Lexical Events https://docs.oracle.com/javase/tutorial/jaxp/sax/events.html
- Using the DTDHandler and EntityResolver https://docs.oracle.com/javase/tutorial/jaxp/sax/using.html
Internal
Simple Parsing
Location in an XML Document
The SAX parser provide document location information via an org.xml.sax.Locator implementation, injected into the ContentHandler with:
public void setDocumentLocator(Locator locator) { ... }
Full example:
DTD and XML Schema Validation
TODO: https://docs.oracle.com/javase/tutorial/jaxp/sax/validation.html