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>

    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() +">");

                // I want to output all items in xml....
                // how to do something???

    public Boolean fileChecker( String filepath )
        return ( file.FileExists( filepath ) == true ) ? true : false;
in Engine by (27 points)

1 Answer

–1 vote

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

by (202 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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.