本文整理汇总了C++中XmlDocument::Load方法的典型用法代码示例。如果您正苦于以下问题:C++ XmlDocument::Load方法的具体用法?C++ XmlDocument::Load怎么用?C++ XmlDocument::Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlDocument
的用法示例。
在下文中一共展示了XmlDocument::Load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadXml
void Animation::ReadXml(const char* filename)
{
m_animationParts.clear(); // clear our parts list first
// create a new xml document
XmlDocument doc;
doc.Load(filename);
TiXmlHandle * hdoc = doc.Handle();
TiXmlElement * root = hdoc->FirstChildElement().Element();
if(root != 0)
{
TiXmlElement * child = root->FirstChildElement();
// loop through children
while(child)
{
// whats the name of this part
string partName = (string)child->Value();
// add this part to the part map
m_animationParts[partName] = new AnimationPart(child);
// move to the next game object
child = child->NextSiblingElement();
}
}
}
示例2: Initialise
void MaterialManager::Initialise(char *materialXMLFile)
{
// read through the xml file and load all materials
XmlDocument doc;
doc.Load(materialXMLFile);
TiXmlHandle * hdoc = doc.Handle();
TiXmlElement * root = hdoc->FirstChildElement().Element();
TiXmlElement * child = root->FirstChildElement();
// loop through our materials
while(child)
{
// get the name of the material
const char * matName = XmlUtilities::ReadAttributeAsString(child, "", "name");
// create the new material
Material* mat = new Material(matName);
mat->ReadXml(child); // read the properties
m_materialMap[matName] = mat; // add to the material map
// move to the next material
child = child->NextSiblingElement();
}
}
示例3: LoadAllBlockTypeInfo
void LoadAllBlockTypeInfo()
{
XmlDocument blockXML;
blockXML.Load("blocks.xml");
for (unsigned int i = 0; i < blockXML.DocumentElement->SubElements.count(); i++)
{
XmlElement *typeElem = blockXML.DocumentElement->SubElements[i];
TypeInfo *typeInfo = new TypeInfo();
typeInfo->Name = typeElem->getNode("Name")->Text;
typeInfo->ID = typeElem->getNode("ID")->Text.toInt();
typeInfo->Destructability = typeElem->getNode("Destructability")->Text.toInt();
typeInfo->TheTexture = new Texture();
typeInfo->TheTexture->ImgFile = new File(typeElem->getNode("Filename")->Text);
LoadedTypeInfo.Add(typeInfo);
}
Log::Msg("Successfully loaded all block type info.", Log::Info);
}