Exemple #1
0
	// Returns a list of parameter names and nodes held by a given XML node
	void FindParameters(xmlNode* parent, StringList& parameterNames, xmlNodeList& parameterNodes)
	{
		if (parent == NULL || parameterNames.size() != parameterNodes.size()) return;

		size_t originalCount = parameterNodes.size();
		for (xmlNode* child = parent->children; child != NULL; child = child->next)
		{
			if (child->type != XML_ELEMENT_NODE) continue;

			// Drop the technique and exta elements that may be found
			if (IsEquivalent(child->name, DAE_TECHNIQUE_ELEMENT) ||
				IsEquivalent(child->name, DAE_EXTRA_ELEMENT)) continue;

			// Buffer this parameter node
			parameterNodes.push_back(child);
		}

		// Retrieve all the parameter's names
		size_t parameterNodeCount = parameterNodes.size();
		parameterNames.resize(parameterNodeCount);
		for (size_t i = originalCount; i < parameterNodeCount; ++i)
		{
			xmlNode* node = parameterNodes[i];
			parameterNames[i] = (const char*) node->name;
		}
	}
Exemple #2
0
	// Retrieves all the child nodes of a given type
	void FindChildrenByType(xmlNode* parent, const char* type, xmlNodeList& nodes)
	{
		if (parent != NULL)
		{
			for (xmlNode* child = parent->children; child != NULL; child = child->next)
			{
				if (child->type == XML_ELEMENT_NODE)
				{
					if (IsEquivalent(child->name, type)) nodes.push_back(child);
				} 
			}
		}
	}
Exemple #3
0
	// Retrieves all the child nodes of a given type
	void FindChildrenByType(xmlNode* parent, const char* type, xmlNodeList& nodes, bool bdbg)
	{
	    if(bdbg)
	    {
	    	printf( "FindChildrenByType par<%p> typ<%s>\n", parent, type );
	    }
		if (parent != NULL)
		{
			for (xmlNode* child = parent->children; child != NULL; child = child->next)
			{
				if(bdbg)
					printf( "   child<%s>\n", child->name );
				if (child->type == XML_ELEMENT_NODE)
				{
					if (IsEquivalent(child->name, type))
						nodes.push_back(child);
				} 
			}
		}
	}