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


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

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


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

示例1: getGeometryTypeOfElem

void ILI2Reader::SetFieldValues(OGRFeature *feature, DOMElement* elem) {
  int type = 0;
  //recursively search children
  for (DOMElement *childElem = (DOMElement *)elem->getFirstChild();
        type == 0 && childElem && childElem->getNodeType() == DOMNode::ELEMENT_NODE;
        childElem = (DOMElement*)childElem->getNextSibling()) {
    type = getGeometryTypeOfElem(childElem);
    if (type == 0) {
      if (childElem->getFirstChild() && childElem->getFirstChild()->getNodeType() == DOMNode::ELEMENT_NODE) {
        SetFieldValues(feature, childElem);
      } else {
        char *fName = fieldName(childElem);
        int fIndex = feature->GetFieldIndex(fName);
        if (fIndex != -1) {
          char * objVal = getObjValue(childElem);
          if (objVal == NULL)
            objVal = getREFValue(childElem); // only to try
          feature->SetField(fIndex, objVal);
          CPLFree(objVal);
        } else {
          CPLDebug( "OGR_ILI","Attribute '%s' not found", fName);
          m_missAttrs.push_back(fName);
        }
        CPLFree(fName);
      }
    } else {
      feature->SetGeometryDirectly(getGeometry(childElem, type));
    }
  }
}
开发者ID:imincik,项目名称:pkg-gdal,代码行数:30,代码来源:ili2reader.cpp

示例2: applyReplaceElementContent

void XercesUpdateFactory::applyReplaceElementContent(const PendingUpdate &update, DynamicContext *context)
{
  const XercesNodeImpl *nodeImpl = (const XercesNodeImpl*)update.getTarget()->getInterface(Item::gXQilla);
  DOMElement *domnode = (DOMElement*)nodeImpl->getDOMNode();

  // 1. For each node $C that is a child of $target, the parent property of $C is set to empty.
  DOMNode *child = domnode->getFirstChild();
  while(child != 0) {
    forDeletion_.insert(child);
    child = child->getNextSibling();
  }

  const XMLCh *value = update.getValue().first()->asString(context);
  if(value != 0 && *value != 0) {
    // 2. The parent property of $text is set to $target.
    // 3a. children is set to consist exclusively of $text. If $text is an empty sequence, then $target has
    //     no children.
    // 3b. typed-value and string-value are set to the content property of $text. If $text is an empty sequence,
    //     then typed-value is an empty sequence and string-value is an empty string.
    domnode->appendChild(domnode->getOwnerDocument()->createTextNode(value));
  }

  // 3c. upd:removeType($target) is invoked.
  removeType(domnode);

  addToPutSet(update.getTarget(), &update, context);
}
开发者ID:xubingyue,项目名称:xqilla,代码行数:27,代码来源:XercesUpdateFactory.cpp

示例3: expandNameSpaces

void XSECNameSpaceExpander::expandNameSpaces(void) {

	if (m_expanded)
		return;				// Don't do this twice!

	DOMElement	*docElt;		// The document element - do not expand it's namespaces
	
	docElt = mp_doc->getDocumentElement();
	int count = attNodeCount(docElt);

	DOMNode *c;

	c = docElt->getFirstChild();

	while (c != NULL) {
		if (c->getNodeType() == DOMNode::ELEMENT_NODE)
			recurse((DOMElement *) c);
		c = c->getNextSibling();
	}

	m_expanded = true;

	count = attNodeCount(docElt);

}
开发者ID:mvancompernolle,项目名称:ai_project,代码行数:25,代码来源:XSECNameSpaceExpander.cpp

示例4: processTalent

Talent* DsaDataLoader::processTalent(int gruppe, DOMElement* talentXml)
{
    CeGuiString desc = XmlHelper::getValueAsUtf8(XmlHelper::getChildNamed(talentXml, "Beschreibung"));
    CeGuiString probe = XmlHelper::getValueAsUtf8(XmlHelper::getChildNamed(talentXml, "Probe"));
    CeGuiString art = XmlHelper::getValueAsUtf8(XmlHelper::getChildNamed(talentXml, "Art"));
    DOMElement* eBeNode = XmlHelper::getChildNamed(talentXml, "eBE");
    int ebe = EBE_KEINE_BE;
    if (eBeNode != NULL)
        ebe = getEBeFromString(XMLString::transcode(eBeNode->getFirstChild()->getNodeValue()));

    CeGuiString name = XmlHelper::transcodeToString(talentXml->getAttribute(XMLString::transcode("ID")));
    EigenschaftTripel eigenschaften;
    eigenschaften.first = probe.substr(0,2);
    eigenschaften.second = probe.substr(3,2);
    eigenschaften.third = probe.substr(6,2);
    probe.clear();

    Talent* t = new Talent(
        name,
        desc,
        eigenschaften,
        ebe,
        gruppe);

    return t;
}
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:26,代码来源:DsaDataLoader.cpp

