943,671 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 8284
  • Python RSS
Aug 15th, 2005
0

Parsing xml file

Expand Post »
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?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Avner .H. is offline Offline
18 posts
since Aug 2005
Aug 17th, 2005
0

Re: Parsing xml file

What is a &quot supposed to mean? Are you sure you are using PHP?
Reputation Points: 404
Solved Threads: 180
Nearly a Posting Virtuoso
bumsfeld is offline Offline
1,422 posts
since Jul 2005
Aug 18th, 2005
0

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.
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004
Aug 21st, 2005
0

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...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Avner .H. is offline Offline
18 posts
since Aug 2005
Aug 21st, 2005
0

Re: Parsing xml file

What would happen if you wrote ' \"Son\" ' rather than ' "Son" ' ?
Moderator
Reputation Points: 1333
Solved Threads: 1403
DaniWeb's Hypocrite
vegaseat is offline Offline
5,792 posts
since Oct 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: A Pythonian Look at the Family Tree Conundrum
Next Thread in Python Forum Timeline: need help comparing bits





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC