Menu

How to get XML of a node?

Developer
1234
2007-08-10
2013-05-20
  • 1234

    1234 - 2007-08-10

    How to get XML of a node? There is a method Print, which gives me formatted xml, but I need to pass FILE pointer to Print. I want to get the xml in string and don't want file operations. Is there any way to achive this?

     
    • Nicola Civran

      Nicola Civran - 2007-08-10

      Use the << operator or a TiXmlPrinter object.

       
    • 1234

      1234 - 2007-08-29

      Thanks for reply!

      I used TiXmlPrinter object and it worked fine with node. But if I want to get xml of Attribute, I cannot use TiXmlPrinter object as Accept method is not there in TiXmlAttribute class. Please let me know if there is any solution for this?

       
      • Nicola Civran

        Nicola Civran - 2007-08-29

        I am not sure to understand what do you mean by "get xml of attribute", but if I guess correctly you may just derive your own Printer class from TiXMLPrinter redefining the VisitEnter(const TiXmlElement&, const TiXmlAttribute*) method (and perhaps the VisitExit one as well).

         

Log in to post a comment.