Page 1 of 1

Empty string-vars in XML

Posted: Tue Apr 05, 2005 2:23 pm
by HPW
When I exchange lisp-data with XML I get such an stripped down XML:

Code: Select all

    <Group1>
      <VAR1>Test</VAR1>
      <VAR2></VAR2>
    </Group1>
When I want it back to lisp I do:

(xml-type-tags nil nil nil nil)
(xml-parse (read-file "myXml.xml")(+ 1 2 4))

I get:

Code: Select all

 ("Group1"
   ("VAR1" "Test")
   ("VAR2")))
Is there any other way to get:

Code: Select all

 ("Group1"
   ("VAR1" "Test")
   ("VAR2" "")))

Posted: Tue Apr 05, 2005 3:10 pm
by Lutz
This is a bug, wihtout the option number 1 it should show an empty string. This will be fixed in 8.5.0 due by the end of this week.

Lutz

Posted: Tue Apr 05, 2005 3:51 pm
by Lutz
After thinking more about it I believe, that putting "" not be legal XML/SXML translation. I don't think that an an empty tag implies that this is "empty" whilespace, but I am not quite sure. I will research this when back home in Florida.

Lutz

Posted: Tue Apr 05, 2005 7:13 pm
by HPW
>I don't think that an an empty tag implies that this is "empty" whitespace

When this is the case then I have to provide another loop to go through my reimported assoc-lists and fill the missing empty parameters in as a string. Not a big problem. Was only a question after the best way to do it.
I want to get back the list as it was before the converting to XML.
2 way interfacing without any loss.

Ot is there a different way to represent an empty string in XML:

<VAR2>EmptyStringPlaceholder</VAR2>

Posted: Wed Apr 06, 2005 7:24 am
by HPW
An observation:

A emty XML tag in the source like this:

Code: Select all

<VAR2></VAR2>
Shows in IE:

Code: Select all

<VAR2 />

Posted: Wed Apr 06, 2005 1:01 pm
by eddier
I know html is not xml but I have used

Code: Select all

<td>&nbsp;</td>
to make tables appear correctly in the past. maybe something like

Code: Select all

<Var2>&empty;</Var2>
.

Eddie

Posted: Wed Apr 06, 2005 4:09 pm
by Lutz
You always can put a space in there and leeave out the 1 in the options:

Code: Select all

(xml-type-tags nil nil nil nil)

(xml-parse "<var> </var>" (+ 2 4 8)) => ((var " "))
Lutz

ps: travelling back to FL today, so this is probably the last time I am on here today