|
To access the contents, click the chapter and section titles.
Platinum Edition Using HTML 4, XML, and Java 1.2
Every error message consists of the following:
Note that XML for Java gives you all of the errors at once. This is very different from DXP, which presents errors up until a fatal error is encountered. With XML for Java, it is possible to check the DTD directly by adding the parameter dtd to the command line, and to read the file with the external subset directly: jre -cp c:\xml4j\xml4j.jar trlx dtd c:\xmlex\dtdv.dtd This is a much cleaner approach that will generate the same set of error messages (except for the last error, which points out that the document has no element).
Checking the Validity of XML Files with DXPYou have seen how to use two different tools to parse and validate your XML DTDs. As noted earlier in the chapter, you can use both tools to validate an XML file as well. This section examines how to validate an XML document using DXP. To use DXP as a document validator, enter a command like the following at the DOS prompt: jre cp .;c:\datachannel\dxp\classes dxpcl s v c:\xmlex\wfq.xml Heres a breakdown of what you just typed:
The file wfq.xml that is being submitted to DXP is shown in Listing 16.5. Listing 16.5 XML Document to Check for Validity <?xml version=1.0 ?> <?protext objid=I5678 ?> <!DOCTYPE helptopic [ <!ENTITY doubleclick Double-click> ]> <helptopic> <title keyword=printing,network;printing,shared printer>How to use a shared network printer?</title> <procedure> <step><action>In <icon>Network Neighborhood</icon>, locate and double-click the computer where the printer you want to use is located. </action> <tip targetgroup=beginners>To see which computers have shared printers attached, click the <menu>View</menu> menu, click <menu>Details</menu>, & look for printer names or descriptions in the Comment column of the Network Neighborhood window.</tip> </step> <step> <action>&doubleclick; the printer icon in the window that appears. </action> </step> <step> <action> To set up the printer, <xref linkend=id45>follow the instructions</xref> on the screen. </action></step> </procedure> <rule form=double/> <tip> <p>After you have set up a network printer, you can use it as if it were attached to your computer. For related topics, look up "printing" in the Help Index. </p> </tip> </helptopic> Earlier in the chapter, you validated the DTD shown in Listing 16.6 for helptopic documents. Listing 16.6 Validated DTD for helptopic Documents <!NOTATION bmp SYSTEM paint.exe> <!NOTATION gif SYSTEM > <!ENTITY % admonitions (tip | warning | note) > <!ENTITY % paracontent (#PCDATA | icon | menu | xref | iconbmp)* > <!ELEMENT helptopic (title, rule, procedure, rule?, %admonitions;) > <!ATTLIST helptopic id ID #IMPLIED> <!ELEMENT title (#PCDATA) > <!ATTLIST title keyword CDATA #IMPLIED> <!ELEMENT procedure (step+)> <!ELEMENT step (action, (%admonitions;)*) > <!ELEMENT action %paracontent; > <!ELEMENT tip %paracontent; > <!ATTLIST tip targetgroup (beginners | specialists) beginners > <!ELEMENT warning %paracontent; > <!ELEMENT note %paracontent; > <!ELEMENT icon (#PCDATA) > <!ELEMENT menu (#PCDATA|shortcut)*> <!ELEMENT xref (#PCDATA) > <!ATTLIST xref linkend IDREF #REQUIRED> <!ELEMENT shortcut (#PCDATA)> <!ELEMENT iconbmp EMPTY> <!ATTLIST iconbmp src ENTITY #REQUIRED type NOTATION (bmp | gif) gif> DXP will use this DTD to check wfq.xml for validity. DXP will know to use this DTD once the filename dtdv.dtd is included in the doctype declaration of wfq.xml: <!DOCTYPE helptopic SYSTEM dtdv.dtd []> Thus, the file becomes the following: <?xml version=1.0 ?> <?protext objid=I5678 ?> <!DOCTYPE helptopic SYSTEM dtdv.dtd [ <!ENTITY doubleclick Double-click> ]> <helptopic> ... <tip> <p>After you have set up a network printer, you can use it as if it were attached to your computer. For related topics, look up "printing" in the Help Index. </p> </tip> </helptopic>
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |