Web Services, Part VIII: Reading DTDs with JavaScript: Loading DTDs with a Browser - Doc JavaScript | WebReference

Web Services, Part VIII: Reading DTDs with JavaScript: Loading DTDs with a Browser - Doc JavaScript


Web Services, Part VIII: Reading DTDs with JavaScript

Loading DTDs with the Browser

Let's see the entity reference substitution in action. There are three types of documents involved in our demo: XML, DTD, and XSL. The XML file includes the data itself. The DTD defines the data file structure and reference substitution. The XSL file converts the data to HTML. We discussed how to write the XSL file in Column 100. Try it now. You should get the following window:

Notice how the entity reference &month; was substitute by April, and &preparedby; was substituted by John Smith. Also notice that the single-character entity references &lt; and &gt; around April got substituted by < and >, respectively.

When reading an XML file with your browser, you can use the DTD file only to define reference substitution, and not for defining the whole document structure, as we did above. Consider the following short DTD file:

<!ENTITY preparedby "John Smith">
<!ENTITY month "April">
<!ENTITY day "Monday, ">

The file mydvd8.xml calls this DTD. Try it. You should get the same output as above.


Next: How to load DTDs with JavaScript

https://www.internet.com


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: February 11, 2002
Revised: February 11, 2002

URL: https://www.webreference.com/js/column103/***PASTE FILENAME HERE***