示例5: fromXml

bool PointSetImp::fromXml(DOMNode* pDocument, unsigned int version)
{
   if (pDocument == NULL || !PlotObjectImp::fromXml(pDocument, version))
   {
      return false;
   }

   DOMElement* pElem = static_cast<DOMElement*>(pDocument);
   mSymbols = StringUtilities::fromXmlString<bool>(A(pElem->getAttribute(X("symbols"))));
   mLine = StringUtilities::fromXmlString<bool>(A(pElem->getAttribute(X("line"))));
   ColorType color = StringUtilities::fromXmlString<ColorType>(A(pElem->getAttribute(X("lineColor"))));
   mLineColor = COLORTYPE_TO_QCOLOR(color);
   mLineWidth = StringUtilities::fromXmlString<int>(A(pElem->getAttribute(X("lineWidth"))));
   mLineStyle = StringUtilities::fromXmlString<LineStyle>(A(pElem->getAttribute(X("lineStyle"))));

   for (DOMNode* pChld = pElem->getFirstChild(); pChld != NULL; pChld = pChld->getNextSibling())
   {
      if (XMLString::equals(pChld->getNodeName(), X("Point")))
      {
         PointImp* pPoint = dynamic_cast<PointImp*>(addPoint());
         if (pPoint == NULL || !pPoint->fromXml(pChld, version))
         {
            return false;
         }
      }
   }

   return true;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:29,代码来源:PointSetImp.cpp

示例6: xml

vector<ImportDescriptor*> LayerImporter::getImportDescriptors(const string& filename, bool reportErrors)
{
   vector<ImportDescriptor*> descriptors;
   if (!filename.empty())
   {
      MessageLog* pLog = NULL;
      if (reportErrors == true)
      {
         Service<MessageLogMgr> pLogMgr;
         pLog = pLogMgr->getLog();
      }

      XmlReader xml(pLog);
      XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* pDoc = xml.parse(filename, "metadata");
      DOMElement* pRootElement = NULL;
      if (pDoc != NULL)
      {
         pRootElement = pDoc->getDocumentElement();
      }
      if (pRootElement != NULL)
      {
         for (DOMNode* pChild = pRootElement->getFirstChild();
            pChild != NULL;
            pChild = pChild->getNextSibling())
         {
            if (pChild->getNodeType() == DOMNode::ELEMENT_NODE)
            {
               DOMElement* pChildElement = static_cast<DOMElement*>(pChild);
               string cNodeName = A(pChildElement->getNodeName());

               ImportDescriptor* pImportDescriptor = ModelImporter::populateImportDescriptor(pChildElement, filename);
               if (pImportDescriptor != NULL)
               {
                  DataDescriptor* pDataDescriptor = pImportDescriptor->getDataDescriptor();
                  if (NULL != pDataDescriptor)
                  {
                     DynamicObject* pMetadataZ = pDataDescriptor->getMetadata();
                     VERIFYRV(pMetadataZ, descriptors);
                     if (!pMetadataZ->getAttributeByPath("Layer/Import Options/Use Pixel Coordinates").isValid())
                     {
                        pMetadataZ->setAttributeByPath("Layer/Import Options/Use Pixel Coordinates", false);
                     }
                  }
                  descriptors.push_back(pImportDescriptor);
               }
            }
         }
      }
   }

   return descriptors;
}
开发者ID:Tom-VdE,项目名称:opticks,代码行数:52,代码来源:LayerImporter.cpp

示例7: oFieldDefn

void ILI2Reader::setFieldDefn(OGRFeatureDefn *featureDef, DOMElement* elem) {
  int type = 0;
  //recursively search children
  for (DOMElement *childElem = (DOMElement *)elem->getFirstChild();
        type == 0 && childElem && childElem->getNodeType() == DOMNode::ELEMENT_NODE;
        childElem = (DOMElement*)childElem->getNextSibling()) {
    type = getGeometryTypeOfElem(childElem);
    if (type == 0) {
      if (childElem->getFirstChild() && childElem->getFirstChild()->getNodeType() == DOMNode::ELEMENT_NODE) {
        setFieldDefn(featureDef, childElem);
      } else {
        char *fName = fieldName(childElem);
        if (featureDef->GetFieldIndex(fName) == -1) {
          CPLDebug( "OGR_ILI", "AddFieldDefn: %s",fName );
          OGRFieldDefn oFieldDefn(fName, OFTString);
          featureDef->AddFieldDefn(&oFieldDefn);
        }
        CPLFree(fName);
      }
    }
  }
}
开发者ID:imincik,项目名称:pkg-gdal,代码行数:22,代码来源:ili2reader.cpp

示例8: SetASCII

void  ParameterGrp::SetASCII(const char* Name, const char *sValue)
{
    // find or create the Element
    DOMElement *pcElem = FindOrCreateElement(_pGroupNode,"FCText",Name);
    // and set the value
    DOMNode *pcElem2 = pcElem->getFirstChild();
    if (!pcElem2) {
        XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *pDocument = _pGroupNode->getOwnerDocument();
        DOMText *pText = pDocument->createTextNode(XUTF8Str(sValue).unicodeForm());
        pcElem->appendChild(pText);
    }
    else {
        pcElem2->setNodeValue(XUTF8Str(sValue).unicodeForm());
    }
    // trigger observer
    Notify(Name);

}
开发者ID:SparkyCola,项目名称:FreeCAD,代码行数:18,代码来源:Parameter.cpp

示例9: processKampftechnik

Kampftechnik* DsaDataLoader::processKampftechnik(DOMElement* kampftechnikXml)
{
    CeGuiString desc = XmlHelper::getValueAsUtf8(XmlHelper::getChildNamed(kampftechnikXml, "Beschreibung"));
    CeGuiString art = XmlHelper::getValueAsUtf8(XmlHelper::getChildNamed(kampftechnikXml, "Art"));
    DOMElement* eBeNode = XmlHelper::getChildNamed(kampftechnikXml, "eBE");
    int ebe = EBE_KEINE_BE;
    if (eBeNode != NULL)
        ebe = getEBeFromString(XMLString::transcode(eBeNode->getFirstChild()->getNodeValue()));

    CeGuiString name = XmlHelper::transcodeToString(kampftechnikXml->getAttribute(XMLString::transcode("ID")));

    Kampftechnik* k = new Kampftechnik(
        name,
        desc,
        ebe);

    return k;

}
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:19,代码来源:DsaDataLoader.cpp

示例10: xml

vector<ImportDescriptor*> LayerImporter::getImportDescriptors(const string& filename, bool reportErrors)
{
   vector<ImportDescriptor*> descriptors;
   if (!filename.empty())
   {
      MessageLog* pLog = NULL;
      if (reportErrors == true)
      {
         Service<MessageLogMgr> pLogMgr;
         pLog = pLogMgr->getLog();
      }

      XmlReader xml(pLog);
      XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* pDoc = xml.parse(filename, "metadata");
      DOMElement* pRootElement = NULL;
      if (pDoc != NULL)
      {
         pRootElement = pDoc->getDocumentElement();
      }
      if (pRootElement != NULL)
      {
         for (DOMNode* pChild = pRootElement->getFirstChild();
            pChild != NULL;
            pChild = pChild->getNextSibling())
         {
            if (pChild->getNodeType() == DOMNode::ELEMENT_NODE)
            {
               DOMElement* pChildElement = static_cast<DOMElement*>(pChild);
               string cNodeName = A(pChildElement->getNodeName());

               ImportDescriptor* pImportDescriptor = ModelImporter::populateImportDescriptor(pChildElement, filename);
               if (pImportDescriptor != NULL)
               {
                  descriptors.push_back(pImportDescriptor);
               }
            }
         }
      }
   }

   return descriptors;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:42,代码来源:LayerImporter.cpp

示例11: FindElement

std::vector<std::pair<std::string,std::string> > ParameterGrp::GetASCIIMap(const char * sFilter) const
{
    std::vector<std::pair<std::string,std::string> >  vrValues;
    DOMElement *pcTemp;// = _pGroupNode->getFirstChild();
    std::string Name;

    pcTemp = FindElement(_pGroupNode,"FCText");
    while ( pcTemp) {
        Name = StrXUTF8( ((DOMElement*)pcTemp)->getAttributes()->getNamedItem(XStr("Name").unicodeForm())->getNodeValue()).c_str();
        // check on filter condition
        if (sFilter == NULL || Name.find(sFilter)!= std::string::npos) {
            // retrive the text element
            DOMNode *pcElem2 = pcTemp->getFirstChild();
            if (pcElem2)
                vrValues.push_back(std::make_pair(Name, std::string(StrXUTF8(pcElem2->getNodeValue()).c_str())));
        }
        pcTemp = FindNextElement(pcTemp,"FCText");
    }

    return vrValues;
}
开发者ID:SparkyCola,项目名称:FreeCAD,代码行数:21,代码来源:Parameter.cpp

示例12: GetASCII

std::string ParameterGrp::GetASCII(const char* Name, const char * pPreset) const
{
    // check if Element in group
    DOMElement *pcElem = FindElement(_pGroupNode,"FCText",Name);
    // if not return preset
    if (!pcElem) {
        if (pPreset==0)
            return std::string("");
        else
            return std::string(pPreset);
    }
    // if yes check the value and return
    DOMNode *pcElem2 = pcElem->getFirstChild();
    if (pcElem2)
        return std::string(StrXUTF8(pcElem2->getNodeValue()).c_str());
    else if (pPreset==0)
        return std::string("");

    else
        return std::string(pPreset);
}
开发者ID:SparkyCola,项目名称:FreeCAD,代码行数:21,代码来源:Parameter.cpp

示例13: fromXml

bool CustomLayerImp::fromXml(DOMNode* pDocument, unsigned int version)
{
    if (!LayerImp::fromXml(pDocument, version))
    {
        return false;
    }

    DOMElement* pElem = static_cast<DOMElement*>(pDocument);
    setAcceptsMouseEvents(StringUtilities::fromXmlString<bool>(A(pElem->getAttribute(X("mouseEventsSupported")))));
    for (DOMNode* pChld = pElem->getFirstChild(); pChld != NULL; pChld = pChld->getNextSibling())
    {
        if (XMLString::equals(pChld->getNodeName(), X("mouseCursor")))
        {
            string cursorStr = string(A(pChld->getTextContent()));
            if (cursorStr.empty() == false)
            {
                QByteArray cursorArray(QByteArray::fromBase64(QByteArray::fromRawData(
                                           cursorStr.c_str(), cursorStr.size())));
                QDataStream cursorStream(&cursorArray, QIODevice::ReadOnly);
                cursorStream >> mMouseCursor;
            }
        }
开发者ID:jonatho7,项目名称:opticks,代码行数:22,代码来源:CustomLayerImp.cpp

示例14: fromXml

bool CurveImp::fromXml(DOMNode* pDocument, unsigned int version)
{
   if (pDocument == NULL || !PlotObjectImp::fromXml(pDocument, version))
   {
      return false;
   }

   DOMElement* pElem = static_cast<DOMElement*>(pDocument);
   ColorType color = StringUtilities::fromXmlString<ColorType>(A(pElem->getAttribute(X("color"))));
   mColor = COLORTYPE_TO_QCOLOR(color);
   mLineWidth = StringUtilities::fromXmlString<int>(A(pElem->getAttribute(X("lineWidth"))));
   mLineStyle = StringUtilities::fromXmlString<LineStyle>(A(pElem->getAttribute(X("lineStyle"))));

   for (DOMNode* pChld = pElem->getFirstChild(); pChld != NULL; pChld = pChld->getNextSibling())
   {
      if (XMLString::equals(pChld->getNodeName(), X("Point")))
      {
         mPoints.push_back(StringUtilities::fromXmlString<LocationType>(A(pChld->getTextContent())));
      }
   }

   return true;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:23,代码来源:CurveImp.cpp

示例15: fromXml

bool AxisImp::fromXml(DOMNode* pDocument, unsigned int version)
{
    DOMElement* pElmnt = dynamic_cast<DOMElement*>(pDocument);
    if (pElmnt == NULL)
    {
        return false;
    }

    mTitle = A(pElmnt->getAttribute(X("title")));
    for (DOMNode* pNode = pElmnt->getFirstChild(); pNode != NULL; pNode = pNode->getNextSibling())
    {
        if (XMLString::equals(pNode->getNodeName(), X("titleFont")))
        {
            DOMElement* pFontElement = static_cast<DOMElement*>(pNode);
            if (mTitleFont.fromXml(pFontElement, version) == false)
            {
                return false;
            }
        }
    }

    ColorType color = StringUtilities::fromXmlString<ColorType>(A(pElmnt->getAttribute(X("titleColor"))));
    mTitleColor = COLORTYPE_TO_QCOLOR(color);
    mScaleType = StringUtilities::fromXmlString<ScaleType>(A(pElmnt->getAttribute(X("scaleType"))));
    mMaxMajorTicks = StringUtilities::fromXmlString<int>(A(pElmnt->getAttribute(X("maxMajorTicks"))));
    mMaxMinorTicks = StringUtilities::fromXmlString<int>(A(pElmnt->getAttribute(X("maxMinorTicks"))));
    mScaleDraw.setLabelFormat(A(pElmnt->getAttribute(X("scaleDrawLabelFormat"))));

    double minValue = StringUtilities::fromXmlString<double>(A(pElmnt->getAttribute(X("minValue"))));
    double maxValue = StringUtilities::fromXmlString<double>(A(pElmnt->getAttribute(X("maxValue"))));
    setValueRange(minValue, maxValue);

    updateScale();
    updateSize();

    return true;
}
开发者ID:wzssyqa,项目名称:opticks-cmake,代码行数:37,代码来源:AxisImp.cpp


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