in reply to Re: Add New Attribute to XML
in thread Add New Attribute to XML

I am wondering if there is any other way to do this either by use XML::XPath or XML::XPath::Xparser???

Replies are listed 'Best First'.
Re^3: Add New Attribute to XML
by Corion (Patriarch) on Jun 22, 2009 at 08:18 UTC

    Looking at the Source of XML::XPath::Node, there is the insertAfter method for nodes, which you can use to append other nodes after an existing node. But it doesn't seem like XML::XPath is geared towards XML manipulation. You're likely better off using one of the other XML modules. Potentially, XML::LibXML is geared towards both, XPath and DOM manipulation.

      Can you suggest me some basic tutorial about XML::LibXML!!! Cheers!

        I'm under the impression that XML::LibXML mostly follows the W3C DOM API, so I assume that most of the documentation for the W3C DOM API applies to XML::LibXML. I'm not aware of any tutorials geared towards XML::LibXML specifically. The XML module that has the best documentation is XML::Twig.

      Could any one suggest me how can i use XML::LibXML to achieve my target? as in above code i am trying to check if the attribute exists in hash, if not add new attribute!!! any suggestion!!! Cheers
Re^3: Add New Attribute to XML
by Anonymous Monk on Jun 22, 2009 at 07:50 UTC
    Probably, but I can't help you with that, I don't use either :)