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


C++ DOMElement::getTextContent方法代码示例

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


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

示例1: DumpTree

void CXercesUtils::DumpTree (DOMNode *tree, std::string &tmp)
{
  tabs+="\t";
  if (tree != NULL)
    {
		if (tree->getNodeType () != DOMNode::ELEMENT_NODE)
			goto leave;
		DOMElement*  e = (DOMElement* ) tree;
		std::string el_name =  XMLString::transcode(tree->getNodeName());

		std::string el_value;
		if(e->getTextContent () && e->getChildElementCount() == (XMLSize_t) 0)
			el_value = XMLString::transcode(e->getTextContent ());

		tmp+=  tabs + "<"+  el_name + ">" + el_value +  "\n";

      for (DOMNode* child = tree->getFirstChild();
           child != NULL; child = child->getNextSibling())
      {
    	  DumpTree(child, tmp);
      }
		tmp+=  tabs + "</" + el_name + ">\n";
    }
  leave:
  tabs+=tabs.substr(1);
 }
开发者ID:usnistgov,项目名称:QIF,代码行数:26,代码来源:XercesUtils.cpp

示例2: readFile

void Parameters::readFile(string str){
  file = str;
  XMLPlatformUtils::Initialize();
  XercesDOMParser parser;
  parser.setValidationScheme(XercesDOMParser::Val_Always);
  HandlerBase errHandler;// = (ErrorHandler*) new HandlerBase();
  parser.setErrorHandler(&errHandler);
  parser.parse(str.c_str());
  DOMDocument * doc = parser.getDocument();
  DOMElement* elementRoot = doc->getDocumentElement();

  // Extract floats
  DOMElement* floatRoot = (DOMElement *) 
    elementRoot->getElementsByTagName(XMLString::transcode("real"))->item(0);
  DOMElement* child = floatRoot->getFirstElementChild();
  do{
    saveReal(XMLString::transcode(child->getNodeName()),  
		    atof(XMLString::transcode(child->getTextContent())));
    child = child->getNextElementSibling();
  }while(child != NULL);

  // Extract integers
  DOMElement* intRoot = (DOMElement *) 
    elementRoot->getElementsByTagName(XMLString::transcode("integer"))->item(0);
  child = intRoot->getFirstElementChild();
  do{
    saveInteger(
		    XMLString::transcode(child->getNodeName()),  
		    atoi(XMLString::transcode(child->getTextContent())));
    child = child->getNextElementSibling();
  }while(child != NULL);
}
开发者ID:varungupta181186,项目名称:vistool,代码行数:32,代码来源:parameters.cpp

示例3: parread

// to check the value of child node
string cap::parread(const char* parentTag, int parentIndex,const char* childTag,  int childIndex)
{

	
	XMLCh* temp=XMLString::transcode(parentTag);
	DOMNodeList* list = doc->getElementsByTagName(temp);
    XMLString::release(&temp);
 
    DOMElement* parent =dynamic_cast<DOMElement*>(list->item(parentIndex));
    DOMElement* child =dynamic_cast<DOMElement*>(parent->getElementsByTagName(XMLString::transcode(childTag))->item(childIndex));
     
    string value;
    if (child) {
        char* temp2 = XMLString::transcode(child->getTextContent());
		//cout<<"its :"<<child->getTextContent()<<endl;
        value = temp2;
        XMLString::release(&temp2);
    }
    else {
        value = "NO VALUE";
    }
	
	
	return value;

}
开发者ID:skanak2,项目名称:xerces_parsing,代码行数:27,代码来源:parse.cpp

示例4: TextNode_Update

