Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 4.1.1
-
Fix Version/s: 4.1.2
-
Labels:None
-
Number of attachments :
Description
Per the Java doc of the XMLStreamReader, it requires null value is returned while it is default name space. I knew that there are some discussion in the past for it, and the spec seems not clarify this clearly in each scenario. For the reason to keep the compatibility of jsr 107, it would be better to have a flag to change the default behavior.
getNamespacePrefix
String getNamespacePrefix(int index)
Returns the prefix for the namespace declared at the index. Returns null if this is the default namespace declaration
Parameters:
index - the position of the namespace declaration
Returns:
returns the namespace prefix
Throws:
IllegalStateException - if this is not a START_ELEMENT, END_ELEMENT or NAMESPACE
Hi, Tatu, thanks for following this issue.
I did some investigation for this, and find with the following changes, all the stax test cases will look fine.
a. BaseStreamReader.getNamespacePrefix(int index), return null directly.
b. SimpleNsStreamWriter.writerAttribute(String nsURI, String localName, String value), do not throw exception if the prefix value is null.
As mentioned in the mail list, one possible solution is to use a property to control the behavior. while users explicitly configures it, then use the spec compatible return value, and by default, keep the current behavior.
Any thought ? Really appreciated that this could be resolved soon, as we hope to ship the 4.1.* with Geronimo 3.0. Thanks.