You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Giovanni Grimoldi <g....@metafora.mi.it> on 2003/11/09 21:11:08 UTC
DOM2Writer Patches
I'm using Oracle Parser for XML (JAXP compliant).
When I modify WSDD configuration and write changes to file, it generate a
spurios xmlns:="" in deployment tag (and an exception in next parsing), i.e:
<deployment xmlns:="" ........ >
The problem is in XMLUtils.DOM2Writer class, in these 2 conditions:
a) if (elPrefix != null && elNamespaceURI != null)
b) if (attrPrefix != null && attrNamespaceURI != null)
It seems that in these contexts Oracle Parser return "" instead of null.
So, if you test both conditions it seems to work.
My patches are:
a) boolean isemptyPrefix=((elPrefix == null) ||
(elPrefix.equals("")));
boolean isemptyNS=((elNamespaceURI == null) ||
(elNamespaceURI.equals("")));
if(!(isemptyPrefix || isemptyNS))
b) boolean isemptyAttrPrefix=((attrPrefix == null) ||
(attrPrefix.equals("")));
boolean isemptyAttrNS=((attrNamespaceURI == null) ||
(attrNamespaceURI.equals("")));
if(!(isemptyAttrPrefix || isemptyAttrNS))
Regards
Giovanni Grimoldi
g.grimoldi@metafora.mi.it
Re: DOM2Writer Patches
Posted by Paul Brown <pr...@fivesight.com>.
Giovanni --
> a) if (elPrefix != null && elNamespaceURI != null)
> b) if (attrPrefix != null && attrNamespaceURI != null)
This is the correct behavior, actually.
> It seems that in these contexts Oracle Parser return "" instead of
> null.
DOM requires that an unset namespace URI or unset namespace prefix be
represented by <code>null</code> as a return value from
Node.getNamespaceURI() or Node.getPrefix(), while SAX requires that the
namespace URI is never null. (For SAX, it is "" if it is unset.)
See:
http://java.sun.com/j2se/1.4.1/docs/api/org/w3c/dom/
Node.html#getNamespaceURI()
Paul Brown
http://blog.fivesight.com/prb/