ws-commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davanum Srinivas <dava...@gmail.com>
Subject Stax parsers - one more variation
Date Mon, 27 Jul 2009 22:45:08 GMT
Andreas,

Not sure if you have seen this already. There's some convoluted code
in org/apache/axiom/om/impl/util/OMSerializerUtil.java (method
isSetPrefixBeforeStartElement) which basically has a toggle based on
the parsers.

            // Fallback: Toggle based on sun or woodstox implementation.
            NamespaceContext nc = writer.getNamespaceContext();
            ret = (nc == null ||
                    (nc.getClass().getName().indexOf("wstx") == -1 &&
                            nc.getClass().getName().indexOf("weblogic") == -1 &&
                            nc.getClass().getName().indexOf("sun") == -1));

The javadoc has more information:

    /**
     * Unfortunately there is disagreement in the user community about
the semantics of setPrefix on
     * the XMLStreamWriter.  An example will explain the difference:
writer.startElement("a")
     * writer.setPrefix("pre", "urn://sample") writer.startElement("b")
     * <p/>
     * Some user communities (woodstox) believe that the setPrefix is
associate with the scope for
     * "a" and thus remains in scope until the end of a.  The basis
for this believe is
     * XMLStreamWriter javadoc (which some would argue is incomplete).
     * <p/>
     * Some user communities believe that the setPrefix is associated
with the "b" element. These
     * communities reference an example in the specification and
historical usage of SAX.
     * <p/>
     * This method will return true if the setPrefix is associated
with the next writeStartElement.
     *
     * @param writer
     * @return true if setPrefix should be generated before startElement
     */

Can you please take a look?

If we can find a way to totally remove the need for caching the
boolean after checking the xmlstreamwriter, that would be a big bonus.

thanks,
dims

-- 
Davanum Srinivas :: http://davanum.wordpress.com

Mime
View raw message