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


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

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


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

示例1: deserialize

bool SampleGeoref::deserialize(SessionItemDeserializer& deserializer)
{
   if (deserializer.getBlockSizes().empty() == true)
   {
      // The plug-in was serialized before execute() was called
      return true;
   }

   XmlReader reader(NULL, false);
   DOMElement* pRootElement = deserializer.deserialize(reader, "SampleGeoref");
   if (pRootElement)
   {
      std::string windowId = A(pRootElement->getAttribute(X("rasterId")));
      mpRaster = dynamic_cast<RasterElement*>(Service<SessionManager>()->getSessionItem(windowId));
      if (mpRaster != NULL)
      {
         mXSize = atoi(A(pRootElement->getAttribute(X("xSize"))));
         mYSize = atoi(A(pRootElement->getAttribute(X("ySize"))));
         mXScale = atof(A(pRootElement->getAttribute(X("xScale"))));
         mYScale = atof(A(pRootElement->getAttribute(X("yScale"))));
         mExtrapolate = StringUtilities::fromXmlString<bool>(
            A(pRootElement->getAttribute(X("extrapolationAccurate"))));
         return true;
      }
   }
   return false;
}
开发者ID:Tom-VdE,项目名称:opticks,代码行数:27,代码来源:SampleGeoref.cpp

示例2: fromXml

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

   DOMElement* pElement = static_cast<DOMElement*>(pDocument);

   // Filename
   bool error;
   FactoryResource<Filename> pFilename(StringUtilities::fromXmlString<Filename*>(
      A(pElement->getAttribute(X("filename"))), &error));
   if (pFilename.get() == NULL)
   {
      return false;
   }
   mFilename = *(pFilename.get());
   // Dataset location
   if (!error)
   {
      mDatasetLocation = A(pElement->getAttribute(X("datasetLocation")));
      mEndian = StringUtilities::fromXmlString<EndianType>(A(pElement->getAttribute(X("endian"))), &error);
   }

   notify(SIGNAL_NAME(Subject, Modified));
   return !error;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:28,代码来源:FileDescriptorImp.cpp

示例3: 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

示例4: fromXml

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

   vector<TiePoint> oldPoints;

   TiePointList* pTiePointList = dynamic_cast<TiePointList*>(getDataElement());
   if (pTiePointList != NULL)
   {
      oldPoints = pTiePointList->getTiePoints();
   }

   DOMElement* pElmnt = static_cast<DOMElement*>(pDocument);

   setSymbolSize(StringUtilities::fromXmlString<int>(A(pElmnt->getAttribute(X("symbolSize")))));
   setColor(COLORTYPE_TO_QCOLOR(StringUtilities::fromXmlString<ColorType>(A(pElmnt->getAttribute(X("symbolColor"))))));
   enableLabels(StringUtilities::fromXmlString<bool>(A(pElmnt->getAttribute(X("labelIsEnabled")))));
   setIsMission(StringUtilities::fromXmlString<bool>(A(pElmnt->getAttribute(X("isMission")))));

   View* pView = getView();
   if ((pView != NULL) && (pTiePointList != NULL))
   {
      vector<TiePoint> newPoints = pTiePointList->getTiePoints();
      pView->addUndoAction(new SetTiePoints(pTiePointList, oldPoints, newPoints));
   }

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

示例5: XS

/**
 * Create PerfPart element
 */
PerfPart::PerfPart( PMLDocument *doc, DOMElement *element ){
    m_doc = doc;
    m_element = element;

    DOMDocument *domdoc = m_element->getOwnerDocument();

    const XMLCh *partID = m_element->getAttribute( XS("part") );

    DOMElement *root = m_element->getOwnerDocument()->getDocumentElement();
    DOMNodeList *parts = root->getElementsByTagName(XS("part"));

    for( unsigned int i=0; i<parts->getLength(); i++ ){

        DOMElement *e = (DOMElement*)parts->item(i);

        cout << " perf  " << XS( m_element->getAttribute(XS("id")))
                << " score " << XS( e->getAttribute(XS("part")) )
                << endl;

        if( !strcmp(XS( m_element->getAttribute(XS("id")) ),  XS( e->getAttribute(XS("part")) ))   ){
            m_scorePart = new ScorePart( m_doc, e );
        }
    }
  
    DOMNodeList *nl = m_element->getElementsByTagName(XS(PNote::Tag));
    for( int i=0; i<nl->getLength(); i++ ){
        m_notes.push_back( new PNote( m_doc, (DOMElement*)nl->item(i) ) );
    
    }
  
}
开发者ID:jmacritchie,项目名称:DougMatcher,代码行数:34,代码来源:perfpart.cpp