void DeltaApplyEngine::TextNode_Update( XID_t nodeXID, DOMNode *operationNode ) {
	vddprintf(("        update xid=%d\n",(int)nodeXID));
	DOMNode* upNode = xiddoc->getXidMap().getNodeWithXID( nodeXID );
	if (upNode==NULL) THROW_AWAY(("node with XID=%d not found",(int)nodeXID));
	
	DOMNodeList *opNodes = operationNode->getChildNodes();
	vddprintf(("opNodes->length() = %d\n", opNodes->getLength()));
	XyStrDeltaApply *xytext = new XyStrDeltaApply(xiddoc, upNode, 1);
	xytext->setApplyAnnotations(applyAnnotations);
	for (int i = opNodes->getLength() - 1; i >= 0; i--) {
		DOMElement *op = (DOMElement *) opNodes->item(i);
		char *optype = XMLString::transcode(op->getLocalName());
		XMLCh pos_attr[4];
		XMLCh len_attr[4];
		XMLString::transcode("pos", pos_attr, 3);
		XMLString::transcode("len", len_attr, 3);
		vddprintf(("item %d = %s\n", i, optype));
		// Replace operation
		if (strcmp(optype, "tr") == 0) {
			char *pos = XMLString::transcode(op->getAttribute(pos_attr));
			char *len = XMLString::transcode(op->getAttribute(len_attr));
			xytext->replace(atoi(pos), atoi(len), op->getTextContent());
			XMLString::release(&pos);
			XMLString::release(&len);
		}
		// Delete operation
		else if (strcmp(optype, "td") == 0) {
			char *pos = XMLString::transcode(op->getAttribute(pos_attr));
			char *len = XMLString::transcode(op->getAttribute(len_attr));
			xytext->remove(atoi(pos), atoi(len));
			XMLString::release(&pos);
			XMLString::release(&len);
		}
		// Insert operation
		else if (strcmp(optype, "ti") == 0) {
			char *pos = XMLString::transcode(op->getAttribute(pos_attr));
			xytext->insert(atoi(pos), op->getTextContent());
			XMLString::release(&pos);
		}
		XMLString::release(&optype);
	}
	xytext->complete();
	delete xytext;
}
开发者ID:alon,项目名称:xydiff,代码行数:44,代码来源:DeltaApply.cpp

示例5: AdditionalInformationTypeBase

AdditionalInformationType::AdditionalInformationType(const DOMElement &e, Flags f, Container *c)
    : AdditionalInformationTypeBase(e, f, c)
{
    xsd::cxx::xml::dom::parser<char> p(e, true, false, true);
    for (; p.more_content(); p.next_content(false))
    {
        const DOMElement &i(p.cur_element());
        const xsd::cxx::xml::qualified_name<char> n(xsd::cxx::xml::dom::name<char>(i));
        if(n.name() == "OtherInformation" && n.namespace_() == "http://uri.etsi.org/02231/v2#")
        {
            DOMElement *elem = i.getFirstElementChild();
            const xsd::cxx::xml::qualified_name<char> n2(xsd::cxx::xml::dom::name<char>(*elem));
            if(n2.name() == "MimeType")// && n.namespace_() == "http://uri.etsi.org/02231/v2/additionaltypes#")
                mimeType_ = xsd::cxx::xml::transcode<char>(elem->getTextContent());
            if(n2.name() == "SchemeTerritory")
                schemeTerritory_ = xsd::cxx::xml::transcode<char>(elem->getTextContent());
        }
    }
}
开发者ID:kallesober,项目名称:libdigidocpp,代码行数:19,代码来源:AdditionalInformationType.cpp

示例6: NagivateParseTree

// Look at Xerces XSModel to parse XSD into tree SCMPrint
void CXercesUtils::NagivateParseTree(xercesc::DOMElement* p, std::string tabs)
{
	string name;
	short age;
	tabs+="    ";
	for (DOMNode* n = p->getFirstChild ();	n != 0;	n = n->getNextSibling ())
	{
		if (n->getNodeType () != DOMNode::ELEMENT_NODE)
			continue;
		DOMElement*  e = (DOMElement* ) n;
		std::string el_name =  XMLString::transcode(n->getNodeName());

		std::string el_value;
		if(e->getTextContent () && e->getChildElementCount() == (XMLSize_t) 0)
			el_value = XMLString::transcode(e->getTextContent ());

		std::cerr <<  tabs.c_str() << el_name.c_str()<< "=" << el_value.c_str()<< endl;
		//DOMNode* node = n->getFirstChild ();

		NagivateParseTree((DOMElement*) n,tabs);
	}
	tabs=tabs.substr(1);

}
开发者ID:usnistgov,项目名称:QIF,代码行数:25,代码来源:XercesUtils.cpp

示例7: getChildValue

string XmlDomDocument::getChildValue(const char* parentTag, int parentIndex, const char* childTag, int childIndex)
{
	XMLCh* temp = XMLString::transcode(parentTag);
	DOMNodeList* list = m_doc->getElementsByTagName(temp);
	XMLString::release(&temp);

	DOMElement* parent = dynamic_cast<DOMElement*>(list->item(parentIndex));
	DOMElement* child = 
        dynamic_cast<DOMElement*>(parent->getElementsByTagName(XMLString::transcode(childTag))->item(childIndex));
	string value;
	if (child) {
		char* temp2 = XMLString::transcode(child->getTextContent());
		value = temp2;
        XMLString::release(&temp2);
	}
	else {
		value = "";
	}
	return value;
}
开发者ID:rsehgal,项目名称:TrackingMod,代码行数:20,代码来源:XmlDomDocument.cpp

