Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] NamespaceConflictException for Attribute constructor isn't documented

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: Peter Stibrany <stibrany AT cezap.ii.fmph.uniba.sk>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] NamespaceConflictException for Attribute constructor isn't documented
  • Date: Thu, 21 Apr 2005 07:34:58 -0400

Peter Stibrany wrote:
Hello,

I've found that nu.xom.NamespaceConflictException isn't documented as exception for public Attribute(String name, String URI, String value) constructor. I can receive this exception when I use this sample code:

Attribute a=new Attribute("hello", "http://test";, "value");


This is a corner case. It's clearly wrong. An unprefixed attribute can't be in a namespace. XOM should throw an exception here. But which one? Currently the JavaDoc documents that this case will throw an IllegalNameException, but XOM actually throws a NamespaceConflictException. i.e. it reports this as a conflict between the empty prefix and the non-empty URI, rather than an illegal name or URI.

Which way to go? I'm not sure. In my investigation I noticed at least one other case where the NamespaceConflictException could be thrown: the xml prefix with a URI other than http://www.w3.org/XML/1998/namespace. Therefore I think I'm just going to better document the current behavior (i.e. add an @throws NamespaceConflictException to this method) but not change anything else. However, if anyone strongly feels that IllegalNameException is what should be thrown here in this case, speak up now.

--
Elliotte Rusty Harold elharo AT 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




Archive powered by MHonArc 2.6.24.

Top of Page