OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] What should TrAX look like? (Was: Re: [xml-dev] Articleon

[ Lists Home | Date Index | Thread Index ]

Michael Kay wrote:


> I'm disappointed to see my defence of the design dismissed in that kind of
> language. I didn't claim it was perfect but I did say that I thought it was
> better than the alternatives, and no-one has yet shown me an alternative
> that is demonstrably better.

It's been known for about 50 years that scientific theories aren't 
necessarily abandoned just because it's easy to prove they're 
demonstrably wrong. Scientists hold onto theories they know can't 
possibly be correct until someone comes along with a better one.

The Source interface is demonstrably wrong. It's only marginally 
preferable to passing in Object. I was taught long ago that anytime you 
see code doing something like this:

if (o instanceof A) {
   A a = (A) o;
   doSomethingWithA(a);
}
else if (o instanceof B) {
   B b = (B) o;
   doSomethingWithB(b);
}
else if (o instanceof C) {
   C c = (C) o;
   doSomethingWithC(c);
}

then you've missed out on an opportunity for polymorphism. Sometimes 
this sort of instanceof stack is necessary, especially if you don't own 
or control the classes A, B, and C. However sometimes you can do better. 
Is this one of those time? I think it might be, and it's worth exploring 
if we can get something better.

The big impedance mismatch is with streaming and tree models, but we can 
convert from one to the other. My main question is whether implementers 
of XSLT processors, XPath engines, and Validators would rather receive 
the data as a tree model or as a stream of events.

I'm also not sure how we map back from whatever interface we do create 
to the actual objects; not necessary for XSLT, very necessary for XPath.

It's not a slam dunk. There are real questions here, and the whole 
enterprise might not work. Nonetheless, I don;t think it';s worth 
rejecting out of hand. It's not as if the current solution is a paragon 
of object oriented purity. It certainly doesn't make it easy to adapt 
tools to new object models.

-- 
Elliotte Rusty Harold  elharo@metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS