Author: dims
Date: Thu Feb 1 18:03:21 2007
New Revision: 502442
URL: http://svn.apache.org/viewvc?view=rev&rev=502442
Log:
WSCOMMONS-160 - StAXOMBuilder is stripping off namspace prefix's from
attributes that need namespace qualification
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/util/OMSerializerUtil.java
Modified:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/util/OMSerializerUtil.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/util/OMSerializerUtil.java?view=diff&rev=502442&r1=502441&r2=502442
==============================================================================
---
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/util/OMSerializerUtil.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/util/OMSerializerUtil.java
Thu Feb 1 18:03:21 2007
@@ -355,6 +355,19 @@
// Default namespaces are not allowed on an attribute reference.
// Earlier in this code, a unique prefix was added for this
case...now obtain and use it
prefix = writer.getPrefix(namespace);
+ //XMLStreamWriter doesn't allow for getPrefix to know whether
you're asking for the prefix
+ //for an attribute or an element. So if the namespace matches
the default namespace getPrefix will return
+ //the empty string, as if it were an element, in all cases
(even for attributes, and even if
+ //there was a prefix specifically set up for this), which is
not the desired behavior.
+ //Since the interface is base java, we can't fix it where we
need to (by adding an attr boolean to
+ //XMLStreamWriter.getPrefix), so we hack it in here...
+ if ( prefix == null || "".equals( prefix ) ) {
+ for (int i=0; i<writePrefixList.size(); i++) {
+ if ( namespace.equals( (String)writeNSList.get( i ) )
) {
+ prefix = (String)writePrefixList.get( i );
+ }
+ }
+ }
} else if (namespace != null) {
// Use the writer's prefix if it is different, but if the
writers
// prefix is empty then do not replace because attributes do
not
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]