示例8: fileInfo

XERCES_CPP_NAMESPACE_USE 

std::vector<DgFileTile> DgFileTile::getTiles(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* pDocument,
   const std::string& filename,
   unsigned int& height,
   unsigned int& width)
{
   std::vector<DgFileTile> tiles;
   DOMElement* pRoot = pDocument->getDocumentElement();
   if (pRoot == NULL || !XMLString::equals(pRoot->getNodeName(), X("isd")))
   {
      return tiles;
   }

   DOMNodeList* pTilList = pRoot->getElementsByTagName(X("TIL"));
   if (pTilList == NULL || pTilList->getLength() != 1)
   {
      return tiles;
   }
   DOMNode* pTil = pTilList->item(0);
   if (pTil == NULL || pTil->getNodeType() != DOMNode::ELEMENT_NODE)
   {
      return tiles;
   }
   DOMElement* pTilElement = static_cast<DOMElement*>(pTil);
   DOMNodeList* pTilesList = pTilElement->getElementsByTagName(X("TILE"));
   if (pTilesList == NULL)
   {
      return tiles;
   }
   height = 0;
   width = 0;
   bool error = false;
   QFileInfo fileInfo(QString::fromStdString(filename));
   QDir fileDir = fileInfo.dir();
   for (unsigned int i = 0; i < pTilesList->getLength(); ++i)
   {
      DgFileTile curTile;
      DOMNode* pNode = pTilesList->item(i);
      if (pNode == NULL || pNode->getNodeType() != DOMNode::ELEMENT_NODE)
      {
         continue;
      }
      DOMElement* pElement = static_cast<DOMElement*>(pNode);
      DOMElement* pChildElement = pElement->getFirstElementChild();
      while (pChildElement != NULL)
      {
         std::string textContent = A(pChildElement->getTextContent());
         if (XMLString::equals(pChildElement->getNodeName(), X("FILENAME")))
         {
            curTile.mTilFilename = fileDir.filePath(QString::fromStdString(textContent)).toStdString();
         }
         if (XMLString::equals(pChildElement->getNodeName(), X("ULCOLOFFSET")))
         {
            curTile.mStartCol = StringUtilities::fromXmlString<unsigned int>(textContent, &error);
         }
         if (XMLString::equals(pChildElement->getNodeName(), X("ULROWOFFSET")))
         {
            curTile.mStartRow = StringUtilities::fromXmlString<unsigned int>(textContent, &error);
         }
         if (XMLString::equals(pChildElement->getNodeName(), X("LRCOLOFFSET")))
         {
            curTile.mEndCol = StringUtilities::fromXmlString<unsigned int>(textContent, &error);
         }
         if (XMLString::equals(pChildElement->getNodeName(), X("LRROWOFFSET")))
         {
            curTile.mEndRow = StringUtilities::fromXmlString<unsigned int>(textContent, &error);
         }
         pChildElement = pChildElement->getNextElementSibling();
      }
      tiles.push_back(curTile);
      if (curTile.mEndCol > width)
      {
         width = curTile.mEndCol;
      }
      if (curTile.mEndRow > height)
      {
         height = curTile.mEndRow;
      }
   }
   return tiles;
}
开发者ID:tclarke,项目名称:opticks-extras-Spectral,代码行数:82,代码来源:DgFileTile.cpp

示例9:

 bool ValueIntT<T>::deserializeXML(DOMElement e)
 {
   Base::m_value = Radiant::StringUtils::fromString<T>(e.getTextContent().c_str());
   
   return true;
 }
开发者ID:enuuros,项目名称:multitude,代码行数:6,代码来源:ValueIntImpl.hpp

示例10: acquireInfo

