Seems like my message wasn't sent. :-)

This should be solved in the revision #4826.

2012/6/14 Ru Vuott <vu...@yahoo.it>

> Hello Benoit,
>
> an user of Gambas-it.org Community ask me to write to you about a possible
> error with XmlWriter tag in gb.xml.
>
> He says that he found a problem, linked to the library gb.xml, especially
> with XMLWriter (but there is probably something with XMLReader).
> Example, he has to write an xml file, with a series of nested tags, where
> most of the elements have a single value (Text), such as:
>
> <Tags>
> <Tag1>valore</Tag1>
> <Tag2>valore</Tag2>
> </Tags>
>
> As can be seen, Tag1 and Tag2 have a value, and this is enclosed between
> the opening of the tag "<Tag1>", and its closure "/ Tag1>".
> Up to now he believes the logic is straightforward, and he says that this
> has so far been adopted in all its applications, including pgDesigner (xml
> file that reads a lot).
>
> After downloading the latest version of Gambas3 in source code form, now
> is the 4827, he found that the reading is something wrong (still unclear),
> while the writing has an error, that he has encountered in the source class
> XmlWriter.class, of which he brings the party to the problem:
>
> Public Sub StartElement(TagName As String, Optional Attributes As
> String[], Optional Prefix As String, Optional URI As String)
>
>  Dim Xmlns, s, sData As String
>  Dim i As Integer = 0
>  If URI Then
>    Xmlns = " xmlns"
>    If Prefix Then Xmlns &= ":" & Prefix
>    Xmlns &= "=\"" & URI & "\""
>  Endif
>  If Prefix Then TagName = Prefix & ":" & TagName
>
>  sData = "<" & TagName
>
>  If Attributes
>    If (Attributes.Count Mod 2) Then Attributes.Push("")
>    For i = 0 To Attributes.Max Step 2
>      sData &= " " & Attributes[i] & "=\"" & Attributes[i + 1] & "\""
>    Next
>  Endif
>
>  sData &= Xmlns
>
>  If Not $TagEnded Then 'On ferme le tag précédent
>    Write(">" & If($indent, "\n", ""), True)
>  Endif
>
>  $TagEnded = False
>
>  Write(sData)
>
>  PileElements.Push(TagName)
>
> End
>
> Public Sub EndElement()
>
>  Dim tag As String
>
>  If Not PileElements.Count Then Return
>
>  tag = PileElements.Pop()
>
>  If Not $TagEnded Then 'On ferme le tag précédent
>    Write(" />" & If($indent, "\n", ""), True) 'Pas de contenu
>    $TagEnded = True
>  Else
>    Write("</" & tag & ">")
>  Endif
>
> End
>
>
> The user says that the code applies faulty logic, or at least partly by an
> assumption is not entirely correct. The tag is opened and closed by the
> state of the variable $ TagEnded, not taking into account that there may be
> a text value in the middle. This causes the incorrect writing of tags, as
> seen below:
>
> <Tag1valore />
> <Tag2valore />
>
> it combines the name of the tag with the value itself.
> The sequence in which the tag is opened and closed, and associated with
> this value is as an example:
>
> DIM oXml As XmlWriter
> ...
> oXml.StartElement("Tag1")
> oXml.Text("valore")
> oXml.EndElement()
>
>
> With version 3.1.1 it worked, but now our friend user says that with the
> latest updates do not go anymore. I do not know if the 3.1.1, the later
> builds contain all the same problem, but certainly the 4827.
>
>
> Well, this is what he wrote and asked me to tell you. I'll communicate to
> him your answer to this.
>
> Bye
> Vuotttttt
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to