PBDOM_DOCTYPE

Description

The PBDOM_DOCTYPE class represents the Document Type Declaration Object of an XML DOM Document. The PBDOM_DOCTYPE class provides access to the name of the root element that is constrained within the DOCTYPE as well as the internal subset, system, and public IDs.

Methods

Some of the inherited methods from PBDOM_OBJECT serve no meaningful objective and only default or trivial functionalities result. These are described in the following table:

Method

Always returns

AddContent

The current PBDOM_DOCTYPE

GetContent

false

GetText

Empty string

GetTextNormalize

Empty string

GetTextTrim

Empty string

HasChildren

false

InsertContent

The current PBDOM_DOCTYPE

IsAncestorObjectOf

false

RemoveContent

false

SetContent

The current PBDOM_DOCTYPE


PBDOM_DOCTYPE has the following non-trivial methods:


Clone

Description

Creates and returns a clone of the current PBDOM_DOCTYPE.

Syntax

pbdom_doctype_name.Clone(boolean bDeep)

Argument

Description

pbdom_doctype_name

The name of a PBDOM_DOCTYPE object.

bDeep

A boolean specifying whether a deep or shallow clone is returned. Values are TRUE for a deep clone and FALSE for a shallow clone. This argument is currently ignored.


Return value

PBDOM_OBJECT. A deep clone of the current PBDOM_DOCTYPE housed in a PBDOM_OBJECT.

Usage

A PBDOM_DOCTYPE clone (whether shallow or deep) is always an exact copy of its original. This is because a PBDOM_DOCTYPE does not contain any subtree of child PBDOM_OBJECTs.

A PBDOM_DOCTYPE clone has no parent. However, the clone resides in the same PBDOM_DOCUMENT as its original. If the original PBDOM_DOCTYPE is standalone, the clone is standalone.

Detach

Description

Detaches a PBDOM_DOCTYPE object from its parent PBDOM_DOCUMENT object. The detached PBDOM_DOCTYPE object is still part of the PBDOM_DOCUMENT object in which it resided before the Detach method was invoked, but it no longer has a parent PBDOM_DOCUMENT object.

Syntax

pbdom_doctype_name.Detach()

Argument

Description

pbdom_doctype_name

The name of a PBDOM_DOCTYPE object


Return value

PBDOM_OBJECT. The PBDOM_DOCTYPE object modified and returned as a PBDOM_OBJECT object.

Equals

Description

Tests for the equality of the current PBDOM_DOCTYPE and a referenced PBDOM_OBJECT.

Syntax

pbdom_doctype_name.Equals(pbdom_object_ref)

Argument

Description

pbdom_doctype_name

The name of a PBDOM_DOCTYPE object

pbdom_object_ref

A PBDOM_OBJECT to test for equality with the current PBDOM_DOCTYPE


Return value

Boolean.

Returns true if the current PBDOM_DOCTYPE is equivalent to the input PBDOM_OBJECT, and false otherwise.

Usage

True is returned only if the referenced PBDOM_OBJECT is also a PBDOM_DOCTYPE and refers to the same DOM Doctype object as the current PBDOM_DOCTYPE.

GetInternalSubset

Description

Returns the internal subset data of the DOCTYPE.

Syntax

pbdom_doctype_name.GetInternalSubset()

Argument

Description

pbdom_doctype_name

The name of a PBDOM_DOCTYPE object


Return value

String.

See also

SetInternalSubset

GetName

Description

Allows you to obtain the name of the root element that is being constrained within the current PBDOM_DOCTYPE.

Syntax

pbdom_doctype_name.GetName()

Argument

Description

pbdom_doctype_name

The name of a PBDOM_DOCTYPE object


Return value

String.

Examples

If you have the following DOCTYPE declaration, the GetName method returns abc.

