作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我为 tinyxml 遵循的所有示例都生成了我能够在 Internet Explorer 中查看的 xml 文件。
但是,当我以编程方式创建我的时,IE 中没有任何显示。不过,我可以确认 xml 文件包含我期望的所有内容。
这是创建 xml 的代码:
bool InputIO::saveDevice( const std::string & fileName, const InputDevice& device ) const
{
TiXmlDocument doc;
TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" );
doc.LinkEndChild( decl );
TiXmlElement* root = new TiXmlElement("Input Devices");
doc.LinkEndChild(root);
TiXmlElement* dev = new TiXmlElement("Device");
root->LinkEndChild(dev);
dev->SetAttribute("number",1);
for(int p = 0; p < 2; ++p)
{
for(int i = 0; i < NUM_KEYS; ++i)
{
//Primary configuration when p is 0
InputKey key = device.getKey(InputEvent::Uniform_inputEnum(i),p == 0);
TiXmlElement* button = new TiXmlElement("button");
dev->LinkEndChild(button);
button->SetAttribute("configuration",p);
button->SetAttribute("number",i);
button->SetAttribute("input type",key.inputType);
button->SetAttribute("key code",key.keyCode);
button->SetAttribute("joy axis",key.axis);
button->SetAttribute("joy button",key.button);
button->SetAttribute("joy stick",key.stick);
if(key.positiveAxis)
{
button->SetAttribute("axis direction","positive");
}
else
{
button->SetAttribute("axis direction","negative");
}
}
}
doc.SaveFile(fileName.c_str());
return true;
}
这是生成的 xml
<?xml version="1.0" ?>
<Input Devices>
<Device number="1">
<button configuration="0" number="0" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="1" input type="1" key code="216" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="2" input type="1" key code="84" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="3" input type="1" key code="85" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="4" input type="1" key code="82" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="5" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="6" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="7" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="8" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="9" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="10" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="11" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="12" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="13" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="14" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="15" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="16" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="17" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="18" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="19" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="0" number="20" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="0" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="1" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="2" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="3" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="4" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="5" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="6" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="7" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="8" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="9" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="10" input type="1" key code="83" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="11" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="12" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="13" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="14" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="15" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="16" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="17" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="18" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="19" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
<button configuration="1" number="20" input type="0" key code="0" joy axis="0" joy button="0" joy stick="0" axis direction="positive" />
</Device>
</Input Devices>
最佳答案
W3 XML Validator程序告诉我们有关您的 XML 的信息:
XML Parsing Error: not well-formed
Location: http://www.w3schools.com/xml/xml_validator.asp
Line Number 2, Column 15: <Input Devices>
--------------^
最后,您终止了输入设备,但空格是错误的。在那之后,您的 XML 会遇到更多问题。在这里查看如何制作您的 XML well-formed .
关于c++ - 以编程方式创建的 tinyxml xml 文件未在 Internet Explorer 中加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6876349/
我正在开发一个需要能够平均三个数字的 Facebook 应用程序。但是,它总是返回 0 作为答案。这是我的代码: $y = 100; $n = 250; $m = 300; $number = ($y
我只是无法弄清楚这一点,也找不到任何对我来说有意义的类似问题。我的问题:我从数据库中提取记录,并在我的网页上以每个面板 12 条的倍数显示它们。因此,我需要知道有多少个面板可以使用 JavaScrip
我是一名优秀的程序员,十分优秀!