示例6: GetDerivOrder

int Problem::GetDerivOrder()
{
  // first check to see if we already know the derivative order
  if(!hasDerivOrder_)
    {
      // if not, look in the XML and see if we can find out.
      DOMElement* subroutineXML = GetSubroutineXML();
      string second =
	XMLString::transcode(subroutineXML->getAttribute(XMLString::transcode("Second")));
      string first =
	XMLString::transcode(subroutineXML->getAttribute(XMLString::transcode("First")));
      if(second == "true")
	{
	  derivOrder_ = 2;
	}else if(first == "true")
	  {
	    derivOrder_ = 1;
	  }else{
	    derivOrder_ = 0;
	  }
      hasDerivOrder_ = true;
    }

  return derivOrder_;
}
开发者ID:OpenCMISS-Dependencies,项目名称:optpp,代码行数:25,代码来源:Problem.C

示例7: fromXml

bool FrameLabelObjectImp::fromXml(DOMNode* pDocument, unsigned int version)
{
   if (pDocument == NULL || Service<SessionManager>()->isSessionLoading() == false)
   {
      return false;
   }

   if (!TextObjectImp::fromXml(pDocument, version))
   {
      return false;
   }

   DOMElement* pElement = static_cast<DOMElement*> (pDocument);
   if (pElement != NULL)
   {
      // Set the autoMode setting (which will also call setLocked)
      setAutoMode(StringUtilities::fromXmlString<bool>(A(pElement->getAttribute(X("autoMode")))));

      // If the object is not currently locked, load all frames
      if (getLocked() == false)
      {
         for (DOMNode* pChild = pDocument->getFirstChild(); 
            pChild != NULL; pChild = pChild->getNextSibling())
         {
            if (XMLString::equals(pChild->getNodeName(), X("Animations")))
            {
               vector<Animation*> animations;
               for (DOMNode* pGrandchild = pChild->getFirstChild();
                  pGrandchild != NULL;
                  pGrandchild = pGrandchild->getNextSibling())
               {
                  if (XMLString::equals(pGrandchild->getNodeName(), X("Animation")))
                  {
                     pElement = dynamic_cast<DOMElement*>(pGrandchild);
                     if (pElement != NULL)
                     {
                        string id(A(pElement->getAttribute(X("id"))));
                        if (id.empty() != true)
                        {
                           Animation* pAnim = dynamic_cast<Animation*>(Service<SessionManager>()->getSessionItem(id));
                           if (pAnim != NULL)
                           {
                              animations.push_back(pAnim);
                           }
                        }
                     }
                  }
               }

               setAnimations(animations);
            }
         }
      }
   }

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

示例8: SetParameters

void NewtonProblem::SetParameters(OptimizeClass* objfcn)
{
  Problem::SetParameters(objfcn);

  DOMElement* searchXML = GetParameterXML();
  VariableList* variables = GetVariables();

  string gradMult, searchSize, maxBack;

  OptNewtonLike * objfcnNewt = (OptNewtonLike *) objfcn;

  if(searchType_ == trustPDS)
  {
    objfcnNewt->setSearchStrategy(TrustPDS);

    gradMult =
      XMLString::transcode(searchXML->getAttribute(XMLString::transcode("gradMult")));
    if (gradMult != "")
      objfcnNewt->setGradMult(atof(gradMult.c_str()));

    searchSize =
      XMLString::transcode(searchXML->getAttribute(XMLString::transcode("searchSize")));
    if (searchSize != "")
      objfcnNewt->setSearchSize(atoi(searchSize.c_str()));
  }
  else if (searchType_ == lineSearch)
  {
    objfcnNewt->setSearchStrategy(LineSearch);

    maxBack =
      XMLString::transcode(searchXML->getAttribute(XMLString::transcode("maxBTIter")));
    if (maxBack != "")
      objfcnNewt->setMaxBacktrackIter(atoi(maxBack.c_str()));
  }
  else if (searchType_ == trustRegion)
  {
    if ((variables->upperExists()) || (variables->lowerExists()))
    {
      cout << "Newton with Trust Region does not support bounds." << endl;
      cout << "Using Line Search instead." << endl;
      objfcnNewt->setSearchStrategy(LineSearch);
    }
    else
    {
      objfcnNewt->setSearchStrategy(TrustRegion);
      gradMult =
	XMLString::transcode(searchXML->getAttribute(XMLString::transcode("gradMult")));
      if (gradMult != "")
	objfcnNewt->setGradMult(atof(gradMult.c_str()));
    }
  }
  else
  {
    cerr << "Unrecognized search strategy type" << endl;
    exit(1);
  }
}
开发者ID:OpenCMISS-Dependencies,项目名称:optpp,代码行数:57,代码来源:NewtonProblem.C

示例9: GetSubroutineXML

USERFCN2 Problem::GetUserFunction2()
{
  // load in the library function and cast appropriately before returning
  DOMElement* subroutineXML = GetSubroutineXML();
  string fEval =
    XMLString::transcode(subroutineXML->getAttribute(XMLString::transcode("FEval")));
  string libName =
    XMLString::transcode(subroutineXML->getAttribute(XMLString::transcode("LibName")));
  void* function = GetFunction(libName, fEval);
  return (USERFCN2) function;
}
开发者ID:OpenCMISS-Dependencies,项目名称:optpp,代码行数:11,代码来源:Problem.C

示例10: GetInitFunction

INITFCN Problem::GetInitFunction()
{
  // load in the library function and cast appropriately before returning
  DOMElement* subroutineXML = GetSubroutineXML();
  string init =
    XMLString::transcode(subroutineXML->getAttribute(XMLString::transcode("Init")));
  string libName =
    XMLString::transcode(subroutineXML->getAttribute(XMLString::transcode("LibName")));
  void* function = GetFunction(libName, init);
  return (INITFCN) function;
}
开发者ID:OpenCMISS-Dependencies,项目名称:optpp,代码行数:11,代码来源:Problem.C

示例11: deserialize

bool RangeProfilePlotManager::deserialize(SessionItemDeserializer& deserializer)
{
   XmlReader reader(NULL, false);
   DOMElement* pRootElement = deserializer.deserialize(reader, "RangeProfilePlotManager");
   if (pRootElement)
   {
      std::string viewId = A(pRootElement->getAttribute(X("viewId")));
      mpView = dynamic_cast<PlotView*>(Service<SessionManager>()->getSessionItem(viewId));

      mpPlot = Service<DesktopServices>()->createPlotWidget(getName(), CARTESIAN_PLOT);
      VERIFY(mpPlot);
      Serializable* pPlotSer = dynamic_cast<Serializable*>(mpPlot); // The imp side is serializable
      VERIFY(pPlotSer);
      if (!pPlotSer->fromXml(findChildNode(pRootElement, "plot"), reader.VERSION))
      {
         return false;
      }

      mpView = mpPlot->getPlot();
      VERIFY(mpView);
      Serializable* pPlotViewSer = dynamic_cast<Serializable*>(mpView); // The imp side is serializable
      VERIFY(pPlotViewSer);
      if (!pPlotViewSer->fromXml(findChildNode(pRootElement, "plotView"), reader.VERSION))
      {
         return false;
      }

      std::list<PlotObject*> objects;
      mpView->getObjects(POINT_SET, objects);
      FOR_EACH_DOMNODE(pRootElement, pChild)
      {
         if (XMLString::equals(pChild->getNodeName(), X("signature")))
         {
            DOMElement* pChldElmnt = static_cast<DOMElement*>(pChild);
            std::string sigId = A(pChldElmnt->getAttribute(X("sigId")));
            std::string pointSetName = A(pChldElmnt->getAttribute(X("pointSetName")));
            Signature* pSignature = static_cast<Signature*>(Service<SessionManager>()->getSessionItem(sigId));
            if (pSignature == NULL)
            {
               return false;
            }
            mSigPointSets[pSignature] = pointSetName;
            pSignature->attach(SIGNAL_NAME(Subject, Deleted), Slot(this, &RangeProfilePlotManager::signatureDeleted));
            pSignature->getDataDescriptor()->attach(SIGNAL_NAME(DataDescriptor, Renamed),
               Slot(this, &RangeProfilePlotManager::signatureRenamed));
         }
      }
      deserializer.nextBlock();
      return DockWindowShell::deserialize(deserializer);
   }
   return false;
}
开发者ID:tclarke,项目名称:opticks-extras-Spectral,代码行数:52,代码来源:RangeProfilePlotManager.cpp

示例12: deserialize

bool SampleGeoref::deserialize(SessionItemDeserializer &deserializer)
{
    XmlReader reader(NULL, false);
    DOMElement* pRootElement = deserializer.deserialize(reader, "SampleGeoref");
    if (pRootElement)
    {
        std::string windowId = A(pRootElement->getAttribute(X("rasterId")));
        mpRaster = dynamic_cast<RasterElement*>(Service<SessionManager>()->getSessionItem(windowId));
        if (mpRaster != NULL)
        {
            mXSize = atoi(A(pRootElement->getAttribute(X("xSize"))));
            mYSize = atoi(A(pRootElement->getAttribute(X("ySize"))));
            mXScale = atof(A(pRootElement->getAttribute(X("xScale"))));
            mYScale = atof(A(pRootElement->getAttribute(X("yScale"))));
            mFrames = atof(A(pRootElement->getAttribute(X("frames"))));
            mExtrapolate = StringUtilities::fromXmlString<bool>(
                               A(pRootElement->getAttribute(X("extrapolationAccurate"))));
            mCurrentFrame = atoi(A(pRootElement->getAttribute(X("currentFrame"))));
            mRotate = atoi(A(pRootElement->getAttribute(X("rotate"))));
            std::string animId = A(pRootElement->getAttribute(X("animationId")));
            if (animId.empty() == false)
            {
                Animation* pAnim = dynamic_cast<Animation*>(Service<SessionManager>()->getSessionItem(animId));
                if (pAnim)
                {
                    mpAnimation.reset(pAnim);
                }
            }
            return true;
        }
    }
    return false;
}
开发者ID:pratikone,项目名称:gsoc2011-opticks,代码行数:33,代码来源:SampleGeoref.cpp

示例13: readFontElement

XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* readFontElement(const char* pName,
                                                           XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* pParent,
                                                           Font& font)
{
   DOMElement* pElement = dynamic_cast<DOMElement*>(findChildNode(pParent, pName));
   if (pElement)
   {
      font.setFace(A(pElement->getAttribute(X("face"))));
      font.setPointSize(StringUtilities::fromXmlString<int>(A(pElement->getAttribute(X("point_size")))));
      font.setBold(StringUtilities::fromXmlString<bool>(A(pElement->getAttribute(X("bold")))));
      font.setItalic(StringUtilities::fromXmlString<bool>(A(pElement->getAttribute(X("italic")))));
      font.setUnderline(StringUtilities::fromXmlString<bool>(A(pElement->getAttribute(X("underline")))));
   }
   return pElement;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:15,代码来源:xmlreader.cpp

示例14: fromXml

bool TextImp::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);
   mFont.fromString(A(pElem->getAttribute(X("font"))));
   mText = A(pElem->getAttribute(X("text")));
   mLocation = StringUtilities::fromXmlString<LocationType>(A(pElem->getAttribute(X("location"))));

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

示例15: fromXml

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

   bool bSuccess = RectangleObjectImp::fromXml(pDocument, version);
   if (bSuccess == true)
   {
      DOMElement* pElement = static_cast<DOMElement*>(pDocument);
      if (pElement != NULL)
      {
         string editable(A(pElement->getAttribute(X("textEditable"))));
         if (editable.empty() == false)
         {
            mTextEditable = StringUtilities::fromXmlString<bool>(editable);
         }
      }
   }

   mUpdateTexture = true;
   mUpdateBoundingBox = false;

   return bSuccess;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:26,代码来源:TextObjectImp.cpp


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