[jdom-interest] Trusting parsers with namespaces

Elliotte Rusty Harold elharo at metalab.unc.edu
Sun Apr 6 11:37:13 PDT 2003


At 1:11 PM -0500 4/6/03, Bradley S. Huffman wrote:

>Right now SAXBuilder's default is to always set SAX "namespaces" to
>true and "namespace-prefix" to false, and you cannot change that.

I think that's wrong. It should set both to true in order to 
propagate namespaces in scope and additional namespaces properly.

>My question is why cann't they be changed?
>
>If a developer wants to use a SAX Parser with "namespaces" set to false,
>or "namespace-prefix" to true, why not?.

Why would anybody want to do this? I don't believe this is a real use-case.

>Shouldn't SAXHandler be
>smart enough to handle namespace mappings reported though either from
>startPrefixMapping or the attribute list from startElement, or both
>(right now they must be reported through startPrefixMapping)?
>Or if a developer doesn't care about namespaces, for whatever reason, why
>shouldn't they be allowed to set "namespaces" to false.

Because it would completely screw up JDOM's internal model of the 
document. JDOM assumes and mostly maintains namespace 
well-formedness. JDOM internally assumes that all documents are 
namespace well-formed. Disallowing this would make more work for us 
inside JDOM, and more work for developers outside JDOM who want 
namespace well-formed documents. It would vastly complexify the API 
and implementation for a non-existent, purely theoretical need.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|           Processing XML with Java (Addison-Wesley, 2002)          |
|              http://www.cafeconleche.org/books/xmljava             |
| http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA  |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list