Chapter 3 DynaScript Predefined Objects
The DOMDocumentType
object inherits
all properties from the DOMNode
object, but
it also has its own properties, which are discussed in this section.
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 © 1999 Sybase, Inc. All rights reserved. |