SAX Examples: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
=External=
=External=


* https://docs.oracle.com/javase/tutorial/jaxp/sax/parsing.html
* 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=
=Internal=
Line 7: Line 9:
* [[JAXP SAX#SAX_Example|SAX]]
* [[JAXP SAX#SAX_Example|SAX]]


=Overview=
=Simple Parsing=


=GitHub=
<blockquote style="background-color: AliceBlue; border: solid thin LightSteelBlue;">
:https://github.com/NovaOrdis/playground/tree/master/java/xml/sax<br>
</blockquote>
 
=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;">
:https://github.com/NovaOrdis/playground/tree/master/java/xml/sax<br>
:https://github.com/NovaOrdis/playground/tree/master/java/xml/sax-location<br>
</blockquote>
</blockquote>
=DTD and XML Schema Validation=
<font color=red>TODO: https://docs.oracle.com/javase/tutorial/jaxp/sax/validation.html</font>

Latest revision as of 03:12, 10 November 2016

External

Internal

Simple Parsing

https://github.com/NovaOrdis/playground/tree/master/java/xml/sax

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:

https://github.com/NovaOrdis/playground/tree/master/java/xml/sax-location

DTD and XML Schema Validation

TODO: https://docs.oracle.com/javase/tutorial/jaxp/sax/validation.html