コード例 #1
0
void
CADReader::componentassembly (DOMElement* element)
throw(CADReadException)
{
	std::string element_name;
	DOMNode* child = element->getFirstChild();
	while (child != 0)
	{
		if (child->getNodeType() == DOMNode::ELEMENT_NODE)
		{
			element_name = XMLString::transcode(child->getNodeName());

			//
			// description
			//
			if (element_name == "description")
			{
				description((DOMElement*)(child));
			}

			//
			// componentfiles
			//
			else if (element_name == "componentfiles")
			{
				componentfiles((DOMElement*)(child));
			}

			//
			// partitioning
			//
			else if (element_name == "partitioning")
			{
				partitioning((DOMElement*)(child));
			}

			//
			// connections
			//
			else if (element_name == "connections")
			{
				connections((DOMElement*)(child));
			}

			//
			// extension
			//
			else if (element_name == "extension")
			{
				extension((DOMElement*)(child));
			}
		}

        // get next child
	    child = child->getNextSibling();
	}
}
コード例 #2
0
ファイル: ConfigItem.cpp プロジェクト: lozpeng/applesales
long SYSTEM::CConfigItem::GetChildCount()
{
	int iCount=0;
	DOMNode *child = ((DOMElement*)itemElement)->getFirstChild();
	if(!child)
	{
		return 0;
	}
	while (child != 0) {
		if(child->getNodeType()==DOMNode::TEXT_NODE)
		{	
			child = child->getNextSibling();
			continue;
		}
		iCount++;
		child = child->getNextSibling();
	}
	return iCount;
}
コード例 #3
0
bool ScaleBarObjectImp::fromXml(DOMNode* pDocument, unsigned int version)
{
   if (pDocument == NULL)
   {
      return false;
   }

   bool bSuccess = FilledObjectImp::fromXml(pDocument, version);
   if (bSuccess == true)
   {
      mpGroup->removeAllObjects(true);

      DOMNode* pObjectNode = pDocument->getFirstChild();
      while (pObjectNode != NULL)
      {
         if (XMLString::equals(pObjectNode->getNodeName(), X("objects")))
         {
            DOMNode* pGroupNode = pObjectNode->getFirstChild();
            while (pGroupNode != NULL)
            {
               if (XMLString::equals(pGroupNode->getNodeName(), X("Graphic")))
               {
                  DOMElement* pElement(static_cast<DOMElement*> (pGroupNode));
                  string type(A(pElement->getAttribute(X("type"))));

                  GraphicObjectType objectType = StringUtilities::fromXmlString<GraphicObjectType>(type);
                  if (objectType == GROUP_OBJECT)
                  {
                     bSuccess = mpGroup->fromXml(pGroupNode, version);
                     break;
                  }
               }

               pGroupNode = pGroupNode->getNextSibling();
            }
         }

         pObjectNode = pObjectNode->getNextSibling();
      }
   }

   return bSuccess;
}
コード例 #4
0
ComponentInstanceData
CADReader::componentinstantiation (DOMElement* element)
throw(CADReadException)
{
	std::string element_name;
	ComponentInstanceData data;
    data.id = XMLString::transcode(element->getAttribute(X("id")));
	DOMNode* child = element->getFirstChild();
	while (child != 0)
	{
		if (child->getNodeType() == DOMNode::ELEMENT_NODE)
		{
			element_name = XMLString::transcode(child->getNodeName());

			//
			// usagename
			//
			if (element_name == "usagename")
			{
				data.usage_name = usagename((DOMElement*)(child));
			}

			//
			// componentproperties
			//
			else if (element_name == "componentproperties")
			{
				data.comp_prop = componentproperties((DOMElement*)(child));
			}

			//
			// registercomponent
			//
			else if (element_name == "registercomponent")
			{
				registercomponent((DOMElement*)(child));
			}

			//
			// extension
			//
			else if (element_name == "extension")
			{
				extension((DOMElement*)(child));
			}
		}

        // get next child
	    child = child->getNextSibling();
	}

	return data;
}
コード例 #5
0
ファイル: main.cpp プロジェクト: CantemoInternal/pyjames
static DOMElement *getExpectedChildElement(DOMNode *parent, string childName) {
    for(DOMNode *child = parent->getFirstChild(); child; child = child->getNextSibling()) {
        if(child->getNodeType() == DOMNode::ELEMENT_NODE && child->getLocalName() && XercesString(child->getLocalName()) == childName) {
            DOMElement *childElement = dynamic_cast<DOMElement*>(child);
            CHECK(childElement);

            return childElement;
        }
    }

    throw runtime_error((string)XercesString(parent->getLocalName()) + " missing expected child element " + childName);
}
コード例 #6
0
ファイル: LayerImporter.cpp プロジェクト: Tom-VdE/opticks
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;
}
コード例 #7
0
ファイル: DomSerializer.cpp プロジェクト: havoc83/oreka
DOMNode* DomSerializer::FindElementByName(DOMNode *node, CStdString name)
{
	DOMNode *child = node->getFirstChild();
	while(child)
	{
		if (XMLStringToLocal(child->getNodeName()) == name && child->getNodeType() == DOMNode::ELEMENT_NODE)
		{
			return child;
		}
		child = child->getNextSibling();
	}
	return NULL;
}
コード例 #8
0
ファイル: main.cpp プロジェクト: CantemoInternal/pyjames
static vector<DOMElement*> getChildElements(DOMElement *parent) {
    vector<DOMElement*> ret;
    
    for(DOMNode *child = parent->getFirstChild(); child; child = child->getNextSibling()) {
        if(child->getNodeType() == DOMNode::ELEMENT_NODE) {
            DOMElement *childElement = dynamic_cast<DOMElement*>(child);
            CHECK(childElement);

            ret.push_back(childElement);
        }
    }

    return ret;
}
コード例 #9
0
DOMNode* getTagByName (DOMNode* node, std::string tagName) {
	assert (node->getNodeType () == DOMNode::ELEMENT_NODE);
	
	DOMNode* tag = 0;
	DOMNode* CurNode = node->getFirstChild ();
	while (CurNode != 0) {
		if (std::string (XMLString::transcode (CurNode->getNodeName())) == tagName) {
			cdebug << "Found..." << XMLString::transcode (CurNode->getNodeName()) << std::endl;
			return CurNode;
		}
		CurNode = CurNode->getNextSibling ();
	}
	throw ("Not found");
} /* DOMNode* getTagByName (DOMNode* node, std::string tagName) */
コード例 #10
0
void
CADReader::connections (DOMElement* element)
throw(CADReadException)
{
	std::string element_name;
	DOMNode* child = element->getFirstChild();
	while (child != 0)
	{
		if (child->getNodeType() == DOMNode::ELEMENT_NODE)
		{
			element_name = XMLString::transcode(child->getNodeName());
		
			//
			// connectinterface
			//
			if (element_name == "connectinterface")
			{
				connectinterface((DOMElement*)(child));
			}

			//
			// connectevent
			//
			if (element_name == "connectevent")
			{
				connectevent((DOMElement*)(child));
			}

			//
			// connecthomes
			//
			if (element_name == "connecthomes")
			{
				connecthomes((DOMElement*)(child));
			}

			//
			// extension
			//
			if (element_name == "extension")
			{
				extension((DOMElement*)(child));
			}
		}

		// get next child
		child = child->getNextSibling();
    }
}
コード例 #11
0
ファイル: Parameter.cpp プロジェクト: SparkyCola/FreeCAD
XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *ParameterGrp::FindNextElement(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *Prev, const char* Type) const
{
    DOMNode *clChild = Prev;
    if (!clChild) return 0l;

    while ((clChild = clChild->getNextSibling())!=0) {
        if (clChild->getNodeType() == DOMNode::ELEMENT_NODE) {
            // the right node Type
            if (!strcmp(Type,StrX(clChild->getNodeName()).c_str())) {
                return (DOMElement*)clChild;
            }
        }
    }
    return NULL;
}
コード例 #12
0
ファイル: Normalizer.cpp プロジェクト: kanbang/Colt
void Normalizer::printEntityRefNodes(DOMElement *ele) {
    
    DOMNode *child = ele->getFirstChild();

    while(child != 0) {
        if(child->getNodeType() == DOMNode::ENTITY_REFERENCE_NODE) {
            XERCES_STD_QUALIFIER cout << "start of entity ref node" << XERCES_STD_QUALIFIER endl;
            DOMNode *entChild = ((DOMEntityReference*)child)->getFirstChild();
            while(entChild != 0) {
                serializeNode(entChild);
                entChild = entChild->getNextSibling();
            }
            XERCES_STD_QUALIFIER cout << "\nend of entity ref node\n\n" << XERCES_STD_QUALIFIER endl;

        }

        if(child->getNodeType() == DOMNode::ELEMENT_NODE) {
            printEntityRefNodes((DOMElement*)child);
        }

        child = child->getNextSibling();
    }
    
}
コード例 #13
0
ファイル: XUtil.cpp プロジェクト: mydw/mydw
// Finds and returns the last child element node.
DOMElement* XUtil::getNextSiblingElement(const DOMNode* const node)
{
    // search for node
    DOMNode* sibling = node->getNextSibling();

    while (sibling != 0)
	{
        if (sibling->getNodeType() == DOMNode::ELEMENT_NODE)
            return (DOMElement*)sibling;

        sibling = sibling->getNextSibling();
    }

    // not found
    return 0;
}
コード例 #14
0
bool ConfigurationFileHandler::getSubAlgorithm(std::string algorithm, std::string subalgorithm, std::string* result){
#ifdef BRICS_XERCES_ENABLE
	if (errorsOccured) {
		return false;
	}

    DOMNode* current = NULL;
    DOMNode* attributeNode = NULL;
    XMLCh* algorithmName = XMLString::transcode(algorithm.c_str());
    XMLCh* subAlgorithmName = XMLString::transcode(subalgorithm.c_str());
    XMLCh* implementationString = XMLString::transcode("implementation");
    bool subAlgorithmFound = false;

    DOMDocument* doc = parser->getDocument();
    DOMNodeList* root = doc->getElementsByTagName(algorithmName);
    if (root->getLength() > 1) {
    	LOG(WARNING) << "More than one " << algorithm << " found, taking the first one";
    } else if(root->getLength() < 1) {
    	LOG(WARNING) << "No algorithm called " << algorithm << " found.";
		return false; //TODO release resouces
    }

    current = root->item(0);

    //search in children notes
	for (current = current->getFirstChild()->getNextSibling(); current!=NULL; current = current->getNextSibling()) {
		string nodeName = XMLString::transcode(current->getNodeName());
		if (nodeName.compare(subalgorithm) == 0) {
		    DOMNamedNodeMap* attributesList =  current->getAttributes();
		    attributeNode = attributesList->getNamedItem(implementationString);
		    if (attributeNode != 0) {
		    	*result = XMLString::transcode(attributeNode->getNodeValue());
		    	subAlgorithmFound = true;
		    	break; //take only first found
		    }
		}
	}

    XMLString::release(&algorithmName);
    XMLString::release(&subAlgorithmName);
    XMLString::release(&implementationString);

    return subAlgorithmFound;
#else
    return false;
#endif
}
コード例 #15
0
XERCES_CPP_NAMESPACE_BEGIN

