leforestier/yattag

Can I use yattag to modify XML files?

rn4n opened this issue · 2 comments

rn4n commented

Consider this XML:

<?xml version="1.0" encoding="utf-8"?>
<tests>
    <test name="foo">
        <result>result-foo</result>
    </test>
    <test name="bar">
        <result>result-foo</result>
    </test>
</tests>

Is possible to use yattag to load this XML and change the content from a specific node with name attribute?

Hi,

no, yattag is just a fast way of producing xml strings, but it doesn't keep all the nodes of a document in memory. There is no way to load a XML document with yattag and modify it.
For what you're trying to do, I'd use pyquery, I find it very easy to use: https://pythonhosted.org/pyquery/ .

rn4n commented

@leforestier I'll try it, cheers.