Menu

TinXML Easy Wrapper

Developer
Anonymous
2007-07-08
2013-05-20
  • Anonymous

    Anonymous - 2007-07-08

    I wrote a wrapper around TinyXML that's a lot easier to code. Instead of using trees of code to find your elements & attributes its more like:

    CXSDXmlFile XmlFile;
    XmlFile.Open("file.xml");

    string strValue = GetElementAttribute("ROOTELEMENT\\MYELEMENT", 0 /*Index*/);

    XmlFile.Close();

    It's easier and faster to write out. Only one downside that hardly effects me much is that root elements specified in the path there are always goign to be the first ones if there are other elements with the same name. The target element u can pick a duplicate index.

     
    • Lee Thomason

      Lee Thomason - 2007-07-09

      Good stuff - but in the interest of code re-use, have you considered TinyXPath? It looks like a similar approach.

      http://tinyxpath.sourceforge.net/

      lee

       
    • Anonymous

      Anonymous - 2007-07-10

      I'll take a look, I think I saw a link to it somewhere on one of these pages and it was broken.

       
    • Anonymous

      Anonymous - 2007-07-10

      I'm sticking with what I created. XSDXmlFile is even simpler than TinyXPath. For all my apps I need fast quick easy access.

      I found it a lil tough to find example C++ code for TinyXPath on their website. From what I see you have to select nodes. With my class its more simple to access any element attribute or text in only one line of code.

      I'm not sure if anyone is interested. I could rewrite it a bit so that it can be standalone, it's as simple as stripping my library specific stuff.

       
      • Ellers

        Ellers - 2007-07-10

        I think that would be great :)
        Ellers

         
    • Anonymous

      Anonymous - 2007-07-11

      http://x3source.com/downloads/XmlFile.zip

      The code should be simplistic to understand. I'm using it for project files, configuration files, even for the index and file information for my archiving. I am also considering writing a memory version (XmlMemory) to handle my archive format so I dont have to extract the xml into a text file. Shouldn't be hard to do now with this existing code.

      Let me know what u guys think.

       
      • Ellers

        Ellers - 2007-07-15

        You mentioned:
        "I am also considering writing a memory version (XmlMemory) to handle my archive format so I dont have to extract the xml into a text file."

        I'm not clear what you mean here... you can parse a string in memory already.

        ?

        Ellers

         
    • Anonymous

      Anonymous - 2007-07-11
       
    • Anonymous

      Anonymous - 2007-07-29

      Yes I know, but I was referring to my wrapper not TinyXML in itself. My wrapper handles files not strings.

       

Log in to post a comment.