Chapter 3 DynaScript Predefined Objects
Represents the document type definition (DTD) portion of an XML document.
To use a DOMDocumentType's property:
DOMDocumentType.propertyName
To use a DOMDocumentType's method:
DOMDocumentType.MethodName( parameter )
The DOMDocumentType
object
is accessible through the docType
property
of a DOMDocument
object.
The DOMDocumentType
object
provides access to the list of entities and notations declared in
the DTD. DOM Level 1 does not support access to any other portion
of the DTD.
The DOMDocumentType
object
has no methods of its own, but it does inherit all of the properties
and methods from the DOMNode
object
as well as the properties defined here.
This example assigns a DOMDocumentType
object
to the variable dtd:
var xmlDoc = document.value.xml ; var domDoc = toDOMDocument( xmlDoc ); var dtd = domDoc.doctype;
DOMDocumentType.entities
A DOMNamedNodeMap
object
containing the general entities both external and internal. Each
node in the node map is a DOMEntity
object.
This XML document has a very simple DTD, consisting only of entity declarations (only the first part of the document is shown).
<?xml version='1.0' encoding='ISO-8859-1'?> <!DOCTYPE Customers [ <!ENTITY PQ "Province of Quebec"> <!ENTITY Logo SYSTEM "nautilus.gif" NDATA GIF> ]> <Customers><Customer><FName>Jessie...
If this XML document is held in a string named xmlDoc, this script writes out the entity names:
var domDoc = toDOMDocument( xmlDoc ); var dtd = domDoc.doctype; var entlist = dtd.entities for( iEnt = 0; iEnt < entlist.length; iEnt++ ){ ent = entlist.item(iEnt); document.writeln( "Name = " + ent.nodeName ); }
The output from this example is:
Name = PQ Name = Logo
DOMDocumentType.name
A string containing the name of the DTD that immediately follows the DOCTYPE keyword.
In XML, the name of the DTD must match that of the document element.
This XML document has a very simple DTD, consisting only of entity declarations (only the first part of the document is shown).
<?xml version='1.0' encoding='ISO-8859-1'?> <!DOCTYPE Customers [ <!ENTITY PQ "Province of Quebec"> <!ENTITY Logo SYSTEM "nautilus.gif" NDATA GIF> ]> <Customers><Customer><FName>Jessie...
If this XML document is held in a string named xmlDoc, this script writes out the DTD name.
var domDoc = toDOMDocument( xmlDoc.source); var dtd = domDoc.doctype; document.writeln( "Doctype name = " + dtd.name );
DOMDocumentType.notations
A DOMNamedNodeMap
containing
the notations declared in the DTD. Each node in the node map is
a DOMNotation
object.
This XML document has a very simple DTD, consisting only of entity declarations (only the first part of the document is shown).
<?xml version='1.0' encoding='ISO-8859-1'?> <!DOCTYPE Customers [ <!ENTITY PQ "Province of Quebec"> <!ENTITY Logo SYSTEM "nautilus.gif" NDATA GIF> ]> <Customers><Customer><FName>Jessie...
If this XML document is held in a string named xmlDoc, this script writes out the notation name of the Logo entity.
Copyright © 2001 Sybase, Inc. All rights reserved. |
![]() |