PrevNextUpHome SophiaFramework UNIVERSE 5.3
SFXXMLDocumentType
[XML] Class which represents a DocumentType node.
#include <SFXXMLDocumentType.hpp>
class SFXXMLDocumentType : public SFXXMLNode;
SFMTYPEDEFCLASS(SFXXMLDocumentType)

Inheritance diagram

 Inheritance diagram of SFXXMLDocumentTypeClass

Collaboration diagram

 Collaboration diagram of SFXXMLDocumentTypeClass

Description

A DocumentType node(SFXXMLDocumentType) contains a document type of the XML document.

[Note] Note
The DocumentType node will be associated with a Document node(SFXXMLDocument) using the functions such as SFXXMLDocument::SetDocumentType, etc.

Reference

SFXXMLNode | SFXXMLAttribute | SFXXMLCDATASection | SFXXMLComment | SFXXMLDocument | SFXXMLDocumentFragment | SFXXMLElement | SFXXMLEntity | SFXXMLEntityReference | SFXXMLNotation | SFXXMLProcessingInstruction | SFXXMLText

Member

Constructor/Destructor
SFXXMLDocumentType( SFXXMLDocumentPtr owner , SFXAnsiStringConstRef name , SFXAnsiStringConstRef publicId , SFXAnsiStringConstRef systemId )
Constructor of the SFXXMLDocumentType class.
SFXXMLDocumentType( SFXXMLDocumentTypeConstRef other , Bool deep = false )
Constructor of the SFXXMLDocumentType class.
~SFXXMLDocumentType( Void )
Destructor of the SFXXMLDocumentType class.
Public Functions
SFCError CloneNode( SFXXMLNodeHandle clonenode , Bool deep )
Create a copy of this node.
Bool EqualNode( SFXXMLNodeConstPtr arg )
Check whether this node equals the specified node or not.
DOMNamedNodeMapPtr GetEntities( Void )
Get all the Entity nodes in the DOM tree.
ACharConstPtr GetInternalSubset( Void )
Get the internal subset.
ACharConstPtr GetName( Void )
Get the node name.
SFXXMLNodePtr GetNextSibling( Void )
Get the next sibling node.
ACharConstPtr GetNodeName( Void )
Get the node name.
NodeType GetNodeType( Void )
Get the node type.
DOMNamedNodeMapPtr GetNotations( Void )
Get all the Notation nodes in the DOM tree.
SFXXMLNodePtr GetParentNode( Void )
Get the parent node.
SFXXMLNodePtr GetPreviousSibling( Void )
Get the previous sibling node.
ACharConstPtr GetPublicID( Void )
Get the public identifier of external subset.
ACharConstPtr GetSystemID( Void )
Get the system identifier of external subset.
Void SetInternalSubset( SFXAnsiStringConstRef intsubset )
Set the internal subset.
SFCError AppendChild( SFXXMLNodeConstPtr newchild ) (inherits from SFXXMLNode)
Append the specified child node at the end.
DOMNodeListPtr GetChildNodes( Void ) (inherits from SFXXMLNode)
Get all the child nodes.
SFXXMLNodePtr GetFirstChild( Void ) (inherits from SFXXMLNode)
Get the first child node.
SFXXMLNodePtr GetLastChild( Void ) (inherits from SFXXMLNode)
Get the last child node.
ACharConstPtr GetNodeValue( Void ) (inherits from SFXXMLNode)
Get the node value.
SFXAnsiString GetText( Void ) (inherits from SFXXMLNode)
Get the node text.
Bool HasChildNodes( Void ) (inherits from SFXXMLNode)
Check whether this node has any child nodes or not.
SFCError InsertBefore( SFXXMLNodeConstPtr newchild , SFXXMLNodeConstPtr refchild ) (inherits from SFXXMLNode)
Insert the specified node.
Bool IsSameNode( SFXXMLNodeConstPtr other ) (inherits from SFXXMLNode)
Check whether this node is the same as the specified one or not.
SFCError RemoveChild( SFXXMLNodeConstPtr oldchild ) (inherits from SFXXMLNode)
Remove the specified child node including its descendant nodes.
SFCError ReplaceChild( SFXXMLNodeConstPtr newchild , SFXXMLNodeConstPtr oldchild ) (inherits from SFXXMLNode)
Replace the specified child node.
Void SetNodeValue( ACharConstPtr value ) (inherits from SFXXMLNode)
Set the node value.
SFCError SetText( SFXAnsiStringConstRef text ) (inherits from SFXXMLNode)
Set the node text.
Types
DOMNamedNodeMap (inherits from SFXXMLNode)
Class to manage the DOM nodes by name
DOMNodeList (inherits from SFXXMLNode)
Class to manage the DOM nodes by list
NodeType (inherits from SFXXMLNode)
SFXXMLNode::NodeType is an enumeration type of NodeType values defined in the W3C DOM Level 1 Specification. Document Object Model (DOM) Level 1 Specification )

SFXXMLDocumentType::SFXXMLDocumentType
Constructor of the SFXXMLDocumentType class.
[ public, explicit ]
SFXXMLDocumentType(
    SFXXMLDocumentPtr owner          // root node of the DOM tree
    SFXAnsiStringConstRef name       // name of the documentType node
    SFXAnsiStringConstRef publicId   // Public identifier of external subset
    SFXAnsiStringConstRef systemId   // System identifier of external subset
);
[ public, explicit ]
SFXXMLDocumentType(
    SFXXMLDocumentTypeConstRef other   // DocumentType node
    Bool deep = false                  // whether or not to copy the child nodes recursively
);

SFXXMLDocumentType::~SFXXMLDocumentType
Destructor of the SFXXMLDocumentType class.
[ public, virtual ]
virtual ~SFXXMLDocumentType(Void);

SFXXMLDocumentType::CloneNode
Create a copy of this node.
[ public, virtual ]
SFCError CloneNode(
    SFXXMLNodeHandle clonenode   // target node where to copy this node(Handle type)
    Bool deep                    // whether or not to copy the child nodes recursively
);

Argument

clonenode

Specify the target node where to copy this node.

deep

If true is set to this argument, copy the child nodes recursively.

Otherwise, copy only this node.

Return value

  • If succeeds: SFERR_NO_ERROR
  • If failed: SFERR_FAILED

Reference

SFXXMLNode::CloneNode | SFXXMLNode


SFXXMLDocumentType::EqualNode
Check whether this node equals the specified node or not.
[ public, virtual, const ]
Bool EqualNode(
    SFXXMLNodeConstPtr arg   // the specified node 
);

Return value

  • If yes: true
  • Otherwise: false

Reference

SFXXMLNode::EqualNode | SFXXMLNode


SFXXMLDocumentType::GetEntities
Get all the Entity nodes in the DOM tree.
[ public, const ]
DOMNamedNodeMapPtr GetEntities(Void);

Return value

Return all the Entity nodes in the DOM tree as the pointer to the SFXXMLNode::DOMNamedNodeMap instance.

Example

<?xml version="1.0" encoding="shift_JIS" standalone="yes" ?>
<!DOCTYPE list[
<!ELEMENT list (name, email)>
<!ENTITY  Name "sophia">
<!ENTITY  Email "&Name;@s-cradle.com">
<!ELEMENT name "(#PCDATA)">
<!ELEMENT email "(#PCDATA)">
<!ATTLIST name number (001|002|003) #REQUIRED>
]>
<list>
   <name number="001">Sophia Cradle</name>
  <email address>&Email;</email>
</list> 

// get DocumentType node from root node
SFXXMLDocumentTypePtr docType = root->GetDocumentType();
if (docType) {
    // get all the Entity nodes in the DOM tree
    SFXXMLNode::DOMNamedNodeMapPtr nodemap = docType->GetEntities();
    if (nodemap) {
        // get "name" Entity node
 SFXXMLEntityPtr name = SFXXMLEntityPtr(nodemap->Item(0));
        // get "Email" Entity node
 SFXXMLEntityPtr mail = SFXXMLEntityPtr(nodemap->Item(1));
        ....
        
        // add new Entity node "<!ENTITY company SYSTEM "company.dtd">"
 SFXXMLEntityPtr entity = document.CreateEntity("company");
    	entity->SetSystemID("company.dtd");
    	nodemap->SetNamedItem(entity);
	}
}

Reference

SFXXMLNode::DOMNamedNodeMap | SFXXMLEntity | SFXXMLNode


SFXXMLDocumentType::GetInternalSubset
Get the internal subset.
[ public, const ]
ACharConstPtr GetInternalSubset(Void);

Return value

Return the internal subset if it exists. Otherwise, null is returned.

[Note] Note
No square bracket for the delimiter is included in the return value.

Reference

SFXXMLDocumentType::SetInternalSubset


SFXXMLDocumentType::GetName
Get the node name.
[ public, const ]
ACharConstPtr GetName(Void);

Description

Get the name of the DocumentType node.

Same as the SFXXMLDocumentType::GetNodeName function.

[Note] Note
The name of the DocumentType node is the doctype name of the XML document.

Reference

SFXXMLDocumentType::GetNodeName


SFXXMLDocumentType::GetNextSibling
Get the next sibling node.
[ public, virtual, const ]
SFXXMLNodePtr GetNextSibling(Void);

Return value

Return the next sibling node of this node. If this node has no next sibling node, null is returned.

Reference

SFXXMLDocumentType::GetPreviousSibling | SFXXMLNode::GetNextSibling | SFXXMLNode::GetPreviousSibling | SFXXMLNode


SFXXMLDocumentType::GetNodeName
Get the node name.
[ public, virtual, const ]
ACharConstPtr GetNodeName(Void);

Description

Get the name of the DocumentType node.

Same as the SFXXMLDocumentType::GetName function.

[Note] Note
The name of the DocumentType node is the doctype name of the XML document.

Reference

SFXXMLDocumentType::GetName | SFXXMLNode::GetNodeName | SFXXMLNode


SFXXMLDocumentType::GetNodeType
Get the node type.
[ public, virtual, const ]
NodeType GetNodeType(Void);

Return value

Return DOCUMENT_TYPE_NODE.

Reference

SFXXMLNode::NodeType | SFXXMLNode::GetNodeType | SFXXMLNode


SFXXMLDocumentType::GetNotations
Get all the Notation nodes in the DOM tree.
[ public, const ]
DOMNamedNodeMapPtr GetNotations(Void);

Return value

Return all the Notation nodes in the DOM tree as the pointer to the SFXXMLNode::DOMNamedNodeMap instance.

Example

<?xml version="1.0" encoding="shift_JIS" standalone="yes" ?>
<!DOCTYPE Studio [
<!ELEMENT Studio ANY>
<!ELEMENT MultiMedia (#PCDATA)>
<!ATTLIST MultiMedia player NOTATION (rm|gif|midi) #REQUIRED>
<!NOTATION gif SYSTEM "Image/gif">
<!NOTATION rm SYSTEM "RealPlayer.exe">
<!NOTATION midi SYSTEM "wmplayer.exe">
]>
<Studio>
   <MultiMedia player="rm"></MultiMedia>
</Studio>

// get DocumentType node from root node of DOM tree
SFXXMLDocumentTypePtr docType = root->GetDocumentType();
if (docType) {
    // get all Notation nodes in the DOM tree
    SFXXMLNode::DOMNamedNodeMapPtr nodemap = docType->GetNotations();
    if (nodemap) {
        // get "gif" Notation node
 SFXXMLNotationPtr gif = SFXXMLNotationPtr(nodemap->Item(0));
        // get "rm" Notation node
 SFXXMLNotationPtr rm = SFXXMLNotationPtr(nodemap->Item(1));
        // get "midi" Notation node
 SFXXMLNotationPtr midi = SFXXMLNotationPtr(nodemap->Item(2));
        ....
            
        // add new Notation node "<!NOTATION mp3 SYSTEM "winamp.exe">"
 SFXXMLNotationPtr mp3 = document.CreateNotation("mp3");
    	mp3->SetSystemID("winamp.exe");
    	nodemap->SetNamedItem(mp3);
	}
}

Reference

SFXXMLNode::DOMNamedNodeMap | SFXXMLNotation | SFXXMLNode


SFXXMLDocumentType::GetParentNode
Get the parent node.
[ public, virtual, const ]
SFXXMLNodePtr GetParentNode(Void);

Return value

Return the parent node of this node. Return null if this node has no parent.

Reference

SFXXMLNode::GetParentNode | SFXXMLNode


SFXXMLDocumentType::GetPreviousSibling
Get the previous sibling node.
[ public, virtual, const ]
SFXXMLNodePtr GetPreviousSibling(Void);

Return value

Return the previous sibling node of this node. If this node has no previous sibling node, null is returned.

Reference

SFXXMLDocumentType::GetNextSibling | SFXXMLNode::GetPreviousSibling | SFXXMLNode::GetNextSibling | SFXXMLNode


SFXXMLDocumentType::GetPublicID
Get the public identifier of external subset.
[ public, const ]
ACharConstPtr GetPublicID(Void);

SFXXMLDocumentType::GetSystemID
Get the system identifier of external subset.
[ public, const ]
ACharConstPtr GetSystemID(Void);

SFXXMLDocumentType::SetInternalSubset
Set the internal subset.
[ public ]
Void SetInternalSubset(
    SFXAnsiStringConstRef intsubset   // internal subset to set
);

Reference

SFXXMLDocumentType::GetInternalSubset