Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
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", "");
}
Ejemplo n.º 3
0
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;

}
Ejemplo n.º 4
0
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;
            }
        }
Ejemplo n.º 5
0
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);
    }
}
Ejemplo n.º 6
0
	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;
	}
Ejemplo n.º 7
0
	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;
	}
Ejemplo n.º 8
0
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;
}
Ejemplo n.º 9
0
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;
}
Ejemplo n.º 10
0
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;
}
Ejemplo n.º 11
0
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;
}
Ejemplo n.º 12
0
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;
}
Ejemplo n.º 13
0
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);
}
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;
}
Ejemplo n.º 15
0
// 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);

}
Ejemplo n.º 16
0
void Triggerconf::createModule (string module)
{
	if (rootnode == NULL) return;
	
	if (existsModule (module)) {
		resetError ();	
		return;
	}

	XMLCh* xmodulename	= XMLString::transcode (ELEMENT_MODULE_NAME);
	DOMElement* node	= rootnode->getOwnerDocument ()->createElement	(xmodulename);
	XMLString::release	(&xmodulename);

	XMLCh* xattrname	= XMLString::transcode (ATTRIBUTE_NAME);
	XMLCh* xmodule		= XMLString::transcode (module.c_str ());
	node->setAttribute	(xattrname, xmodule);

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

	rootnode->appendChild (node);

	resetError ();
}
Ejemplo n.º 17
0
bool CurveCollectionImp::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("Curve")))
      {
         CurveImp* pCurve = dynamic_cast<CurveImp*>(addCurve());
         if (pCurve == NULL || !pCurve->fromXml(pChld, version))
         {
            return false;
         }
      }
   }
   return true;
}
Ejemplo n.º 18
0
string InputHandler::getAttributeValueByName(const XMLCh* elementNode, const XMLCh* attribute, const XMLCh* name)
{

     crusde_debug("%s, line: %d, InputHandler::getAttributeValueByName(%s) name = %s ", __FILE__, __LINE__, XMLString::transcode(elementNode),
     XMLString::transcode(name));
     assert(doc);

     DOMElement *root = doc->getDocumentElement();
     DOMNode *child = root->getFirstChild();
     DOMNamedNodeMap *attributes = NULL;
		
     while (child)
     {
          if(child != NULL)
               if( child->getNodeType() == DOMNode::ELEMENT_NODE )
               {
                    if(child->hasAttributes())
                    {
                         attributes = child->getAttributes();

                         if( XMLString::compareIString( child->getNodeName(), elementNode) == 0 && 
                             XMLString::compareIString( attributes->getNamedItem(ATTR_name.xmlStr())->getNodeValue(), name) == 0 )
                         {
                              char *val = XMLString::transcode(attributes->getNamedItem(attribute)->getNodeValue());
                              string value(val);
                              XMLString::release(&val);
                              return value;
                         }
                    }
               }

          child = child->getNextSibling();
     }
	
     return string();
}
Ejemplo n.º 19
0
int ModelicaXML::serializeMoFileToXML(char* fileName)
{
  // ModelicaXML filename (normal operation)
  DOMElement *pModelicaXMLElement = createModelicaXMLDOMElement(fileName);
  if (pModelicaXMLElement) pRootElementModelica->appendChild(pModelicaXMLElement);
  // vomit the current XML Document to file
  std::string xmlFile(fileName);
  xmlFile += ".xml";
  serializeXMLDocumentToFile(xmlFile);

  XMLSize_t elementCount = pModelicaXMLDoc->getElementsByTagName(X("*"))->getLength();
  std::cout << std::endl;
  std::cout << "The tree serialized contains: " << elementCount << " elements." << std::endl;

  return 0;
}
Ejemplo n.º 20
0
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;
}
Ejemplo n.º 21
0
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;
}
Ejemplo n.º 22
0
Archivo: XCube.cpp Proyecto: mydw/mydw
xercesc::DOMElement *XCube::recursiveXML(xercesc::DOMDocument* doc)
{
	DOMElement *cubeElem = doc->createElement(XMLString::transcode("Cube"));

	if(this->_name != "")
		cubeElem->setAttribute(XMLString::transcode("name"),XMLString::transcode(this->_name.c_str()));
	if(this->_fact != "")
		cubeElem->setAttribute(XMLString::transcode("tablename"),XMLString::transcode(this->_fact.c_str()));

	if(this->_dimensions.size() > 0)
	{
		Dimension *tempdimension;
		for(int i = 0;i < this->_dimensions.size() ;i++)
		{
			tempdimension = this->getDimension(_dimensions[i]->getName());
			cubeElem->appendChild(tempdimension->recursiveXML(doc));

		}

	}

	if(this->_measures.size() > 0)
	{
		Measure *tempMeasures;
		for(int i = 0;i < this->_measures.size() ;i++)
		{
			tempMeasures = this->getMeasure(_measures[i]->getName());
			cubeElem->appendChild(tempMeasures->recursiveXML(doc));

		}

	}

	if(this->_calcmembers.size() > 0)
	{
		calcMember *tempCalcmember;
		for(int i = 0;i < this->_calcmembers.size() ;i++)
		{
			tempCalcmember = this->getCalMember(_calcmembers[i]->getName());
			cubeElem->appendChild(tempCalcmember->recursiveXML(doc));

		}

	}

	return cubeElem;
}
Ejemplo n.º 23
0
DOMElement* EppUtil::createElementNS( DOMDocument& doc, const DOMString ns, const DOMString tag, bool flag , char *_version)
{
	DOMElement* elm;
	DOMString prefix(EPP_NAME_SPACE);
	char *use_version = version;

	if( NULL != _version ) /*param provided*/
		use_version = _version;

	if( tag.isNull() )
	{
		elm = doc.createElementNS(prefix + ns + use_version , ns);
		elm->setAttribute(XS("xmlns"), XS(EPP_NAME_SPACE) + ns + use_version );
		if( use_version[0] == 0 )
		{
			// old EPP-02 schema
			elm->setAttribute(XS("xmlns:xsi"), XS("http://www.w3.org/2000/10/XMLSchema-instance"));
		}
		else
		{
			elm->setAttribute(XS("xmlns:xsi"), XS("http://www.w3.org/2001/XMLSchema-instance"));
		}
	}
	else
	{
		elm = doc.createElementNS(prefix + ns + use_version, tag);
		elm->setPrefix(ns);
		if( flag )
		{
			elm->setAttribute(XS("xmlns"), prefix + ns + use_version);
		}
		elm->setAttribute(XS("xmlns:") + ns, prefix + ns + use_version);
	}
	elm->setAttribute(XS("xsi:schemaLocation"), prefix + ns + use_version + " " + ns + use_version + ".xsd");

	return elm;
}
Ejemplo n.º 24
0
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;
}
Ejemplo n.º 25
0
int ModelicaXML::serializeAllMoFilesInDirectoryInXMLFile(char *directoryName, char *xmlFileName)
{
  int i=0;
  typedef std::string mstring;
  mstring filename;
  l_list dirList;
  getDirectoryStructure(directoryName, dirList);
  std::list<char*>::const_iterator it;
  for(it=dirList.begin(); it!=dirList.end(); ++it)
  {
    l_list fileList;
    getFileList(*it, fileList, "*.mo");
    // take care of pakage.mo first
    fileList = sortMoFiles(fileList);
    cout << "Found: " << fileList.size() << " *.mo files in directory: " << *it  << endl;
    std::list<char*>::const_iterator itFileList;
    for(itFileList=fileList.begin(); itFileList!=fileList.end(); ++itFileList)
    {
      filename = mstring(*itFileList);
      cout << " [" << *itFileList << "]" << endl;
      DOMElement* pModelicaXML = createModelicaXMLDOMElement(filename.c_str());
      // if is not NULL append it to the <modelica></modelica> element
      if (pModelicaXML)
      {
        pRootElementModelica->appendChild(pModelicaXML);
        i++;
      }
    }
    if (fileList.size()) cout << endl;
  }
  // vomit the current XML Document to file
  std::string xmlFile(xmlFileName);
  xmlFile = mstring(directoryName) + mstring(PATH_SEPARATOR) + xmlFile;
  xmlFile += ".xml";
  serializeXMLDocumentToFile(xmlFile);
  cout << "Found: " << i << " .mo files" << endl;
  cout << "Serialized to: " << xmlFile << endl;
  return 0;
}
DOMElement* EppResponseDataTransferSvcsub::toXML( DOMDocument& doc, const DOMString& tag )
{
	DOMElement* elm;
	DOMElement* body = doc.createElement(tag);
	DOMElement* data = EppUtil::createElementNS(doc, "svcsub", "trnData");
	body->appendChild(data);

	if( id.isNotNull() )
	{
		elm = doc.createElement(XS("id"));
		elm->appendChild(doc.createTextNode(id));
		data->appendChild(elm);
	}
	if( service.isNotNull() )
	{
		elm = doc.createElement(XS("xervice"));
		elm->appendChild(doc.createTextNode(service));
		data->appendChild(elm);
	}

	toXMLCommon(doc, *data);

	return body;
}
Ejemplo n.º 27
0
/* Add the name/value pairs to the document. */
static void AddNameValuePairs(const char *title, ParameterNameValuePairList &params, DOMDocument* doc, DOMElement* parentElement)
{
    if (params.size() == 0)
        return;

    DOMElement* element = doc->createElement(ToXMLCh(NAME_VALUE_PAIRS_ELEMENT_NAME));
    element->setAttribute(ToXMLCh(NAME_ATTRIBUTE), ToXMLCh(title));
    for (ParameterNameValuePairList::iterator it=params.begin(); it!=params.end(); it++)
    {
        ParameterNameValuePair &pair = *it;
        DOMElement* pairElement = doc->createElement(ToXMLCh(NAME_VALUE_PAIR_ELEMENT_NAME));
        pairElement->setAttribute(ToXMLCh(NAME_ATTRIBUTE), ToXMLCh(pair.Name));
        pairElement->setAttribute(ToXMLCh(VALUE_ATTRIBUTE), ToXMLCh(pair.Value));
        element->appendChild(pairElement);
    }
    parentElement->appendChild(element);
}
Ejemplo n.º 28
0
DOMElement* EppCredsOptions::toXML( DOMDocument& doc, const DOMString& tag )
{
	DOMElement* body = doc.createElement(tag);
	DOMElement* elm;

	if( version.isNotNull() )
	{
		elm = doc.createElement(XS("version"));
		elm->appendChild(doc.createTextNode(version));
		body->appendChild(elm);
	}
	if( lang.isNotNull() )
	{
		elm = doc.createElement(XS("lang"));
		elm->appendChild(doc.createTextNode(lang));
		body->appendChild(elm);
	}

	return body;
}
Ejemplo n.º 29
0
DOMElement* EppContactData::toXML( DOMDocument& doc, const DOMString& tag )
{
	DOMElement* body = doc.createElement(tag);
	DOMElement* elm;

	if( name.isNotNull() )
	{
		elm = doc.createElement(XS("name"));
		elm->appendChild(doc.createTextNode(name));
		body->appendChild(elm);
	}
	if( (org.isNotNull()) || hasOrg )
	{
		elm = doc.createElement(XS("org"));
		elm->appendChild(doc.createTextNode(org));
		body->appendChild(elm);
	}
	if( !addr.isNull() )
	{
		body->appendChild(addr.toXML(doc, "addr"));
	}

	return body;
}
DOMElement* EppCommandTransferDomain::toXMLPoll( DOMDocument& doc, const DOMString& tag )
{
	DOMElement* elm;
	DOMElement* body = EppUtil::createElementNS(doc, "domain", tag);

	if( name.isNotNull() )
	{
		elm = doc.createElement(XS("name"));
		elm->appendChild(doc.createTextNode(name));
		body->appendChild(elm);
	}
	if( period != null )
	{
		body->appendChild(period->toXML(doc, "period"));
	}
	if( authInfo != null )
	{
		body->appendChild(authInfo->toXML(doc, "authInfo"));
	}

	return body;
}