The interface XMLReader introduces the method setProperty(String name,
Object handler) for binding the implementations of the first two interfaces, through
the following property names.
- http://xml.org/sax/properties/lexical-handler
- http://xml.org/sax/properties/declaration-handler
The interface XMLReader introduces the following method for registering the
DTD handler.
- void setDTDHandler(DTDHandler handler)
An implementation of the above method on input
<?xml version="1.0"?>
<!DOCTYPE myml
SYSTEM "sax-dtd.dtd"
[
<!ENTITY % yes "INCLUDE">
<!ENTITY % no "IGNORE">
<!ENTITY cis "cis.ohio-state.edu" >
]
>
<myml/>
with a DTD file ‘sax-dtd.dtd’
<!NOTATION bin PUBLIC "/home/non xml format" >
<!ENTITY e SYSTEM "/home/el.bin" NDATA bin >
<!ENTITY % how "#PCDATA | br" >
<!ELEMENT br EMPTY >
<![%yes;[
<!ENTITY % ml "myml" >
]]>
<![%no;[
<!ENTITY % ml "yourml" >
]]>
<!ELEMENT %ml; ( %how; )* >
<!ATTLIST %ml;
type (x | y) #IMPLIED
src ENTITY #IMPLIED >
may provide the following trace
startDTD: myml, null, sax-dtd.dtd
internalEntityDecl: %yes, INCLUDE
internalEntityDecl: %no, IGNORE
internalEntityDecl: cis, cis.ohio-state.edu
notationDecl: bin, /home/non xml format, null
unparsedEntityDecl: e, null, file:/home/el.bin, bin
internalEntityDecl: %how, #PCDATA | br
elementDecl: br, EMPTY
internalEntityDecl: %ml, myml
elementDecl: myml, (#PCDATA|br)
attributeDecl: myml, type, (x|y), #IMPLIED, null
attributeDecl: myml, src, ENTITY, #IMPLIED, null