DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Python (http://www.daniweb.com/forums/forum114.html)
-   -   Parsing xml file (http://www.daniweb.com/forums/thread30561.html)

Avner .H. Aug 15th, 2005 12:01 pm
Parsing xml file
 
Hello!
I need some help...

I parsed an xml file using the minidom.parse method, but when i
printed the document object to the screen (using toxml() function), i noticed that the parser automatically replaced my " (inverted commas) chars into ' chars.

for example :

<Father_Tag>
<Son_Tag title=' "Son" '>
This is an "example
</Son_Tag>
</Father_Tag>

turned out to be :

<Father_Tag>
<Son_Tag title=" &quot;Son&quot; ">
This is an &quot;example
</Son_Tag>
</Father_Tag>

as a result, the &quot; replaced the inverted commas (") that i added.
this shit really messes up my program!

can anyone help me?

bumsfeld Aug 17th, 2005 8:36 am
Re: Parsing xml file
 
What is a &quot supposed to mean? Are you sure you are using PHP?

vegaseat Aug 18th, 2005 3:51 pm
Re: Parsing xml file
 
I think Avner doesn't want his double quotes replaced by single quotes? I have seen this happen with Python before, but it didn't make any difference. Other languages ar not quite so forgiving. The &quot is an HTML/XML thing.

Avner .H. Aug 21st, 2005 4:27 am
Re: Parsing xml file
 
yea but actually it's the opposite, my single quotes are replaced by double quotes, and the double quotes remains the same, so i can't really use double quotes as part of a string...

vegaseat Aug 21st, 2005 3:39 pm
Re: Parsing xml file
 
What would happen if you wrote ' \"Son\" ' rather than ' "Son" ' ?


All times are GMT -4. The time now is 2:47 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC