PrevNextUpHome BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1
SFXXMLDocumentType
[XML] Class that 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 SFXXMLDocumentType class.
SFXXMLDocumentType( SFXXMLDocumentTypeConstRef other , Bool deep = false )
Constructor of SFXXMLDocumentType class.
~SFXXMLDocumentType( Void )
Destructor of SFXXMLDocumentType class.
Public Functions
SFCError AppendChild( SFXXMLNodeConstPtr newchild )
Append a specified child node at the end.
SFCError CloneNode( SFXXMLNodeHandle clonenode , Bool deep )
Create a copy of this node.
Bool EqualNode( SFXXMLNodeConstPtr arg )
Check whether this node equals a specified node or not.
DOMNodeListPtr GetChildNodes( Void )
Get all the child nodes.
DOMNamedNodeMapPtr GetEntities( Void )
Get all the Entity nodes in the DOM tree.
SFXXMLNodePtr GetFirstChild( Void )
Get the first child node.
ACharConstPtr GetInternalSubset( Void )
Get the internal subset.
SFXXMLNodePtr GetLastChild( Void )
Get the last child node.
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.
Bool HasChildNodes( Void )
Check whether this node has any child nodes or not.
SFCError InsertBefore( SFXXMLNodeConstPtr newchild , SFXXMLNodeConstPtr refchild )
Insert a specified node.
SFCError RemoveChild( SFXXMLNodeConstPtr oldchild )
Remove a specified child node including its descendant nodes.
SFCError ReplaceChild( SFXXMLNodeConstPtr newchild , SFXXMLNodeConstPtr oldchild )
Replace a specified child node.
Void SetInternalSubset( SFXAnsiStringConstRef intsubset )
Set the internal subset.
ACharConstPtr GetNodeValue( Void ) (inherits from SFXXMLNode)
Get the node value.
SFXAnsiString GetText( Void ) (inherits from SFXXMLNode)
Get the node text.
Bool IsSameNode( SFXXMLNodeConstPtr other ) (inherits from SFXXMLNode)
Check whether this node is the same as a specified one or not.
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 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 SFXXMLDocumentType class.
[ public, virtual ]
virtual ~SFXXMLDocumentType(Void);

SFXXMLDocumentType::AppendChild
Append a specified child node at the end.
[ public, virtual ]
SFCError AppendChild(
    SFXXMLNodeConstPtr newchild   // child node to append
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Description

The "newchild" node is appended as the last child node to this node without copying it.

If the "newchild" node belongs to a DOM tree, it will be removed from that tree.

Reference

SFXXMLNode::AppendChild | SFXXMLNode


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

  • Success : SFERR_NO_ERROR
  • If failed : SFERR_FAILED

Reference

SFXXMLNode::CloneNode | SFXXMLNode


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

Return value

  • If yes : true
  • Otherwise : false

Reference

SFXXMLNode::EqualNode | SFXXMLNode


SFXXMLDocumentType::GetChildNodes
Get all the child nodes.
[ public, virtual, const ]
DOMNodeListPtr GetChildNodes(Void);

Return value

Return the pointer to the SFXXMLNode::DOMNodeList instance that contains all child nodes of this node.

Description

[Note] Note
Each element of SFXXMLNode::DOMNodeList is of the "pointer to the SFXXMLNode" type.

Reference

SFXXMLNode::DOMNodeList | SFXXMLNode::GetChildNodes | 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::GetFirstChild
Get the first child node.
[ public, virtual, const ]
SFXXMLNodePtr GetFirstChild(Void);

Return value

Return the first child node of this node. Return null if this node has no child.

Reference

SFXXMLNode::GetFirstChild | 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::GetLastChild
Get the last child node.
[ public, virtual, const ]
SFXXMLNodePtr GetLastChild(Void);

Return value

Return the last child node of this node. Return null if this node has no child.

Reference

SFXXMLNode::GetLastChild | SFXXMLNode


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::HasChildNodes
Check whether this node has any child nodes or not.
[ public, virtual, const ]
Bool HasChildNodes(Void);

Return value

  • Has child node : true
  • Does not have any child : false

Reference

SFXXMLNode::HasChildNodes | SFXXMLNode


SFXXMLDocumentType::InsertBefore
Insert a specified node.
[ public, virtual ]
SFCError InsertBefore(
    SFXXMLNodeConstPtr newchild   // node to insert
    SFXXMLNodeConstPtr refchild   // newchild node is inserted before refchild node
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Reference

SFXXMLNode::InsertBefore | SFXXMLNode


SFXXMLDocumentType::RemoveChild
Remove a specified child node including its descendant nodes.
[ public, virtual ]
SFCError RemoveChild(
    SFXXMLNodeConstPtr oldchild   // child node to remove
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid parameter : SFERR_INVALID_PARAM
  • If failed : SFERR_FAILED

Reference

SFXXMLNode::RemoveChild | SFXXMLNode


SFXXMLDocumentType::ReplaceChild
Replace a specified child node.
[ public, virtual ]
SFCError ReplaceChild(
    SFXXMLNodeConstPtr newchild   // new child node to replace with
    SFXXMLNodeConstPtr oldchild   // old child node to be replaced
);

Return value

  • Success : SFERR_NO_ERROR
  • If invalid argument : SFERR_INVALID_PARAM
  • If insufficient memory : SFERR_NO_MEMORY
  • If failed : SFERR_FAILED

Reference

SFXXMLNode::ReplaceChild | SFXXMLNode


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

Reference

SFXXMLDocumentType::GetInternalSubset