salimoha / googlecl

Automatically exported from code.google.com/p/googlecl
0 stars 0 forks source link

Duplicated xml declaration in "contacts list xml" #218

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. google contacts list xml
2.
3.

What is the expected output? What do you see instead?
Only one xml declaration should be present:
<?xml version='1.0' encoding='UTF-8'?>
<ns0:entry...>...</ns0:entry>
<ns0:entry...>...</ns0:entry>
<ns0:entry...>...</ns0:entry>

Instead, xml declarations are duplicated after each entry:
<?xml version='1.0' encoding='UTF-8'?>
<ns0:entry...>...</ns0:entry>
<?xml version='1.0' encoding='UTF-8'?>
<ns0:entry...>...</ns0:entry>
<?xml version='1.0' encoding='UTF-8'?>
<ns0:entry...>...</ns0:entry>

That is not a valid XML document.

What version of the product are you using? On what operating system? What
version of gdata-python-client (aka python-gdata)?
googlecl 0.9.8-1
python-gdata 1.2.4-0ubuntu2
Ubuntu 10.04

Please provide any additional information below.

Original issue reported on code.google.com by kamil.paral on 9 Jul 2010 at 9:20

GoogleCodeExporter commented 9 years ago
The intent wasn't to create a valid xml document, but that would be a useful 
feature.

Original comment by tom.h.mi...@gmail.com on 20 Jul 2010 at 8:25

GoogleCodeExporter commented 9 years ago
Hah. If the intent is not to create a valid xml document, why would you include 
the xml declaration line at all? And by the way, why would you call the option 
"list xml", when you don't intent to dump xml document? Because xml document 
has only some meaning when it is valid, that means in can be machine-processed. 
Ivalid xml is just garbage, because you can't use it with other tools.

Sorry, this is not an enhancement. I understand you try to filter your bugs for 
defects as much as possible, but this was a false hit. Invalid xml is not xml, 
period.

Original comment by kamil.paral on 20 Jul 2010 at 8:42

GoogleCodeExporter commented 9 years ago
The code literally walks through the feed (rather, the list of entries built by 
Python) and calls str() on each entry. The xml declaration line just happens to 
be a part of that for some reason.

I found myself wanting to manually look at the xml data of select entries I got 
from the servers and thought others might want to do the same, so I included 
this as "xml" rather than "invalid_xml_document", since the former is much 
easier to type :)

The data is certainly more valuable when it's machine-parsable, even though the 
original intent was to dump data for manual inspection, hence the accepted 
status as an enhancement.

Original comment by tom.h.mi...@gmail.com on 20 Jul 2010 at 9:06

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I made a small script that creates a valid Atom feed. Note that it adds a root 
element, because multiple entry-elements at root level would also be invalid 
xml.

#!/bin/sh
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
echo "<frame:feed xmlns:frame=\"http://www.w3.org/2005/Atom\">"
google contacts list xml | egrep -v "^<\?.*\?>$"
echo "</frame:feed>"

Original comment by MentalFS on 1 Mar 2011 at 1:02