[XML-SIG] xmlpickle.py ?!
Tue, 08 Aug 2000 22:42:16 +0200
Mike Olson wrote:
> "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.
> > 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>
> To get Mike
> To get Mikes Address with employee mike as the context:
Hmm, looks like it would be more useful to map object names
to element names in this case... it doesn't really make sense
to access information on a type basis, e.g.
/dictionary/item[@key="Mike"]. But then, structure is given by
type, not object name. Oh well :-/
BTW, how would one access "Mike" in this XML file without reverting to
positional indexing ?
<value><address>1234 Main Street</address></value>
It seems that these XPath lookups have to be context senstive...
Python Pages: http://www.lemburg.com/python/