Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10381 > unrolled thread

can I use element tree for handling special characters in xml text?

Started byhackingKK <hackingkk@gmail.com>
First post2011-07-27 16:46 +0530
Last post2011-07-28 01:02 +0200
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  can I use element tree for handling special characters in xml text? hackingKK <hackingkk@gmail.com> - 2011-07-27 16:46 +0530
    Re: can I use element tree for handling special characters in xml text? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-07-28 01:02 +0200

#10381 — can I use element tree for handling special characters in xml text?

FromhackingKK <hackingkk@gmail.com>
Date2011-07-27 16:46 +0530
Subjectcan I use element tree for handling special characters in xml text?
Message-ID<mailman.1533.1311765406.1164.python-list@python.org>
Hello all.
I have been waiting a lot to ask this question and I did ask some days 
back but probably could not put it the proper way.
I want to know how I can safely include special characters like & or > 
in xml text?
For example I store a small xml file containing list of organisations.
Many   names have an "&"  in the name as in brian & turner.
so the xml noad will be <orgname> brian & turner </orgname>
But I know this won't work directly.
my code naturally fails when I try to insert such data.
Can any one suggest the right way of parsing this kind  of strings and 
treat & like characters as part of the literal string?
Hope my question is clear this time.
Happy hacking.
Krishnakant.

[toc] | [next] | [standalone]


#10407

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2011-07-28 01:02 +0200
Message-ID<3550521.pXjxEX62BZ@PointedEars.de>
In reply to#10381
hackingKK wrote:

> I have been waiting a lot to ask this question and I did ask some days
> back but probably could not put it the proper way.

You still can't.  <http://www.catb.org/~esr/faqs/smart-questions.html>

But to spare everyone yet another try:

> I want to know how I can safely include special characters like & or >
> in xml text?

(I don't know what you want to know, so don't ask me that.)

You need CDATA sections for this.  That is not a Python problem.

You should get a real name.

-- 
PointedEars

Bitte keine Kopien per E-Mail. / Please do not Cc: me.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web