Empty string-vars in XML

Q&A's, tips, howto's
Locked
HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Empty string-vars in XML

Post 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" "")))
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post 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>
Hans-Peter

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post 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 />
Hans-Peter

eddier
Posts: 289
Joined: Mon Oct 07, 2002 2:48 pm
Location: Blue Mountain College, MS US

Post 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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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

Locked