DOMDocument *
XIncludeDOMDocumentProcessor::doXIncludeDOMProcess(const DOMDocument * const source, XMLErrorReporter *errorHandler, XMLEntityHandler* entityResolver /*=NULL*/){
    XIncludeUtils xiu(errorHandler);

    DOMImplementation* impl = source->getImplementation();
    DOMDocument *xincludedDocument = impl->createDocument();
    
    try
    {
        /* set up the declaration etc of the output document to match the source */
        xincludedDocument->setDocumentURI( source->getDocumentURI());
        xincludedDocument->setXmlStandalone( source->getXmlStandalone());
        xincludedDocument->setXmlVersion( source->getXmlVersion());

        /* copy entire source document into the xincluded document. Xincluded document can
           then be modified in place */
        DOMNode *child = source->getFirstChild();
        for (; child != NULL; child = child->getNextSibling()){
            if (child->getNodeType() == DOMNode::DOCUMENT_TYPE_NODE){
                /* I am simply ignoring these at the moment */
                continue;
            }
            DOMNode *newNode = xincludedDocument->importNode(child, true);
            xincludedDocument->appendChild(newNode);
        }

        DOMNode *docNode = xincludedDocument->getDocumentElement();
        /* parse and include the document node */
        xiu.parseDOMNodeDoingXInclude(docNode, xincludedDocument, entityResolver);

        xincludedDocument->normalizeDocument();
    }
    catch(const XMLErrs::Codes)
    {
        xincludedDocument->release();
        return NULL;
    }
    catch(...)
    {
        xincludedDocument->release();
        throw;
    }

    return xincludedDocument;
}
コード例 #16
0
void
CADReader::connectevent (DOMElement* element)
throw(CADReadException)
{
	std::string element_name;
	EventConnectionData event_connection;
	DOMNode* child = element->getFirstChild();
	while (child != 0)
	{
		if (child->getNodeType() == DOMNode::ELEMENT_NODE)
		{
			element_name = XMLString::transcode(child->getNodeName());

			//
			// consumesport
			//
			if (element_name == "consumesport")
			{
				event_connection.consumer = consumesport((DOMElement*)(child));
			}

			//
			// emitsport
			//
			else if (element_name == "emitsport")
			{
				event_connection.kind = EMITTER;
				event_connection.emitter = emitsport((DOMElement*)(child));
			}

			//
			// publishesport
			//
			else if (element_name == "publishesport")
			{
				event_connection.kind = PUBLISHER;
				event_connection.emitter = publishesport((DOMElement*)(child));
			}
		}

        // get next child
	    child = child->getNextSibling();
	}

	// add new event_connection
	data_->event_connections_.push_back(event_connection);
}
コード例 #17
0
ファイル: CCDReader.cpp プロジェクト: BackupTheBerlios/qedo
void
CCDReader::corbacomponent (DOMElement* element)
throw(CCDReadException)
{
    std::string repid_of_home;
    DOMNode* child = element->getFirstChild();
    while (child != 0)
    {
        if (child->getNodeType() == DOMNode::ELEMENT_NODE)
        {
            //
            // homerepid
            //
            if (!XMLString::compareString(child->getNodeName(), X("homerepid")))
            {
                data_->home_repid = homerepid((DOMElement*)child);
            }

            //
            // homefeatures
            //
            else if (!XMLString::compareString(child->getNodeName(), X("homefeatures")))
            {

            }

            //
            // componentkind
            //
            else if (!XMLString::compareString(child->getNodeName(), X("componentkind")))
            {
                componentkind( (DOMElement*)child );
            }

            //
            // componentfeatures
            //
            else if (!XMLString::compareString(child->getNodeName(), X("componentfeatures")))
            {
                componentfeatures( (DOMElement*) child);
            }
        }

        // get next child
        child = child->getNextSibling();
    }
}
コード例 #18
0
ファイル: DeltaApply.cpp プロジェクト: alon/xydiff
void DeltaApplyEngine::ApplyDeltaElement(DOMNode* incDeltaElement) {
	vddprintf(("Apply delta element\n"));
	deltaElement = incDeltaElement;
	
	/* ---- Do All DELETE Operations ( including 'from' part of move ) ---- */
	
	vddprintf(("Apply Delete operations\n"));
	DOMNode* firstOp = deltaElement->getFirstChild() ;
	vddprintf(("    first sort delete operations...\n"));
	SortDeleteOperationsEngine deleteOps(xiddoc, firstOp);
	vddprintf(("    then apply all of them 1 by 1...\n"));
	while(!deleteOps.isListEmpty()) {
		DOMNode* op=deleteOps.getNextDeleteOperation();
		ApplyOperation(op);
		}

	vddprintf(("Ok, there are no more delete operations.\n"));
	
	/* ---- Do All INSERT Operations ( including 'to' part of move ) ---- */
	
	firstOp = deltaElement->getFirstChild() ;
	SortInsertOperationsEngine insertOps(xiddoc, firstOp);
	while(!insertOps.isListEmpty()) {
		DOMNode* op=insertOps.getNextInsertOperation();
		ApplyOperation(op);
		}
	
	/* ---- Do all  UPDATE  &  ATTRIBUTE  Operations ---- */

	DOMNode* child = deltaElement->getFirstChild() ;
	XMLCh iStr[100];
	XMLString::transcode("i", iStr, 99);
	XMLCh dStr[100];
	XMLString::transcode("d", dStr, 99);
	while (child != NULL) {
		if ( (!XMLString::equals(child->getLocalName(),iStr))
		
		   &&(!XMLString::equals(child->getLocalName(), dStr)) ) ApplyOperation(child);
	  child = child->getNextSibling() ;
		}
		
	/* ---- Small consistency checks ---- */

	if (moveDocument->getDocumentElement()->hasChildNodes()) THROW_AWAY(("temporary document used to move node is not empty!"));

	vddprintf(("xiddoc=%s\n",xiddoc->getXidMap().String().c_str() ));
}
コード例 #19
0
ファイル: bml_event.cpp プロジェクト: gsi-upm/SmartSim
BehaviorRequestPtr BML::parse_bml_event( DOMElement* elem, const std::string& unique_id, BehaviorSyncPoints& behav_syncs, bool required, BmlRequestPtr request, SmartBody::SBScene* scene ) {

    const XMLCh* tag      = elem->getTagName();

	// message (the event behavior) can be retrieved either via the attribute, or via the text content.
	std::string msg  = xml_parse_string( BMLDefs::ATTR_MESSAGE, elem, "");	

	std::string spNameOld = xml_parse_string( BMLDefs::ATTR_STROKE, elem, ""); // if 'stroke' is used, assume old-style command sent via VHMSG	
	std::string spNameNew = xml_parse_string( BMLDefs::ATTR_START, elem, ""); // if 'start' is used, assume Python style internally only
	std::string localId  = xml_parse_string( BMLDefs::ATTR_ID, elem, "");

	DOMNode* child = elem->getFirstChild();
	while (child)
	{
		DOMNode::NodeType type = child->getNodeType();
		if (type == DOMNode::CDATA_SECTION_NODE)
		{
			child->normalize();
			DOMText* textNode = dynamic_cast<DOMText*>(child);
			const XMLCh* messageData = textNode->getNodeValue();
			msg = xml_utils::xml_translate_string(messageData);

			break;
		}
	
		child = child->getNextSibling();
	}

	if (msg != "" )
	{	
		if (spNameNew.size() > 0)
		{
			// new style event sent via Python
			return BehaviorRequestPtr( new EventRequest( unique_id, localId, "", msg, behav_syncs, spNameNew ) );
		}
		else
		{
			// old style command send via vhmsg
			return BehaviorRequestPtr( new EventRequest( unique_id, localId, msg, "", behav_syncs, spNameOld ) );
		}
	} 
	else
	{
		xml_parse_error( BMLDefs::ATTR_MESSAGE, elem );
		return BehaviorRequestPtr();  // a.k.a., NULL
	}
}
コード例 #20
0
void
CSDReader::idl (DOMElement* element)
throw(CSDReadException)
{
	std::string element_name;
	IDLData data;
	data_->repid = Qedo::transcode(element->getAttribute(X("id")));
    DOMNode* child = element->getFirstChild();
	while (child != 0)
	{
		if (child->getNodeType() == DOMNode::ELEMENT_NODE)
		{
			element_name = Qedo::transcode(child->getNodeName());

			//
			// link
			//
			if (element_name == "link")
			{
				data.kind = LINK;
				data.location = link((DOMElement*)child);
				data_->idl = data;
			}

			//
			// fileinarchive
			//
			if (element_name == "fileinarchive")
			{
				data.kind = FILEINARCHIVE;
				data.location = fileinarchive((DOMElement*)child);
				data_->idl = data;
			}

			//
			// repository
			//
			if (element_name == "repository")
			{
				// todo
			}
		}

		// get next child
		child = child->getNextSibling();
    }
}
コード例 #21
0
void
CSDReader::valuetypefactory (DOMElement* element)
throw(CSDReadException)
{
	std::string element_name;
	ValuetypeData data;
	data.repid = Qedo::transcode(element->getAttribute(X("repid")));
    DOMNode* child = element->getFirstChild();
	while (child != 0)
	{
		if (child->getNodeType() == DOMNode::ELEMENT_NODE)
		{
			element_name = Qedo::transcode(child->getNodeName());

			//
			// codebase
			//
			if (element_name == "codebase")
			{
				// todo
			}

			//
			// fileinarchive
			//
			if (element_name == "fileinarchive")
			{
				data.location = fileinarchive((DOMElement*)child);
			}

			//
			// link
			//
			if (element_name == "link")
			{
				data.location = link((DOMElement*)child);
			}
		}

		// get next child
		child = child->getNextSibling();
    }

	DEBUG_OUT2( "CSDReader: <valuetypefactory> ", data.repid );
	data_->valuetypes.push_back(data);
}
コード例 #22
0
void
CSDReader::softpkgref (DOMElement* element)
throw(CSDReadException)
{
	std::string element_name;
	std::string idref;
    DOMNode* child = element->getFirstChild();
	while (child != 0)
	{
		if (child->getNodeType() == DOMNode::ELEMENT_NODE)
		{
			element_name = Qedo::transcode(child->getNodeName());

			//
			// fileinarchive
			//
			if (element_name == "fileinarchive")
			{
				// todo
				//fileinarchive( (DOMElement*)child );
			}

			//
			// link
			//
			else if (element_name == "link")
			{
				// todo
				//link( (DOMElement*)child );
			}

			//
			// implref
			//
			else if (element_name == "implref")
			{
				idref = implref( (DOMElement*)child );
			}
		}

		// get next child
		child = child->getNextSibling();
    }

	data_->softpkg_dependencies.push_back( idref );
}
コード例 #23
0
void
CADReader::componentfile (DOMElement* element)
throw(CADReadException)
{
	std::string element_name;
	std::string file_name;
	DOMNode* child = element->getFirstChild();
	while (child != 0)
	{
		if (child->getNodeType() == DOMNode::ELEMENT_NODE)
		{
			element_name = XMLString::transcode(child->getNodeName());
			
			//
			// fileinarchive
			//
			if (element_name == "fileinarchive")
			{
				file_name = fileinarchive((DOMElement*)(child));
			}

			//
			// codebase
			//
			else if (element_name == "codebase")
			{
				// TODO
			}

			//
			// link
			//
			else if (element_name == "link")
			{
				file_name = link((DOMElement*)(child));
			}
		}

        // get next child
	    child = child->getNextSibling();
	}

	std::string id = XMLString::transcode(element->getAttribute(X("id")));
	DEBUG_OUT2( "CADReader: <componentfile> ", file_name );
	data_->implementationMap_[id] = file_name;
}
コード例 #24
0
void ColladaObject::ReadRootNode(const DOMNode* node)
{
	_ASSERTE(node != NULL);

	DOMNode* currentNode = node->getFirstChild();
	while( currentNode != NULL )
	{
#if _DEBUG	// デバッグ時に名前をチェックする為に
		const XMLCh* name = currentNode->getNodeName();
#endif
		if( IsElementNode( currentNode ) )
		{
			if( Is_COLLADA_NodeName( currentNode ) )		// COLLADA要素が見つかった場合
			{
				currentNode = currentNode->getFirstChild();		// 子ノードを処理する
				continue;
			}
			else if( Is_asset_NodeName( currentNode ) )	// asset要素が見つかった場合
			{
				_ASSERTE(elemAsset == NULL);		// 必ず1つ存在するのでこの時点ではNULL

				elemAsset = new AssetElement();
				elemAsset->ReadNode( currentNode );
			}
			else if( Is_library_NodeName( currentNode ) )	// library要素が見つかった場合
			{
				LibraryElement* elemLibrary = CreateLibraryElement( currentNode );
				if( elemLibrary != NULL )
				{
					elemLibrary->ReadNode( currentNode );
					vecElemLibrary.push_back( elemLibrary );
				}
			}
			else if( Is_scene_NodeName( currentNode ) )	// scene要素が見つかった場合
			{
				_ASSERTE(elemScene == NULL);		// 0または1つ存在するのでこの時点ではNULL

				elemScene = new SceneElement();
				elemScene->ReadNode( currentNode );
			}
		}

		currentNode = currentNode->getNextSibling();	// 次の要素を処理する
	}
}
コード例 #25
0
PortData
CADReader::emitsport (DOMElement* element)
throw(CADReadException)
{
	std::string element_name;
	PortData data;
	DOMNode* child = element->getFirstChild();
	while (child != 0)
	{
		if (child->getNodeType() == DOMNode::ELEMENT_NODE)
		{
			element_name = XMLString::transcode(child->getNodeName());

			//
			// emitsidentifier
			//
			if (element_name == "emitsidentifier")
			{
				data.name = emitsidentifier((DOMElement*)(child));
			}

			//
			// componentinstantiationref
			//
			else if (element_name == "componentinstantiationref")
			{
				data.ref.kind = COMPONENTID;
				data.ref.name = componentinstantiationref((DOMElement*)(child));
			}

			//
			// findby
			//
			else if (element_name == "findby")
			{
				data.ref = findby((DOMElement*)(child));
			}
		}

        // get next child
	    child = child->getNextSibling();
	}

	return data;
}
コード例 #26
0
ファイル: ConfigItem.cpp プロジェクト: lozpeng/applesales
SYSTEM::IConfigItemPtr SYSTEM::CConfigItem::GetFirstChild()
{
	DOMNode *FirstChild = ((DOMElement*)itemElement)->getFirstChild();
	if(FirstChild == NULL)
		return NULL;
	
	while(FirstChild != NULL && FirstChild->getNodeType() == DOMNode::TEXT_NODE)
		FirstChild = FirstChild->getNextSibling();

	if(FirstChild == NULL)
		return NULL;

	CConfigItem* item = new CConfigItem;
	item->itemElement = FirstChild;
	item->doc = doc;
	
	return IConfigItemPtr((IConfigItem*)item);
}
コード例 #27
0
ファイル: ConfigItem.cpp プロジェクト: lozpeng/applesales
SYSTEM::IConfigItemPtr SYSTEM::CConfigItem::GetPreviousSibling()
{
	DOMNode *sbliding = ((DOMElement*)itemElement)->getPreviousSibling();
	if(sbliding == NULL)
		return NULL;

	while(sbliding != NULL && sbliding->getNodeType() == DOMNode::TEXT_NODE)	
		sbliding = sbliding->getNextSibling();

	if(sbliding == NULL)
		return NULL;
	CConfigItem* item = new CConfigItem;
	item->itemElement =sbliding;
	item->doc = this->doc;

	return IConfigItemPtr((IConfigItem*)item);

}
コード例 #28
0
void printTypes(const char *label, const DOMNode *node, int indent = 0)
{
  if(indent == 0) std::cerr << "\n";

  if(node->getNodeType() == DOMNode::ELEMENT_NODE) {
    const XMLCh *typeURI, *typeName;
    XercesNodeImpl::typeUriAndName(node, typeURI, typeName);
    std::cerr << label << ":" << std::string(indent * 2, ' ')
              << "name: {" << UTF8(node->getNamespaceURI()) << "}" << UTF8(Axis::getLocalName(node))
              << ", type: {" << UTF8(typeURI) << "}" << UTF8(typeName) << "\n";

    DOMNode *child = node->getFirstChild();
    while(child) {
      printTypes(label, child, indent + 1);
      child = child->getNextSibling();
    }
  }
}
コード例 #29
0
ファイル: xslt_variable_impl.hpp プロジェクト: vietlq/arabica
  virtual XPathValue value(const DOMNode& node, 
                           ExecutionContext<string_type, string_adaptor>& context,
	                         DOMSink<string_type, string_adaptor>& sink) const
  {
    if(select_)
      return select_->evaluate(node, context.xpathContext());

    execute_children(node, context);

    if(sink.node() == 0)
      return StringValue::createValue(string_adaptor::empty_string());

    NodeSet nodeset;
    for(DOMNode n = sink.node().getFirstChild(); n != 0; n = n.getNextSibling())
      nodeset.push_back(n);

    return NodeSetValue::createValue(nodeset);
  } // value
コード例 #30
0
ファイル: DOMElementImpl.cpp プロジェクト: AmesianX/Sigil
// Returns the next logical sibling with respect to the given node.
DOMNode* DOMElementImpl::getNextLogicalSibling(const DOMNode* n) const
{
    DOMNode* next = n->getNextSibling();
    // If "n" has no following sibling and its parent is an entity reference node we
    // need to continue the search through the following siblings of the entity
    // reference as these are logically siblings of the given node.
    if (next == NULL) {
        DOMNode* parent = n->getParentNode();
        while (parent != NULL && parent->getNodeType() == DOMNode::ENTITY_REFERENCE_NODE) {
            next = parent->getNextSibling();
            if (next != NULL) {
                break;
            }
            parent = parent->getParentNode();
        }
    }
    return next;
}