From: Joseph O. <jo...@en...> - 2003-03-07 11:09:33
|
On Fri, 7 Mar 2003, Danny Ayers wrote: > > > "Using JAXP to both read and write an XML document" > > Yes, but it's also not as pretty or as elegant as EXML's. > Prettiness and elegance would be relatively low on my priority list, but > that's just a personal thing. Well, yeah... agreed, but in this case, you're looking at three lines of code versus twenty. (Slight exaggeration.) I'm a lot less interested in doing it via JAXP when JAXP gets in the way - esp. when I have a way of doing it that doesn't get in the way. As I've said before, I'd love to have someone volunteer to yank the EXML out and replace it with JAXP. I don't want the dependency either, really. It just turned out to be such a nice API to use that going from good to bad just doesn't feel right to me, and I use EXML a good bit, so the impact to ME is light. I was scratching an itch, after all, and going to JAXP is scratching an itch I don't actually have. > > Oh, no. Actually, the namespacing in JAXP is *predeterminate* where > > namespacing in XML is not. Consider RDF. Here's the "normal" declaration: [snip!] > > JAXP does not support this. > > The namespace prefix is really just an artifact of the serialization, so > it'll depend on what's being used there. I'm pretty sure that whether an > implementation extension (like those in Xerces) or a blank transform is > used, this kind of namespace support will be available. Yet that aspect is compensating for external serialization, not internal. As it's an external factor, you'd still be expected to handle it. > In JAXP, you have to search for the actual > > name of the element, including namespace, so you have to search for > > "rdf:RDF" and not "namespace locally referred to as rdf" and "RDF", the > > way EXML does it. The second decl should work in EXML. It has no chance in > > JAXP. > > The element is disambiguated by the combination of the namespace and the > local name, so these will need specifying somewhere whatever you do. I > honestly can't see much advantage in searching for one string ('rdf') over > another ('http://www.w3.org/1999/02/22-rdf-syntax-ns#') - it'll normally be > held in a variable either way. If you really wanted to you could write a > couple of convenience methods. In EXML, you declare a namespace variable (I use the misleading "rdf" for that.) Then you would look for a tag called rdf, "RDF". It's a convenience thing, indeed. > The reason I have chosen JAXP (well, Xerces usually) over alternatives in > the past is because of the existing user base, and for a lot of people it's > a known quantity. I personally think this outweighs elegance. It took me > half an hour to even find a page about EXML - the Eiffel parser is better > known. > Anyhow, there's my couple of centissimi. Actually, this has something to do with why we chose EXML, too: because the existing user base with Xerces was a known quantity. If we used Xerces (or, if you like, JAXP - they're not the same, as is par for Sun's course), we'd be binding in a version dependency. Thus, people who were using Xerces would then be trapped into using *our* version of Xerces... and vice versa. (True story: I know of a project that has to have TWO versions of xerces in the same project. Lovely concept.) EXML's smaller userbase means that deployers can drop it in without expecting the rest of their xerces-dependent code to have any changes whatsoever. --------------------------------------------------------- Joseph B. Ottinger jo...@en... http://enigmastation.com IT Consultant |