![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | karismaup |
Trying to read the entire xml document and convert it to an Array
Please let me know how to do it.
<?xml version="1.0" encoding="UTF-8"?>
<index >
<node sceneURL="scene"></node>
<node sceneURL="scene"></node>
<node sceneURL="scene"></node>
<node sceneURL="scene"></node>
</index>
private XMLParser parser;
private String xmlpath = "res://Xml/resources.xml";
private File file = new File();
public override void _Ready()
{
XMLloader ( xmlpath );
}
public void XMLloader( String _xmlPath )
{
parser = new XMLParser();
if( fileChecker( _xmlPath ) )
{
parser.Open( _xmlPath );
if( parser.Read().ToString() == "Ok" )
{
//GD.Print( parser.GetPropertyList().Count );
//GD.Print( parser.GetNodeName("index"));
//GD.Print( parser.GetAttributeCount() );
GD.Print("<" + parser.GetNodeName() +">");
parser.SkipSection();
// I want to output all items in xml....
// how to do something???
};
};
}
public Boolean fileChecker( String filepath )
{
return ( file.FileExists( filepath ) == true ) ? true : false;
}