<!DOCTYPE abc [<!-- internal subset --> 
<!ELEMENT abc (#PCDATA)> <!ELEMENT data (#PCDATA)> <!ELEMENT inner_data (#PCDATA)>]>

GetObjectClass

Description

Returns a long integer code that indicates the class of the current PBDOM_OBJECT.

Syntax

pbdom_object_name.GetObjectClass()

Argument

Description

pbdom_object_name

The name of a PBDOM_OBJECT


Return value

Long.

A long integer code that indicates the class of the current PBDOM_OBJECT. If pbdom_object_name is a PBDOM_DOCTYPE, the returned value is 4.

GetObjectClassString

Description

Returns a string form of the class of the PBDOM_OBJECT.

Syntax

pbdom_object_name.GetObjectClassString()

Argument

Description

pbdom_object_name

The name of your PBDOM_OBJECT


Return value

String.

A string that indicates the class of the current PBDOM_OBJECT. If pbdom_object_name is a PBDOM_DOCTYPE, the returned string is "pbdom_doctype".

GetOwnerDocumentObject

Description

Returns the owning PBDOM_DOCUMENT of the current PBDOM_DOCTYPE.

Syntax

pbdom_doctype_name.GetOwnerDocumentObject()

Argument

Description

pbdom_doctype_name

The name of a PBDOM_DOCTYPE object


Return value

PBDOM_OBJECT.

Usage

If there is no owning PBDOM_DOCUMENT, null is returned.

GetParentObject

Description

Returns the parent PBDOM_OBJECT of the current PBDOM_DOCTYPE.

Syntax

pbdom_doctype_name.GetParentObject()

Argument

Description

pbdom_doctype_name

The name of a PBDOM_DOCTYPE object


Return value

PBDOM_OBJECT.

Usage

The parent is also a PBDOM_DOCUMENT object. If the PBDOM_OBJECT has no parent, null is returned.

GetPublicID

Description

Retrieves the public ID of an externally reference DTD declared in the DOCTYPE.

Syntax

pbdom_doctype_name.GetPublicID()

Argument

Description

pbdom_doctype_name

The name of a PBDOM_DOCTYPE object


Return value

String.

If no public ID is referenced, an empty string is returned.

Examples

Suppose you have the following DTD declaration:

<!DOCTYPE Books PUBLIC "-//MyCompany//DTD//EN"  "http://mycompany.com/dtd/mydoctype.dtd">

The following PowerScript code displays the public and system IDs in message boxes:

pbdom_doctype pbdom_doctype_1
pbdom_document pbdom_doc

pbdom_doctype_1 = pbdom_doc.GetDocType()
MessageBox ("DocType Public ID", &
   pbdom_doctype_1.GetPublicID())
MessageBox ("DocType System ID", &
   pbdom_doctype_1.GetSystemID())

The returned strings from the calls to GetPublicID and GetSystemID are:

"-//MyCompany//DTD//EN"
"http://mycompany.com/dtd/mydoctype.dtd"

See also

GetSystemID

SetPublicID

SetSystemID

GetSystemID

Description

Retrieves the system ID of an externally referenced DTD declared in the DOCTYPE.

Syntax

pbdom_doctype_name.GetSystemID()

Argument

Description

pbdom_doctype_name

The name of a PBDOM_DOCTYPE object


Return value

String.

If no system ID is referenced, an empty string is returned.

Examples

See GetPublicID.

See also

GetPublicID

SetPublicID

SetSystemID

SetDocument

Description

Sets the owning PBDOM_DOCUMENT of the current PBDOM_DOCTYPE.

Syntax

pbdom_doctype_name.SetDocument(pbdom_document pbdom_document_ref)

Argument

Description

pbdom_doctype_name

The name of a PBDOM_DOCTYPE object

pbdom_document_ref

A PBDOM_DOCUMENT object to be set as the owner document of this PBDOM_DOCTYPE object


Return value

PBDOM_DOCTYPE. The current PBDOM_DOCTYPE modified to be the DOCTYPE of the referenced PBDOM_DOCUMENT.

Throws

EXCEPTION_PBDOM_OBJECT_INVALID_FOR_USE  -- if the input PBDOM_DOCUMENT object is invalid for use in any way.

EXCEPTION_PBDOM_OBJECT_ALREADY_HAS_PARENT  -- if this current PBDOM_DOCTYPE already has a parent PBDOM_OBJECT. In this case, this PBDOM_DOCTYPE is already the DOCTYPE of some document.

Usage

A DOM DOCTYPE object can have no owner document, or it can have an owner document but no parent node. A DOCTYPE that has an owner document as well as a parent node is the actual DOCTYPE of the owner document.

See also

SetParentObject

SetInternalSubset

Description

Sets the data for the internal subset of the PBDOM_DOCTYPE.

Syntax

pbdom_doctype_name.SetInternalSubset()

Argument

Description

pbdom_doctype_name

The name of a PBDOM_DOCTYPE object


Return value

PBDOM_DOCTYPE. The current PBDOM_DOCTYPE with the new internal subset.

Examples

Suppose you have the following DTD declaration:

<!DOCTYPE abc  [<!ELEMENT abc (#PCDATA)> <!ELEMENT data (#PCDATA)> <!ELEMENT inner_data (#PCDATA)>]>

The following code displays the internal subset in a message box:

string strInternalSubset
pbdom_document pbdom_doc

strInternalSubset = pbdom_doc.GetDocType().GetInternalSubset()
strInternalSubset += "<!ELEMENT another_data(#PCDATA)>"
pbdom_doc.GetDocType().SetInternalSubset (strInternalSubset)
MessageBox ("Get Internal Subset", &
   pbdom_doc.GetDocType().GetInternalSubset())

The returned string from the call to GetInternalSubset is:

"<!-- internal subset --> <!ELEMENT abc (#PCDATA)> <!ELEMENT data (#PCDATA)> <!ELEMENT inner_data (#PCDATA)> <!ELEMENT another_data (#PCDATA)>"

The new ELEMENT declaration for "another_data" is included in the final internal subset.

See also

GetInternalSubset

SetName

Description

The SetName method sets the name of the root element that is declared by this PBDOM_DOCTYPE.

Syntax

pbdom_doctype_name.SetName(string strName)

Argument

Description

pbdom_doctype_name

The name of a PBDOM_DOCTYPE object

strName

The new name you want to set for the root element that is declared by the current PBDOM_DOCTYPE


Return value

Boolean.

Returns true if the name of the root element was changed and false otherwise.

SetParentObject

Description

The SetParentObject method sets the referenced PBDOM_OBJECT to be the parent of the current PBDOM_OBJECT and so sets the DOCTYPE represented by this PBDOM_DOCTYPE to be the DOCTYPE of the referenced PBDOM_DOCUMENT.

Syntax

pbdom_doctype_name.SetParentObject(pbdom_object pbdom_object_ref)

Argument

Description

pbdom_doctype_name

The name of a PBDOM_DOCTYPE object

pbdom_object_ref

A PBDOM_OBJECT to be set as the parent of the current PBDOM_DOCTYPE


Return value

PBDOM_OBJECT.

Throws

EXCEPTION_PBDOM_OBJECT_ALREADY_HAS_PARENT  -- If this PBDOM_DOCTYPE already has a parent.

EXCEPTION_MULTIPLE_DOCTYPE  -- If the input PBDOM_OBJECT is a PBDOM_DOCUMENT object and already has a doctype.

EXCEPTION_INAPPROPRIATE_USE_OF_PBDOM_OBJECT  -- If the input PBDOM_OBJECT is not a PBDOM_DOCUMENT.

EXCEPTION_PBDOM_OBJECT_INVALID_FOR_USE  -- If the input PBDOM_OBJECT is not associated with a derived PBDOM_OBJECT.

Usage

This method sets the input PBDOM_OBJECT as the parent of the current PBDOM_OBJECT. The input PBDOM_OBJECT must be a PBDOM_DOCUMENT. If it is not, an exception is thrown.

In PBDOM, calling SetParentObject is equivalent to setting the input PBDOM_DOCUMENT as the owner document and parent node of the current PBDOM_DOCTYPE. This has the effect of setting the DOCTYPE in PBDOM_DOCTYPE as the DOCTYPE of the document.

A DOM DOCTYPE object can have no owner document, or it can have an owner document but no parent node. A DOCTYPE that has an owner document as well as a parent node is the actual DOCTYPE of the owner document.

This method is exactly the same as the SetDocument method.

See also

SetDocument

SetPublicID

Description

Sets the public ID of an externally referenced DTD.

Syntax

pbdom_doctype_name.SetPublicID(string strPublicID)

Argument

Description

pbdom_doctype_name

The name of a PBDOM_DOCTYPE object

strPublicID

A string that specifies the new public ID


Return value

PBDOM_DOCTYPE.

Examples

Suppose you have the following DTD declaration:

<!DOCTYPE abc  [<!ELEMENT abc (#PCDATA)> <!ELEMENT data (#PCDATA)> <!ELEMENT inner_data (#PCDATA)>]>

The following PowerScript sets the public ID, and then gets it and displays it in a message box:

PBDOM_DOCUMENT pbdom_doc

pbdom_doc.GetDocType().SetPublicID &
   ("-//MyCompany//DTD//EN")
MessageBox ("Get Public ID", &
   pbdom_doc.GetDocType().GetPublicID())

The returned string from the GetPublicID call is:

"-//MyCompany//DTD//EN"

The final DOCTYPE definition in the document is:

<!DOCTYPE abc  PUBLIC "-//MyCompany//DTD//EN" [<!ELEMENT abc (#PCDATA)> <!ELEMENT data (#PCDATA)> <!ELEMENT inner_data (#PCDATA)>]>

About Public ID

The PUBLIC ID is usually accompanied by a SYSTEM ID, so the DOCTYPE declaration in this example (with a PUBLIC ID but no SYSTEM ID) might be considered invalid by some parsers.

See also

GetPublicID

GetSystemID

SetSystemID

SetSystemID

Description

Sets the system ID of an externally referenced DTD.

Syntax

pbdom_doctype_name.SetSystemID(strSystemID)

Argument

Description

pbdom_doctype_name

The name of a PBDOM_DOCTYPE object

strSystemID

A string that specifies the new system ID


Return value

PBDOM_DOCTYPE.

Examples

Suppose you have the following DTD declaration:

<!DOCTYPE abc  [<!ELEMENT abc (#PCDATA)> <!ELEMENT data (#PCDATA)> <!ELEMENT inner_data (#PCDATA)>]>

The following PowerScript sets the system ID and then gets it and returns it in a message box:

PBDOM_DOCUMENT pbdom_doc
pbdom_doc.GetDocType().SetSystemID &
   ("http://www.appeon&.com/dtd/datadef.dtd")
MessageBox ("Get System ID", &
   pbdom_doc.GetDocType().GetSystemID())

The returned string from the GetSystemID call is:

"http://www.appeon.com/dtd/datadef.dtd"

The final DOCTYPE definition in the document is:

<!DOCTYPE abc SYSTEM "http://www.appeon.com/dtd/datadef.dtd"[<!ELEMENT abc (#PCDATA)> <!ELEMENT data (#PCDATA)> <!ELEMENT inner_data (#PCDATA)>]>

See also

GetPublicID

GetSystemID

SetPublicID