[XML-SIG] Reconsidering the DOM API
Thu, 29 Jun 2000 11:26:12 +0200
At 20:08 28.06.00, Mike Olson wrote:
>Paul Prescod wrote:
> > Walter Doerwald wrote:
> > >
> > > Why not put children and attribute access into __getitem__
> > > c =3D b["abc"]
> > Not a bad idea as syntactic sugar. We should consider it for the NEXT
> > version of the DOM API mapping.
>I like it for syntatic sugar as well, but namespaces would make the
>attribute access interesting
>c =3D b[("http://www.fourthought.com","abc")]
>c =3D b["http://wwwifourthought.com:abc"]
>Also, for childNode access would we do anything about node types? is
>b the first child, first element, first elment with a certain
>tagname? All I see as useful.
b is the first child.
b.find(type =3D xml.Element)
b.find(test =3D lambda x: type(x)=3D=3Dxml.Element)
is the first child, that's an element.
b.find(type =3D html.a)
b.find(test =3D lambda x: type(x)=3D=3Dhtml.a)
is the first child with an element type of html.a.
Of course this means, that every element type corresponds
to a Python class (as the "abstract" Element already does).
(But again we have the problem of bringing namespaces into
Walter D=F6rwald =B7 LivingLogic AG =B7 Bayreuth, Germany =B7 www.livinglogi=