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


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

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


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

示例1: fromXml

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

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

   DOMElement* pElement = static_cast<DOMElement*>(pDocument);
   if (pElement->hasAttribute(X("viewId")))
   {
      View* pOldView = mpView;
      setView(dynamic_cast<View*>(SessionManagerImp::instance()->getSessionItem(
         A(pElement->getAttribute(X("viewId"))))));
      Service<DesktopServices>()->deleteView(pOldView);
   }
   else
   {
      setView(NULL);
   }

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

示例2: parseSequence

static void parseSequence(DOMElement *parent, DOMElement *sequence, Class *cl, bool choice = false) {
    //we expect to see a whole bunch of <element>s here
    //if choice is true then this is a choice sequence - every element is optional
    CHECK(parent);
    CHECK(sequence);

    vector<DOMElement*> children = getChildElementsByTagName(sequence, "element");

    //support <sequence> in <choice> by simply recursing
    //simply put this means the <sequence> tags are ignored
    vector<DOMElement*> subSequences = getChildElementsByTagName(sequence, "sequence");

    if(subSequences.size() > 0 && !choice)
        throw runtime_error("Found <sequence> element in another <sequence> element");

    children.insert(children.end(), subSequences.begin(), subSequences.end());
    
    for(size_t x = 0; x < children.size(); x++) {
        DOMElement *child = children[x];
            
        int minOccurs = 1;
        int maxOccurs = 1;

        XercesString typeStr("type");
        XercesString minOccursStr("minOccurs");
        XercesString maxOccursStr("maxOccurs");
        string name = fixIdentifier(XercesString(child->getAttribute(XercesString("name"))));

        if(child->hasAttribute(minOccursStr)) {
            stringstream ss;
            ss << XercesString(child->getAttribute(minOccursStr));
            ss >> minOccurs;
        }

        if(child->hasAttribute(maxOccursStr)) {
            XercesString str(child->getAttribute(maxOccursStr));

            if(str == "unbounded")
                maxOccurs = UNBOUNDED;
            else {
                stringstream ss;
                ss << str;
                ss >> maxOccurs;
            }
        }
开发者ID:CantemoInternal,项目名称:pyjames,代码行数:45,代码来源:main.cpp

示例3: addInstance

void PLMXMLParser::addInstance(char *id, osg::Group *parent)
{

    std::map<char *, Element *, ltstr>::iterator it = instances.find(id);
    if (it != instances.end())
    {

        Element *instance = it->second;

        osg::Group *group = instance->group;
        DOMElement *element = instance->element;

        parent->addChild(group);
        coVRSelectionManager::markAsHelperNode(group);

        osg::MatrixTransform *transformNode = getTransformNode(id, element);
        if (transformNode)
        {
            group->addChild(transformNode);
            group = transformNode;
        }
        else
        {
            if (element->hasAttribute(TAG_name))
                group->setName(XMLString::transcode(element->getAttribute(TAG_name)));
            else
                group->setName(id);
        }

        const XMLCh *partRef = element->getAttribute(TAG_partRef);
        char *partName = XMLString::transcode(partRef);
        if (partName[0] == '#')
            addPart(partName + 1, group);
        else
            addPart(partName, group);
        XMLString::release(&partName);
    }
}
开发者ID:nixz,项目名称:covise,代码行数:38,代码来源:PLMXMLParser.cpp

示例4: fromXml

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

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

   if (mName != A(pElement->getAttribute(X("name"))))
   {
      throw XmlBase::XmlException("Element name does not match this element");
   }

   if (!Service<SessionManager>()->isSessionLoading() && mType != A(pElement->getAttribute(X("type"))))
   {
      throw XmlBase::XmlException("Element type does not match this element");
   }
   mProcessingLocation = StringUtilities::fromXmlString<ProcessingLocation>(
      A(pElement->getAttribute(X("processingLocation"))));

   for (DOMNode* pChild = pDocument->getFirstChild(); pChild != NULL; pChild = pChild->getNextSibling())
   {
      if (XMLString::equals(pChild->getNodeName(), X("classification")))
      {
         if (mClassification.fromXml(pChild, version) == false)
         {
            throw XmlReader::DomParseException("Can't deserialize classification", pDocument);
         }
      }
      else if (XMLString::equals(pChild->getNodeName(), X("metadata")))
      {
         if (mMetadata.fromXml(pChild, version) == false)
         {
            throw XmlReader::DomParseException("Can't deserialize metadata", pDocument);
         }
      }
      else if (XMLString::equals(pChild->getNodeName(), X("FileDescriptor")))
      {
         // create a new FileDescriptor to make sure we have the correct type of FileDescriptor
         delete mpFileDescriptor;
         DOMElement* pChildElement = static_cast<DOMElement*>(pChild);
         string fileDescriptorType = A(pChildElement->getAttribute(X("type")));

         ModelServicesImp* pModel = ModelServicesImp::instance();
         if (pModel != NULL)
         {
            if (pModel->isKindOfFileDescriptor(fileDescriptorType, "RasterFileDescriptor") == true)
            {
               mpFileDescriptor = new RasterFileDescriptorAdapter();
            }
            else if (pModel->isKindOfFileDescriptor(fileDescriptorType, "SignatureFileDescriptor") == true)
            {
               mpFileDescriptor = new SignatureFileDescriptorAdapter();
            }
            else if (pModel->isKindOfFileDescriptor(fileDescriptorType, "FileDescriptor") == true)
            {
               mpFileDescriptor = new FileDescriptorAdapter();
            }
         }

         if (mpFileDescriptor == NULL)
         {
            throw XmlReader::DomParseException("Cannot create file descriptor", pDocument);
         }

         if (mpFileDescriptor->fromXml(pChild, version) == false)
         {
            throw XmlReader::DomParseException("Cannot deserialize file descriptor", pDocument);
         }
      }
   }

   if (pElement->hasAttribute(X("importerName")) == true)
   {
      mImporterName = A(pElement->getAttribute(X("importerName")));
   }
   else
   {
      mImporterName.clear();
   }

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


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