Simplify the OMElement#declareNamespace(String, String) API
-----------------------------------------------------------

                 Key: AXIOM-375
                 URL: https://issues.apache.org/jira/browse/AXIOM-375
             Project: Axiom
          Issue Type: Improvement
          Components: API
            Reporter: Andreas Veithen
            Priority: Minor
             Fix For: 1.3


OMElement#declareNamespace(String, String) auto-generates a prefix if the 
prefix is either null or the empty string. There are several issues with this:

1. It is inconsistent with other APIs (in particular 
OMElement#declareNamespace(OMNamespace) which make a distinction between null 
(indicating that a prefix should be generated) and the empty string (meaning 
the default namespace).

2. It is not possible to use OMElement#declareNamespace(String, String) to 
declare a default namespace. This is especially annoying when the prefix is 
provided as a variable, in which case one has to write something like this:

        if (prefix.length() == 0) {
            nextElem.declareDefaultNamespace(uri);
        } else {
            nextElem.declareNamespace(uri, prefix);
        }

3. It is obviously not necessary to support two different ways to indicate that 
a prefix should be generated. One (prefix == null) should be enough.

This should be changed in the next major release (1.3). To make the transition 
easier, the Javadoc in 1.2.x should be updated to indicate that using an empty 
string is deprecated and the code should generate a warning if the method is 
invoked in this way.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to