本文整理汇总了C++中DOMNode::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMNode::isNull方法的具体用法?C++ DOMNode::isNull怎么用?C++ DOMNode::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMNode
的用法示例。
在下文中一共展示了DOMNode::isNull方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void
DomUtilsInternal::Dom2XMLString(
const DOMNode* toWrite,
XMLFormatter& fmt )
{
int i;
DOMNode child;
int attrCount;
DOMString id;
DOMNamedNodeMap attributes;
DOMDocumentType doctype;
// Get the name and value out for convenience
DOMString nodeName = toWrite.getNodeName();
DOMString nodeValue = toWrite.getNodeValue();
unsigned long lent = nodeValue.length();
switch (toWrite.getNodeType())
{
case DOMNode::ELEMENT_NODE:
// The name has to be representable without any escapes
fmt << XMLFormatter::NoEscapes << chOpenAngle << nodeName;
// Output the element start tag.
// Output any attributes on this element
attributes = ((DOMElement&)toWrite).getAttributes();
attrCount = attributes.getLength();
for (i = 0; i < attrCount; i++)
{
DOMNode attribute = attributes.item(i);
//
// Again the name has to be completely representable. But the
// attribute can have refs and requires the attribute style
// escaping.
//
fmt << XMLFormatter::NoEscapes
<< chSpace << attribute.getNodeName()
<< chEqual << chDoubleQuote
<< XMLFormatter::AttrEscapes
<< attribute.getNodeValue()
<< XMLFormatter::NoEscapes
<< chDoubleQuote;
}
//
// Test for the presence of children, which includes both
// text content and nested elements.
//
child = toWrite.getFirstChild();
if ( !child.isNull() )
{
// There are children. Close start-tag, and output children.
// No escapes are legal here
fmt << XMLFormatter::NoEscapes << chCloseAngle;
while( !child.isNull() )
{
DomUtilsInternal::Dom2XMLString( child, fmt );
child = child.getNextSibling();
}
//
// Done with children. Output the end tag.
//
fmt << XMLFormatter::NoEscapes << gEndElement
<< nodeName << chCloseAngle;
}
else
{
//
// There were no children. Output the short form close of
// the element start tag, making it an empty-element tag.
//
fmt << XMLFormatter::NoEscapes << chForwardSlash << chCloseAngle;
}
break;
case DOMNode::TEXT_NODE:
fmt.formatBuf( nodeValue.rawBuffer(), lent, XMLFormatter::CharEscapes );
break;
case DOMNode::CDATA_SECTION_NODE :
fmt << XMLFormatter::NoEscapes << gStartCDATA
<< nodeValue << gEndCDATA;
break;
case DOMNode::ENTITY_REFERENCE_NODE:
fmt << XMLFormatter::NoEscapes << chAmpersand
<< nodeName << chSemiColon;
break;
case DOMNode::PROCESSING_INSTRUCTION_NODE :
fmt << XMLFormatter::NoEscapes << gStartPI << nodeName;
if (lent > 0)
{
fmt << chSpace << nodeValue;
//.........这里部分代码省略.........