[Gambas-user] Edit XML

Mauricio Baeza mauricio at ...2500...
Sun Nov 21 06:23:39 CET 2010


El sáb, 20-11-2010 a las 13:54 +0100, Caveat escribió:

> Hi Mauricio
> 
> Sorry for the late reply, I was doing a lot of thinking. :-)
> 
> Perhaps you might like something along these lines:
> 
> XMLRewriter is a class in a little project I've been working on.  The
> idea of XMLRewriter is that it should be capable of parsing any XML
> input and applying edits to it to create a new output XML.  The
> XMLRewriter class itself does not need to know anything about the XML
> it's being fed, as it automagically builds an internal data model of the
> provided XML. :-D
> 
> Let me know if you're interested in taking this further, perhaps we can
> go off-list to get into the details.
> 
> Regards,
> Caveat
> 
> On Mon, 2010-11-15 at 22:58 -0600, Mauricio Baeza wrote:
> 
> > Hi all ...
> > 
> > With the library for XML I can, without problems ...
> > 1 .- Create new XML file
> > 2 .- Read any XML file
> > 
> > What I can not do is change just one attribute of an element of an
> > existing file. Does anyone have a sample?
> > 
> > Greetings
> > 
> > 
> > 
> 



Hello ...

Thanks for the reply ...

I really just want to know how to edit an attribute of an element.
Currently I have solved simply not adding the attribute to first create
the XML. Then add it as follows:

DIM oDocXMLTmp AS NEW XmlDocument
DIM sTmp AS String

    oDocXMLTmp.FromString(docXML)
    oDocXMLTmp.Root.NewAttribute("sello", Sello)
    sTmp = oDocXMLTmp.ToString()

But the stamp is the final attribute. To be in the order I want, I need
to add it to create the XML and then edit. Which I could not. If only
you could help me with this, much will thank you.

Best regards


-- 
Mauricio Baeza

10 años usando OpenOffice.org, libre, gratuito y seguro
_______________________________
Todo lo que no es dado es perdido



More information about the User mailing list