[XML-SIG] xmlpickle.py ?!

Mike Olson Mike.Olson@fourthought.com
Tue, 08 Aug 2000 07:41:17 -0600


"M.-A. Lemburg" wrote:
> 
> Mike Olson wrote:
> >
> > "M.-A. Lemburg" wrote:
> > >
> >
> > You may want to look at Zope in Zope/lib/python/ZODB/ImportExport.py.
> > they do some XML pickling here.  However, I think they call back to each
> > object for help in the pickle processes (each object writes thier own
> > chunk of XML).  Though I'm not 100% sure.
> 
> 
> BTW, I only have a vague idea about what Xpath et al. do
> except that they are intended to address certain parts in
> an XML file. Is there anything to watch out for when designing
> a DTD in order to make addressability simple with Xpath ?
> 
> Ideally the xmlpickle data should be addressable using
> standard Python notations, e.g. a.b, a['b'] and a[0].
> 
> Which of the two possibilities I posted would fit this model
> w/r to Xpath ?


No matter how you do it, XPath won't look like python.  The "." is not
valid in XPath.  Attributes are accessed as with the attribute:: axis
(or @).  Ex.

<Employees Department="Development"/>
  <Employee name="Mike">
    <Adress>1234 S West Way</Address>
  </Employee>
</Employees>

To get Mike
/Employees/Employee[@name="Mike"]
To get Mikes Address with employee mike as the context:
Address[0]

Mike
> 

> Thanks,
> --
> Marc-Andre Lemburg
> ______________________________________________________________________
> Business:                                      http://www.lemburg.com/
> Python Pages:                           http://www.lemburg.com/python/
> 
> _______________________________________________
> XML-SIG maillist  -  XML-SIG@python.org
> http://www.python.org/mailman/listinfo/xml-sig

-- 
Mike Olson				 Principal Consultant
mike.olson@fourthought.com               (303)583-9900 x 102
Fourthought, Inc.                         http://Fourthought.com 
Software-engineering, knowledge-management, XML, CORBA, Linux, Python