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


Groups > comp.lang.python > #10381

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

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <hackingkk@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.030
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'subject:xml': 0.07; 'naturally': 0.09; 'parsing': 0.09; 'subject:characters': 0.09; 'text?': 0.09; '"&"': 0.16; 'subject:handling': 0.16; 'turner': 0.16; 'subject:use': 0.16; 'suggest': 0.17; 'insert': 0.19; 'literal': 0.23; 'code': 0.24; 'xml': 0.25; 'example': 0.30; 'subject:?': 0.31; "won't": 0.32; 'list': 0.32; 'message- id:@gmail.com': 0.32; 'brian': 0.33; 'to:addr:python-list': 0.34; 'header:User-Agent:1': 0.34; 'characters': 0.34; 'all.': 0.35; 'safely': 0.35; 'probably': 0.35; 'question': 0.35; 'subject:text': 0.35; 'file': 0.36; 'data.': 0.36; 'some': 0.37; 'but': 0.37; 'could': 0.37; 'received:google.com': 0.38; 'subject:can': 0.38; 'received:209.85': 0.38; 'put': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'did': 0.40; 'hope': 0.60; 'kind': 0.60; 'waiting': 0.62; 'back': 0.63; 'special': 0.67; 'subject:tree': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=Mr3Fujo9FyW2VhdW2Y3lJVCOXm8ohr3kw1y8amDLfKs=; b=KRv30FTnZpNWbyMeF9goNfVQaTqKOGdbdiavdw3CZoweYYQYeagWpb0ZbdPFcKF4mE Pnm9ylcNT4S6vW+HFPpZc3F6mEBiOXn4tYXOcPkYoaFZGBCa8h5GJ5cqZfIBANsEDYzB iwwLgwFm8edtMAQEP0LAcLgSUt3XSB+KqC1n8=
Date Wed, 27 Jul 2011 16:46:31 +0530
From hackingKK <hackingkk@gmail.com>
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10
MIME-Version 1.0
To python-list@python.org
Subject can I use element tree for handling special characters in xml text?
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1533.1311765406.1164.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1311765406 news.xs4all.nl 23951 [2001:888:2000:d::a6]:48123
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:10381

Show key headers only | View raw


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.

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

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

csiph-web