//===================================================================================================================
void geometryLoader::acquireInfo(DOMElement * element)
{
    //  static const boost::regex matchDoubleQuotes(".*?\"(.*)\".*", boost::regex::perl);

    DOMNodeList*      children  = element->getChildNodes();
    const  XMLSize_t  nodeCount = children->getLength()   ;
    double rowPitch=0,colPitch=0;
    int dutNumbers=0;

    std::string  parentTagName = XMLString::transcode(element->getTagName()) ;

    std::map<std::string, std::string> keyValue ;

    for( XMLSize_t j = 0; j < nodeCount; ++j )
    {
        DOMNode* currentNode = children->item(j);

        if( !(currentNode->getNodeType() &&
              currentNode->getNodeType() == DOMNode::ELEMENT_NODE )) continue ; // is element otherwise close the recursive stack

        DOMElement      * currentElement = dynamic_cast< xercesc::DOMElement* >( currentNode ); // Found node which is an Element. Re-cast node as such.
        DOMNamedNodeMap * attList	     = currentNode->getAttributes() ;
        std::string       tagName	     = XMLString::transcode(currentElement->getTagName()) ;
        std::string       textContent    = "" ;
        std::string       textWithBlanks = "" ;

        if(currentNode->getTextContent())
            textWithBlanks = XMLString::transcode(currentElement->getTextContent()) ;

        textContent = this->stripBlanks(textWithBlanks) ;

        keyValue.clear() ;
        bool used = true;

        for(unsigned int i=0; i<attList->getLength(); ++i) // Set attibutes apart in a temporary hash map
        {
            if(                                                  attList->item(i)->getTextContent() )
                keyValue[                   XMLString::transcode(attList->item(i)->   getNodeName())] =
                        this->stripBlanks( XMLString::transcode(attList->item(i)->getTextContent()));
        }


        if( tagName == "testBeamGeometry" )
        {
            //theGeometry_->                keyValue["id" ]           ;
            //theGeometry_->       ( this->toLower(keyValue["date"]) );
            STDLINE("Entered " + tagName,ACYellow) ;
        }

        if( tagName == "stations" )
        {
            ss_.str("");
            ss_ << "stations in use: " << keyValue["inUse" ];
            STDLINE(ss_.str(),ACYellow) ;
        }

        if( tagName == "station" )
        {
            if(this->toLower(keyValue["used"])=="yes")
                station_    = keyValue["id"];
            else                   used        = false         ;
        }

        if( tagName == "detectors" )
        {
            ss_.str("");
            ss_ << "detectors in use: " << keyValue["inUse" ];
            STDLINE(ss_.str(),ACYellow) ;
        }

        if( tagName == "detector" )
        {
            if( this->toLower(keyValue["used"])=="yes" )
            {
                ss_.str("");
                ss_ << "Station: " << station_ << " - " << "Plaq: " << keyValue["id"];
                currentPlaqID_ = ss_.str();
                theGeometry_->addDetector( currentPlaqID_ );

                STDLINE(keyValue["name"] + " detector id: " + currentPlaqID_,ACYellow) ;

                if( this->toLower(keyValue["isDUT"]) == "yes" )
                {
                    theGeometry_->getDetector( currentPlaqID_ )->setDUT();
                    dutNumbers++;
                    theGeometry_->setDUTnumbers(dutNumbers);
                }
            }
            else used=false;
        }

        if( tagName == "largeGranularity" )
        {
            STDLINE("Rotations relative to " + keyValue["relativeRotations"],ACYellow) ;
        }

        if( tagName == "xBackFlipped"  && this->validContent(tagName,textContent))
        {
            if( this->toLower(textContent) == "yes" || this->toLower(textContent) == "true")
//.........这里部分代码省略.........
开发者ID:sakamoto-poteko,项目名称:Monicelli,代码行数:101,代码来源:geometryLoader.cpp

示例11: handleDocument

// 2006/11/07
void handleDocument(DOMDocument* document, char* outputfile)
{
  if (document == NULL) {
    cerr << _PREFIX_ << "WARNING null XML Document\n";
    return;
  }
  DOMElement* docElement = NULL;
  docElement = document->getDocumentElement();

  if (docElement == NULL) {
    cerr << _PREFIX_ << "WARNING null XML Document Element\n";
    return;
  }


  DOMNodeList* sections = docElement->getElementsByTagName(XMLString::transcode("section"));
  int sCount = 0;
  int paragraphID = 1;

  for (unsigned int i = 0; i < sections->getLength(); i++) {
    int sectID = i+1;
    if (verbose) cerr << _PREFIX_ << "Section " << i;
    DOMElement* aSect = NULL;
    aSect = (DOMElement*)sections->item(i);
    string sectName = XMLString::transcode(((DOMElement*)aSect)->getAttribute(XMLString::transcode("name")));
    string analyze =
      XMLString::transcode(((DOMElement*)aSect)->getAttribute(XMLString::transcode("analyze")));
    if (verbose) cerr << " ['" << sectName << "'";
    // Ignore non affected sections 
    if ( ( analyze == "yes" ) ||
         ( sectName.length() == 0 ) ||
         ( affectedSections.find(sectName + "|") != string::npos )) {      
      
      if (verbose) cerr << " analyze=yes ";
      // Deal with unnamed and affected sections

      // create a stream
      aSect->normalize();
      stringstream text(XMLString::transcode(aSect->getTextContent()));

      if (verbose) {
        string temp(XMLString::transcode(aSect->getTextContent()));
        cerr << temp.length() << " charcters]\n" << _PREFIX_ << "           ";
      }

      aSect->removeChild(aSect->getFirstChild());

      vector<vector<string> > result;
      result = seg->segmentInVectors(text);

      for(vector<vector<string> >::iterator itp = result.begin(); 
          itp != result.end(); 
          itp++) {
        stringstream parID;
        parID << _ID_PREFIX_SECTION << sectID << _ID_PREFIX_PARAGRAPH << paragraphID++;
        sCount += addSegmentedParagraphToSection(*itp,aSect,parID.str().c_str());
      }
   
      if (verbose) cerr << endl;
    } else {
      if (verbose) cerr << " analyze=no]" << endl;
    }
  }

  if (stamp) stampDocument(docElement);

  /* SERIALIZE XML DOCUMENT */
  if (outputfile == NULL) xmlInterface->serializeTo(document);
  else xmlInterface->serializeTo(document,outputfile);

  if (verbose) cerr << _PREFIX_ << "Segmented in " << sCount << " sentences." << endl;
}
开发者ID:lgwizme,项目名称:macaon,代码行数:73,代码来源:main.cpp

示例12: Load


//.........这里部分代码省略.........
			}
		}

        CNodeConf *pNetworkConf = (CNodeConf *) pNetwork->getConf();

		//
		DOMElement *pSub = (DOMElement *)pChild->getFirstChild();

		if (!pSub)
			_RET(XML_LOADER_ERROR);

		while (pSub)
		{
			if (0 == XMLString::compareString(pSub->getNodeName(),
											  wsIdentity))
			{
				//
				auto_xerces_str sIdentity(pSub->getAttribute(wsIdentity));
				ch_1 			*sIdentityName = null_v;

				if (SUCCESS != _ERR(GetLastName(sIdentity, sIdentityName)))
					_RET(XML_LOADER_ERROR);

                v_ *pV = pProtocol->data().value(sIdentityName);

				if (!pV)
					_RET(XML_LOADER_ERROR);

				//
				auto_xerces_str	sPDU(pSub->getAttribute(wsPDU));
                CPduInfo *pPDU = null_v;

                if (SUCCESS != _ERR(pProtocol->getPdu(sPDU, pPDU)))
					_RET(XML_LOADER_ERROR);

				//
				auto_xerces_str sDirection(pSub->getAttribute(wsDirection));
				EDirection		Direction;

				if (SUCCESS != _ERR(GetDirection(sDirection, Direction)))
					_RET(XML_LOADER_ERROR);

				//
				if (SUCCESS != _ERR(pNetworkConf->ConfigPDU(*pV,
															pPDU,
															Direction)))
				{
					_RET(XML_LOADER_ERROR);
				}
			}
			else if (0 == XMLString::compareString(pSub->getNodeName(),
												   wsFilter))
			{
				CIPFilter *pIPFilter = null_v;

				if (NETWORK_ACCEPTOR == NetworkType)
				{
					pIPFilter =
						&((CAcceptorConf *)pNetworkConf)->IPFilter();
				}
				else if (NETWORK_RECEIVER == NetworkType)
				{
					pIPFilter =
						&((CReceiverConf *)pNetworkConf)->IPFilter();
				}
				else
				{
					_RET(XML_LOADER_ERROR);
				}

				auto_xerces_str sType(pSub->getAttribute(wsType));

				if (0 == strcmp(sType, "forbid")) {
                    pIPFilter->setForbid(true_v);
                } else if (0 == strcmp(sType, "permit")) {
                    pIPFilter->setForbid(false_v);
                }

                auto_xerces_str sIPGroup(pSub->getTextContent());

                if (false_v == pIPFilter->addIpGroup((const ch_1 *) sIPGroup))
					_RET(XML_LOADER_ERROR);
			}

			pSub = (DOMElement *)pSub->getNextSibling();
		}

        if (SUCCESS != _ERR(CNetworkManager::instance()->AddNetwork(
														(const char *)sName,
														NetworkType,
														pNetwork)))
		{
			_RET(XML_LOADER_ERROR);
		}

		pChild = (DOMElement *)pChild->getNextSibling();
	}

	_RET(SUCCESS);
}
开发者ID:shoutrain,项目名称:ComEgg,代码行数:101,代码来源:CXMLLoaderNetwork.cpp

示例13: deserializeXML

 bool ValueBool::deserializeXML(DOMElement e)
 {
   m_value = (bool)Radiant::StringUtils::fromString<int32_t>(e.getTextContent().c_str());
   return true;
 }
开发者ID:enuuros,项目名称:multitude,代码行数:5,代码来源:ValueBool.cpp


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