Chapter 3 DynaScript Predefined Objects


DOMDocumentType properties

The DOMDocumentType object inherits all properties from the DOMNode object, but it also has its own properties, which are discussed in this section.

entities property

Syntax

DOMDocumentType.entities

Description

A DOMNamedNodeMap object containing the general entities both external and internal. Each node in the node map is a DOMEntity object.

Example

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

See also

"DOMEntity object".

"DOMNamedNodeMap object".

name property

Syntax

DOMDocumentType.name

Description

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.

Example

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 );

See also

"documentElement property".

notations property

Syntax

DOMDocumentType.notations

Description

A DOMNamedNodeMap containing the notations declared in the DTD. Each node in the node map is a DOMNotation object.

Example

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.

See also

"DOMNotation object".

"DOMNamedNodeMap object".

 


Copyright © 1999 Sybase, Inc. All rights reserved.