2011-07-29 9 views
1

tinyxmlで行ったすべての例で、Internet Explorerで表示できるxmlファイルが作成されました。プログラムで作成されたtinyxml xmlファイルがInternet Explorerでロードされていません

しかし、プログラムで作成した鉱山では、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> 

答えて

4

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の作成方法はこちらをご覧ください。