xml question

xkenneth xkenneth at gmail.com
Wed Sep 12 15:52:40 EDT 2007


There are built in tools for the DOM in Python. Also I'm using OSX to
do XML parsing but I'm using the tools available from 4suite.

On Sep 12, 2:21 pm, JYOUN... at kc.rr.com wrote:
> Just curious if there's any python xml parsing tools built into the Mac (OS 10.4.10 Tiger)?  If so,
> could anyone
> share some simple code (or maybe point me to a web-site) of how to parse xml data from a
> file?  For example,  if I
> had a file that contained this:
>
>                 <colors>
>                         <color base="DeviceGray" />
>                         <color alt="DeviceCMYK" base="Separation">Black</color>
>                         <color alt="Lab" base="Separation">Light Blue</color>
>                         <color alt="ICCBased" base="Separation">Green</color>
>                 </colors>
>
> I'd want to look in the 'colors' xml element, then look at each 'color' xml element inside and
> pull any that have
> values (which would be Black, Light Blue and Green).  I'd like to know how to pull 'attributes'
> too.
>
> Thanks very much for your help.
>
> Jay





More information about the Python-list mailing list