0 votes

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;
    }
asked Jun 10 in Gossip by karismaup (22 points)

1 Answer

0 votes

it's not supported right now. Use json instead, its faster and has built in support.

answered Jul 12 by Dooowy. (216 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.