[Gambas-user] gb.xml "unSerialize"

Bruce bbruen at ...2308...
Sat Oct 19 20:15:57 CEST 2013


On Sat, 2013-10-19 at 17:30 +0200, Fabien Bodard wrote:
> Le 19 oct. 2013 17:07, "Adrien Prokopowicz" <adrien.prokopowicz at ...626...>
> a écrit :
> >
> > Le Sat, 19 Oct 2013 16:06:33 +0200, Benoît Minisini
> > <gambas at ...1...> a écrit:
> >
> > > Le 19/10/2013 15:56, Adrien Prokopowicz a écrit :
> > >> I just added the new static method XMLNode.Deserialize() in revision
> > >> #5906
> > >> for this purpose. For example,
> > >>
> > >> Print XMLNode.Deserialize("Select * From mytable Where id < 10")
> > >>
> > >> Will print : Select * From mytable Where id < 10
> > >>
> > >> Caveat : If you use the FromText() method, you don't actually need to
> > >> put
> > >> your text in any element. Text nodes are nodes too. :)
> > >>
> > >> Just be careful not to give an empty string, otherwise FromText() will
> > >> give you back an empty array, and accessing myNoddies[0] will raise an
> > >> "Out of bounds" error !
> > >>
> > >> Fabien : the "short way" of doing this would actually be :
> > >>
> > >> Print XMLElement.FromText("text")[0].TextContent (again, while ensuring
> > >> that the given text is not empty).
> > >> FromText() returns an array of nodes. :)
> 
> Sometime there is need to interpret what I wanna say
> 
> I'm a poet ;-)
> 
> > >>
> > >>
> > >> Regards,
> > >>
> > >
> > > Shouldn't you use "Contents" instead of "Content". My dictionnary tells
> > > me that both are correct, but I have always seen the plural form.
> > >
> >
> > I have seen both, but the singular form seems to be used too (like in the
> > Content-Type HTTP header). This is also the form used in the DOM
> > specification (see
> >
> http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Node3-textContent
> > ), so that's why I used "Content".
> 
> > --
> > Adrien Prokopowicz
> >

First, thanks all for the replies.

        re: Content v Contents
        
        I think (not that Australian is the definitive interpretation of
        the English  language) that it depends on the explicit usage. 
                "The content of this box is dangerous" refers to the
                entire contents of the box as a single entity.
                "The contents of this box are dangerous" refers to each
                and every item contained in the box.
        (if that makes it any clearer??)

Now my problem, that I should have made clearer in the first place, is
that the SQL string is an attribute of the node.

<task name="Update diary", sql="UPDATE blah SET ... FROM blahblah WHERE
date<current_date;" />

I have no problem writing the xml out.
  wkXMLtask.NewAttribute("sql",sSQL)
converts any internal >'s and <'s to < and > automagically.
However, 
  sSQL=wkXMLtask.GetAttribute("sql") 
leaves the XML encoded characters as they are.

Bruce

<






More information about the User mailing list