Code Monkey home page Code Monkey logo

adventures-of-maximus's People

Contributors

rpdevjesco avatar

Watchers

 avatar

adventures-of-maximus's Issues

Fix class structure

public class XMLData()
{
public void writeToXML()
{
string Path = Application.dataPath + "/Data/Leaderboard.xml";

    XmlDocument doc = new XmlDocument();

    if (!System.IO.File.Exists(Path))
    {
        XmlDeclaration declaration = doc.CreateXmlDeclaration("1.0", "UTF-8", "yes");
        XmlComment comment = doc.CreateComment("This is a generated XML File");
        XmlElement Leaderboard = doc.CreateElement("Leaderboard");
        XmlElement survivalTime = doc.CreateElement("SurvivalTime");

        survivalTime.InnerText = text.text;

        doc.AppendChild(declaration);
        doc.AppendChild(comment);
        doc.AppendChild(Leaderboard);

        Leaderboard.AppendChild(Leaderboard);

        Leaderboard.AppendChild(survivalTime);

        //Save document
        doc.Save(Path);
    }

    else //if file already exists
    {
        doc.Load(Path);

        // Get root element
        XmlElement root = doc.DocumentElement;

        XmlElement survivalTime = doc.CreateElement("SurvivalTime");

        //Values to the nodes
        survivalTime.InnerText = text.text;


        //Document Construction
        doc.AppendChild(root);

        // Append root element to word element
        root.AppendChild(survivalTime);

        //Append written values to word as child element

        //Save the document
        doc.Save(Path);
    }
}

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.