RSS Forums RSS

Parsing xml file

Please support our Python advertiser: Programming Forums
Reply
Posts: 18
Reputation: Avner .H. is an unknown quantity at this point 
Solved Threads: 0
Avner .H. Avner .H. is offline Offline
Newbie Poster

Help Parsing xml file

  #1  
Aug 15th, 2005
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?
AddThis Social Bookmark Button
Reply With Quote  
Posts: 1,066
Reputation: bumsfeld is an unknown quantity at this point 
Solved Threads: 47
bumsfeld's Avatar
bumsfeld bumsfeld is offline Offline
Veteran Poster

Help Re: Parsing xml file

  #2  
Aug 17th, 2005
What is a &quot supposed to mean? Are you sure you are using PHP?
Reply With Quote  
Posts: 2,947
Reputation: vegaseat is a jewel in the rough vegaseat is a jewel in the rough vegaseat is a jewel in the rough 
Solved Threads: 254
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Solution Re: Parsing xml file

  #3  
Aug 18th, 2005
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.
May 'the Google' be with you!
Reply With Quote  
Posts: 18
Reputation: Avner .H. is an unknown quantity at this point 
Solved Threads: 0
Avner .H. Avner .H. is offline Offline
Newbie Poster

Re: Parsing xml file

  #4  
Aug 21st, 2005
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...
Reply With Quote  
Posts: 2,947
Reputation: vegaseat is a jewel in the rough vegaseat is a jewel in the rough vegaseat is a jewel in the rough 
Solved Threads: 254
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Solution Re: Parsing xml file

  #5  
Aug 21st, 2005
What would happen if you wrote ' \"Son\" ' rather than ' "Son" ' ?
May 'the Google' be with you!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Views: 6553 | Replies: 4 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 12:41 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC