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


C++ NamedNodeMap::getLength方法代码示例

本文整理汇总了C++中NamedNodeMap::getLength方法的典型用法代码示例。如果您正苦于以下问题:C++ NamedNodeMap::getLength方法的具体用法?C++ NamedNodeMap::getLength怎么用?C++ NamedNodeMap::getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NamedNodeMap的用法示例。


在下文中一共展示了NamedNodeMap::getLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: write

void XmlWriter::write(const NodePtr nodeArg)
{
    NodePtr node = nodeArg;

    indent+=2;

    NamedNodeMap attributes = node->getAttributes();
    int nrAttrs = attributes.getLength();

    //### Start open tag
    spaces();
    po("<");
    pos(node->getNodeName());
    if (nrAttrs>0)
        po("\n");

    //### Attributes
    for (int i=0 ; i<nrAttrs ; i++)
        {
        NodePtr attr = attributes.item(i);
        spaces();
        pos(attr->getNodeName());
        po("=\"");
        pos(attr->getNodeValue());
        po("\"\n");
        }

    //### Finish open tag
    if (nrAttrs>0)
        spaces();
    po(">\n");

    //### Contents
    spaces();
    pos(node->getNodeValue());

    //### Children
    for (NodePtr child = node->getFirstChild() ;
         child.get() ;
         child=child->getNextSibling())
        {
        write(child);
        }

    //### Close tag
    spaces();
    po("</");
    pos(node->getNodeName());
    po(">\n");

    indent-=2;
}
开发者ID:Spin0za,项目名称:inkscape,代码行数:52,代码来源:xmlwriter.cpp

示例2: dumpattrs

void dumpattrs(Node *node)
{
    NamedNodeMap  *attrs;
    Attr          *a;
    uword          i;
    size_t         na;

    oratext   *qname;
    oratext   *namespce;
    oratext   *local;
    oratext   *prefix;
    oratext   *value;

    if (attrs = node->getAttributes())
    {
       cout << "\n    ATTRIBUTES: \n";
       for (na = attrs->getLength(), i = 0; i < na; i++)
       { 
          /* get attr qualified name, local name, namespace, and prefix */

          a = (Attr *)attrs->item(i);

          qname = namespce = local = prefix = value = (oratext*)" ";

          if (a->getQualifiedName() != (oratext*)NULL)
             qname = a->getQualifiedName();

          if (a->getNamespace() != (oratext*)NULL)
             namespce = a->getNamespace();

          if (a->getLocal() != (oratext*)NULL)
             local = a->getLocal();

          if (a->getPrefix() != (oratext*)NULL)
             prefix = a->getPrefix();

          if (a->getValue() != (oratext*)NULL)
             value = a->getValue();

          cout << "      " << (char*)qname << " = " << (char*)value << "\n";
          cout << "      Namespace : " << (char*)namespce << "\n";
          cout << "      Local Name: " << (char*)local << "\n";
          cout << "      Prefix    : " << (char*)prefix << "\n\n";
       }
    }
    cout << "\n";
}
开发者ID:amitabha66,项目名称:JLibrary01,代码行数:47,代码来源:DOMNamespace.cpp

示例3: runTest

 /*
  * Runs the test case.
  */
 void runTest()
 {
    Document doc;
    DocumentType docType;
    NamedNodeMap notationList;
    Node notation;
    int notationType;
    doc = (Document) baseT::load("staff", false);
    docType = doc.getDoctype();
    baseT::assertNotNull(docType, __LINE__, __FILE__);
    notationList = docType.getNotations();
    baseT::assertNotNull(notationList, __LINE__, __FILE__);
    for (unsigned int indexN65609 = 0; indexN65609 != notationList.getLength(); indexN65609++) {
        notation = (Node) notationList.item(indexN65609);
  notationType = (int) notation.getNodeType();
    baseT::assertEquals(12, notationType, __LINE__, __FILE__);
  }
    
 }
开发者ID:QuentinFiard,项目名称:arabica,代码行数:22,代码来源:documenttypegetnotationstype.hpp


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