For the JumpStart application, you create the DTDHandler by implementing the IVBSAXDTDHandler interface, as described in the following instructions.
To create the DTDHandlerImpl class
To implement the DTDHandlerImpl class
Note If you have trouble implementing methods and procedures for the DTDHandlerImpl class, refer back to Implementing the ContentHandler to see how methods and properties were implemented for the ContentHandlerImpl class.
The following is the complete code for the DTDHandlerImpl class of the JumpStart application.
Option Explicit
Implements IVBSAXDTDHandler
Private Sub IVBSAXDTDHandler_notationDecl(strName As String, _
strPublicId As String, strSystemId As String)
Dim msg As String
msg = "DTD notation declared:" & vbCrLf & _
"strName: " & strName & vbCrLf & _
"strPublicId: " & strPublicId & vbCrLf & _
"strSystemId: " & strSystemId & vbCrLf
frmMain.rtfOutput.Text = frmMain.rtfOutput.Text & "*** DTD handler: notation delcared *** " & _
vbCrLf & msg
End Sub
Private Sub IVBSAXDTDHandler_unparsedEntityDecl(strName As String, strPublicId _
As String, strSystemId As String, strNotationName As String)
Dim msg As String
msg = "Unparsed entity declaration:" & vbCrLf & _
"strName: " & strName & vbCrLf & _
"strPublicId: " & strPublicId & vbCrLf & _
"strNotationName: " & strNotationName & vbCrLf
frmMain.rtfOutput.Text = frmMain.rtfOutput.Text & "*** DTD handler: unparsed entity delcared *** " & _
vbCrLf & msg
End Sub
In order to see DTD events being processed, use an XML file that includes notation declarations and unparsed entity declarations as input. The following is an example of such a file.
<?xml version="1.0"?>
<!DOCTYPE catalog [
<!ELEMENT catalog (book+) >
<!ELEMENT book (author, title, genre, price, description, cover) >
<!ATTLIST book id ID #REQUIRED>
<!ELEMENT author (#PCDATA) >
<!ELEMENT title (#PCDATA) >
<!ELEMENT genre (#PCDATA) >
<!ELEMENT price (#PCDATA) >
<!ELEMENT description (#PCDATA) >
<!ELEMENT cover EMPTY >
<!ATTLIST cover src ENTITY #REQUIRED>
<!NOTATION jpg SYSTEM "jpeg picture format" >
<!ENTITY xdg134 SYSTEM "graphics/xdg134.jpg" NDATA jpg >
]>
<catalog>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<description>An in-depth look at creating applications with
XML.</description>
<cover src="xdg134" />
</book>
</catalog>
Overview of the JumpStart Application | Implementing the ContentHandler | Implementing the DTDHandler | Creating the Main Form
| This HTML Help has been published using the chm2web software. |