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


C++ DOMElement类代码示例

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


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

示例1: DOMHTMLFormElement

IDOMElement* DOMElement::createInstance(WebCore::Element* e)
{
    if (!e)
        return nullptr;

    HRESULT hr;
    IDOMElement* domElement = 0;

    if (is<WebCore::HTMLFormElement>(*e)) {
        DOMHTMLFormElement* newElement = new DOMHTMLFormElement(e);
        hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
    } else if (e->hasTagName(iframeTag)) {
        DOMHTMLIFrameElement* newElement = new DOMHTMLIFrameElement(e);
        hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
    } else if (is<WebCore::HTMLInputElement>(*e)) {
        DOMHTMLInputElement* newElement = new DOMHTMLInputElement(e);
        hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
    } else if (is<WebCore::HTMLOptionElement>(*e)) {
        DOMHTMLOptionElement* newElement = new DOMHTMLOptionElement(e);
        hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
    } else if (e->hasTagName(selectTag)) {
        DOMHTMLSelectElement* newElement = new DOMHTMLSelectElement(e);
        hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
    } else if (is<WebCore::HTMLTextAreaElement>(*e)) {
        DOMHTMLTextAreaElement* newElement = new DOMHTMLTextAreaElement(e);
        hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
    } else if (e->isHTMLElement()) {
        DOMHTMLElement* newElement = new DOMHTMLElement(e);
        hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
    } else {
        DOMElement* newElement = new DOMElement(e);
        hr = newElement->QueryInterface(IID_IDOMElement, (void**)&domElement);
    }

    if (FAILED(hr))
        return 0;

    return domElement;
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:39,代码来源:DOMCoreClasses.cpp

示例2: dom_document

musicxml::score_timewise
musicxml::parse<musicxml::score_timewise>(std::istream &is,
                                          const std::string &id) {
  xml::auto_initializer xerces_platform { true, false };

  std::unique_ptr<DOMDocument> doc { dom_document(is, id, true) };
  DOMElement *root { doc->getDocumentElement() };

  std::string const ns { xml::transcode<char>(root->getNamespaceURI()) };
  std::string const name { xml::transcode<char>(root->getLocalName()) };

  if (ns == "") {
    if (name == "score-partwise") {
      return musicxml::convert(musicxml::score_partwise{*root});
    } else if (name == "score-timewise") {
      return musicxml::score_timewise{*root};
    }
  }

  throw tree::unexpected_element<char>(name, ns,
                                       "score-partwise|score-timewise", "");
}
开发者ID:mlang,项目名称:xsdcxx-musicxml,代码行数:22,代码来源:utilities.cpp

示例3: return

DOMElement* Lampara::getNodo()
{
	DOMElement*		nodoColor;
	char*			aux;
	XMLCh*			nombreNodo;
	XMLCh*			valorNodo;
	
	
	/*	Se llama a getNodo en la clase base que hace la mayor parte del
		trabajo, y se terminan de rellenar los campos con esta 
		funcion*/
		ElementoSimple::getNodo("lampara");
	
	/*	Obtenemos una implementación DOM
		Nos basta con que implemente el núcleo (CORE) del
		estándar DOM*/
	DOMImplementation* implementacion=
		DOMImplementationRegistry::getDOMImplementation 
			(XMLString::transcode ("Core"));
	
	
	nombreNodo=XMLString::transcode ("color");
	nodoColor=doc->createElement(nombreNodo);
	nodoColor->setTextContent(this->getColor());
	
	/*	El puntero al documento raiz apunta al minidocumento
		"electroiman" creado antes. Se necesita para empezar
		a insertar elementos dentro del elemento*/
	DOMElement* punteroDocRaiz=doc->getDocumentElement();
	punteroDocRaiz->appendChild (nodoColor);
	punteroDocRaiz->appendChild (nodoEntradaReposo);
	punteroDocRaiz->appendChild (nodoSalidaReposo);
	punteroDocRaiz->appendChild (nodoEntradaActivacion);
	punteroDocRaiz->appendChild (nodoSalidaActivacion);	
	
	/*	Una vez enganchados los elementos, devolvemos el minidocumento*/
	return (DOMElement*) doc;

}
开发者ID:BackupTheBerlios,项目名称:simple,代码行数:39,代码来源:lampara.cpp

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

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

示例6: createImportedDocumentBase

	void *NclImportParser::parseImportedDocumentBase(
		    DOMElement *parentElement, void *objGrandParent) {

		void *parentObject;
		DOMNodeList *elementNodeList;
		DOMElement *element;
		DOMNode *node;
		string elementTagName;
		void *elementObject;

		//pre-compile attributes
		parentObject = createImportedDocumentBase(
			    parentElement, objGrandParent);

		if (parentObject == NULL) {
			return NULL;
		}

		elementNodeList = parentElement->getChildNodes();
		for (int i = 0; i < (int)elementNodeList->getLength(); i++) {
			node = elementNodeList->item(i);
			if(node->getNodeType()==DOMNode::ELEMENT_NODE){
				element = (DOMElement*)node;
				elementTagName = XMLString::transcode( element->getTagName() );
				if (XMLString::compareIString(
					     elementTagName.c_str(), "importNCL") == 0) {

					elementObject = parseImportNCL(element, parentObject);
					if (elementObject != NULL) {
						addImportNCLToImportedDocumentBase(
							    parentObject, elementObject);
					}
				}
			}
		}

		return parentObject;
	}
开发者ID:lince,项目名称:ginga-srpp,代码行数:38,代码来源:NclImportParser.cpp

示例7: createRegion

	void *NclLayoutParser::parseRegion(
		    DOMElement *parentElement, void *objGrandParent) {

		wclog << "parseRegion" << endl;
		void *parentObject;
		DOMNodeList *elementNodeList;
		DOMElement *element;
		DOMNode *node;
		string elementTagName;
		void *elementObject;

		parentObject = createRegion(parentElement, objGrandParent);
		if (parentObject == NULL) {
			return NULL;
		}

		elementNodeList = parentElement->getChildNodes();
		for (int i = 0; i < (int)elementNodeList->getLength(); i++) {
			node = elementNodeList->item(i);
			if (node->getNodeType()==DOMNode::ELEMENT_NODE) {
				element = (DOMElement*)node;
				elementTagName = XMLString::transcode(element->getTagName());
				wclog << ">>" << elementTagName.c_str() << ": ";
				wclog << XMLString::transcode(element->getAttribute(XMLString::transcode("id")));

				if (XMLString::compareIString(
					    elementTagName.c_str(), "region") == 0) {

					elementObject = parseRegion(element, parentObject);
					if (elementObject != NULL) {
						addRegionToRegion(parentObject, elementObject);
					}
				}
			}
		}

		return parentObject;
	}
开发者ID:lince,项目名称:ginga-srpp,代码行数:38,代码来源:NclLayoutParser.cpp

示例8: selectConfigElement

Triggerconf::STRING_LIST Triggerconf::getConfigAttributeNames (string module, string submodule, string configname)
{
	STRING_LIST ret;

	if (! existsConfigElement (module, submodule, configname)) return ret;

	DOMNode* node = selectConfigElement (module, submodule, configname);
	if (node == NULL || node->getNodeType () != DOMNode::ELEMENT_NODE) return ret;

	DOMElement* elem = (DOMElement*) node;
	DOMNamedNodeMap* attributes = elem->getAttributes ();

	for (unsigned int i=0; i<attributes->getLength (); i++) {
		DOMNode* attr = attributes->item (i);
		const XMLCh* xname = attr->getNodeName ();	
		char* cname = XMLString::transcode (xname);

		ret.push_back (cname);	
		XMLString::release (&cname);
	}

	return ret;
}
开发者ID:freshbob,项目名称:worms-attack,代码行数:23,代码来源:triggerconf.cpp

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

示例10: setError

string Triggerconf::getSubmoduleAttributeValue (string module, string submodule, string attributename)
{
	if (! existsSubmodule (module, submodule)) {
		setError ("invalid submodule");
		return "";
	}

	DOMNode* node = selectSubmodule (module, submodule);
	assert (node->getNodeType () == DOMNode::ELEMENT_NODE);
	DOMElement* elem = (DOMElement*) node;
	
	XMLCh*	xattrname	= XMLString::transcode (attributename.c_str ());
	const XMLCh* xattrval	= elem->getAttribute (xattrname);
	char*	charstring	= XMLString::transcode (xattrval);
	string	ret		= charstring;

	XMLString::release	(&xattrname);
	XMLString::release	(&charstring);

	resetError		();

	return ret;
}
开发者ID:freshbob,项目名称:worms-attack,代码行数:23,代码来源:triggerconf.cpp

示例11: return

ret_ CXMLLoaderActions::LoadEmpty(CProgram &Program,
								  const DOMElement *pElement, 
								  const CPDUInfo *pPDU)
{
#ifdef _DEBUG_
	if (!pElement)
		return (PARAMETER_NULL | PARAMETER_2);
#endif

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

	if (!pSub)
		return XML_LOADER_ERROR;

	CAutoPtr<CVariable> OV;

	while (pSub)
	{
		ret_ Ret = LoadVariable(Program.Data(), pSub, OV.Ptr(), pPDU);
		
		if (SUCCESS != Ret && XML_INVALID_ELEMENT != Ret)
			return Ret;

		if (SUCCESS == Ret)
			break;

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

	COptEmpty *pOperator = new COptEmpty(OV.Ptr());

	if (false_v == Program.AddOperator(pOperator))
		return XML_LOADER_ERROR;

	return SUCCESS;
}
开发者ID:shoutrain,项目名称:ComEgg,代码行数:37,代码来源:CXMLLoaderActions.cpp

示例12:

XMLNode *JobXML::AddElement( XMLNode *parent, std::string element, std::string content )
{
   // error check
   if ( parent == NULL ) return NULL;

   // create element
   XMLCh *elementName = XMLString::transcode( element.c_str() );   
   DOMElement *elementNode = mDocument->createElement( elementName );
   XMLString::release( &elementName );
   if ( elementNode == NULL )
   {     
      std::cout << "[Error] Creating element: " << element << "." << std::endl;
      return NULL;
   }

   // attach it
   parent->appendChild( elementNode );

   // create content
   if ( content.length() != 0 )
   {
      XMLCh *contentText = XMLString::transcode( content.c_str() );
      DOMText *textNode = mDocument->createTextNode( contentText );
      XMLString::release( &contentText );
      if ( textNode == NULL )
      {
         std::cout << "[Error] Creating content: " << content
            << " for element: " << element << "." << std::endl;         
      }
      else
      {
         elementNode->appendChild( textNode );
      }
   }

   return elementNode;
}
开发者ID:VRAC-WATCH,项目名称:deltajug,代码行数:37,代码来源:job_xml.cpp

示例13: applyInsertAttributes

void XercesUpdateFactory::applyInsertAttributes(const PendingUpdate &update, DynamicContext *context)
{
  const XercesNodeImpl *nodeImpl = (const XercesNodeImpl*)update.getTarget()->getInterface(Item::gXQilla);
  DOMElement *element = (DOMElement*)nodeImpl->getDOMNode();
  DOMDocument *doc = const_cast<DOMDocument*>(XPath2Utils::getOwnerDoc(element));

  bool untyped = nodeImpl->dmNodeKind() == Node::element_string &&
    XPath2Utils::equals(nodeImpl->getTypeName(), DocumentCache::g_szUntyped) &&
    XPath2Utils::equals(nodeImpl->getTypeURI(), SchemaSymbols::fgURI_SCHEMAFORSCHEMA);

  Result children = update.getValue();
  Item::Ptr item;
  while((item = children->next(context)).notNull()) {
    const XercesNodeImpl *childImpl = (const XercesNodeImpl*)item->getInterface(Item::gXQilla);
    DOMNode *newChild = importNodeFix(doc, const_cast<DOMNode*>(childImpl->getDOMNode()), /*deep*/true);

    // 1. Error checks:
    //    a. If the QNames of any two attribute nodes in $content have implied namespace bindings that conflict with each other,
    //       a dynamic error is raised [err:XUDY0024].
    //    b. If the QName of any attribute node in $content has an implied namespace binding that conflicts with a namespace
    //       binding in the "namespaces" property of $target, a dynamic error is raised [err:XUDY0024].
    // Checks performed by UpdateFactory

    // If the type-name property of $target is xs:untyped, then upd:setToUntyped($A) is invoked.
    if(!untyped) setTypes(newChild, childImpl->getDOMNode());

    // The parent property of $A is set to $target.
    // attributes: Modified to include the nodes in $content.
    element->setAttributeNode((DOMAttr*)newChild);

  }

  // upd:removeType($target) is invoked.
  removeType(element);

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

示例14: setInteractive

bool SpectralLibraryManager::deserialize(SessionItemDeserializer& deserializer)
{
    if (isBatch() == true)
    {
        setInteractive();
    }

    bool success = execute(NULL, NULL);

    if (success)
    {

        std::vector<Signature*> signatures;
        Service<SessionManager> pSessionManager;
        XmlReader reader(NULL, false);
        DOMElement* pRootElement = deserializer.deserialize(reader, "SpectralLibraryManager");
        for (DOMNode* pChild = pRootElement->getFirstChild(); pChild != NULL; pChild = pChild->getNextSibling())
        {
            DOMElement* pElement = static_cast<DOMElement*>(pChild);
            if (XMLString::equals(pElement->getNodeName(), X("Signature")))
            {
                std::string signatureId = A(pElement->getAttribute(X("signatureId")));
                Signature* pSignature = dynamic_cast<Signature*>(pSessionManager->getSessionItem(signatureId));
                if (pSignature != NULL)
                {
                    signatures.push_back(pSignature);
                }
            }
        }

        clearLibrary();
        addSignatures(signatures);
    }

    return success;
}
开发者ID:tclarke,项目名称:opticks-extras-Spectral,代码行数:36,代码来源:SpectralLibraryManager.cpp

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


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