Use caution: this function does NOT escape, encode, or otherwise change the contents of the string.
This means that if your string contains two hyphens in a row (--), that will *end* the comment, which can easily create invalid XML when the document is serialized.
DOMDocument::createComment
(PHP 5)
DOMDocument::createComment — 新しい comment ノードを作成する
説明
この関数は、DOMComment クラスの新しいインスタンスを作成します。このノードは、(たとえば) DOMNode->appendChild() などで 挿入されない限り、ドキュメント内に現われません。
パラメータ
- data
-
コメントの内容。
返り値
新しい DOMComment、あるいはエラーが発生した場合は FALSE を返します。
参考
- DOMNode::appendChild - 子要素群の最後に新しい子要素を追加する
- DOMDocument::createAttribute - 新しい属性を作成する
- DOMDocument::createAttributeNS - 関連付けられた名前空間に新しい属性を作成する
- DOMDocument::createCDATASection - 新しい cdata ノードを作成する
- DOMDocument::createDocumentFragment - 新しい文書片を作成する
- DOMDocument::createElement - 新しい要素ノードを作成する
- DOMDocument::createElementNS - 関連付けられた名前空間に新しい要素を作成する
- DOMDocument::createEntityReference - 新しいエンティティ参照ノードを作成する
- DOMDocument::createProcessingInstruction - 新しい PI ノードを作成する
- DOMDocument::createTextNode - 新しいテキストノードを作成する
DOMDocument::createComment
capps at solareclipse dot net
30-Mar-2007 08:55
30-Mar-2007 08:55
