当前位置: 首页>>代码示例>>C++>>正文


C++ DOMNode::isNull方法代码示例

本文整理汇总了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;
//.........这里部分代码省略.........
开发者ID:CSanchezAustin,项目名称:cslib,代码行数:101,代码来源:XmlDomUtilsInternal.cpp


注:本文中的DOMNode::isNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。