ws-muse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Jemiolo (JIRA)" <j...@apache.org>
Subject [jira] Commented: (MUSE-140) Muse 2 breaks on WLS with BEA StAX parser
Date Fri, 03 Nov 2006 20:04:17 GMT
    [ http://issues.apache.org/jira/browse/MUSE-140?page=comments#action_12447061 ] 
            
Dan Jemiolo commented on MUSE-140:
----------------------------------

I had to add some code to set the "Declared Namespaces" as well (Declared Namespaces != Attributes,
just like DOM (which is annoying)). I also reused our XmlUtils methods for a number of the
steps, but the idea is the same. One of the methods I have to use on OMNamespace is deprecated
in 1.1 but it still works. We can update the build to reference the Axis2 1.1 jars in 2.2
I guess.

I will commit these changes next week as part of our commit-fest for 2.1.

> Muse 2 breaks on WLS with BEA StAX parser
> -----------------------------------------
>
>                 Key: MUSE-140
>                 URL: http://issues.apache.org/jira/browse/MUSE-140
>             Project: Muse
>          Issue Type: Bug
>          Components: Deployment - Axis2
>    Affects Versions: 2.0.0
>         Environment: WLS 9.2
>            Reporter: James Shiell
>         Assigned To: Dan Jemiolo
>            Priority: Critical
>             Fix For: 2.1.0
>
>
> When WLS 9.2 is used and the BEA StAX parser (as opposed to Woodstox) is being used the
AxisEnvironment class fails in the convertToDOM(OMElement) method. This appears to be due
to a WLS bug, where the serialised XML ommits namespace declarations.
> Given that it is not always possible to structure the classpath to use Woodstox I have
included a potential fix that does not rely on serialisation, instead converting objects directly.
This is compatible with both implementations and hopefully slightly faster as well.
> AxisEnvironment.java:
>     /**
>      * Convert Axiom to DOM. Muse uses the DOM API in the JDK, Axis2 uses
>      * the Axiom API, which is similar but... different.
>      *
>      * @param axiom the OM element.
>      * @return the converted element.
>      */
>     public static Element convertToDOM(final OMElement axiom)
>     {
>         try
>         {
>             final DocumentBuilder domBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
>             final Document doc = domBuilder.newDocument();
>             return convertToDom(axiom, doc);
>         }
>         catch (Throwable error)
>         {
>             throw new RuntimeException(error.getMessage(), error);
>         }
>     }
>     /**
>      * Convert an OM element into a DOM element.
>      * 
>      * @param element the OM element.
>      * @param doc the DOM document to which DOM elements should belong.
>      * @return the DOM representation of the OM element.
>      */
>     private static Element convertToDom(final OMElement element, final Document doc)
>     {
>         final Element domElement = doc.createElementNS(element.getNamespace().getNamespaceURI(),
>                 element.getLocalName());
>         domElement.setTextContent(element.getText());
>         for (Iterator i = element.getAllAttributes(); i.hasNext();)
>         {
>             final OMAttribute attr = (OMAttribute) i.next();
>             domElement.setAttributeNS(attr.getNamespace().getNamespaceURI(), attr.getLocalName(),
>                     attr.getAttributeValue());
>         }
>         for (Iterator i = element.getChildElements(); i. hasNext();)
>         {
>             final Element child = convertToDom((OMElement) i.next(), doc);
>             domElement.appendChild(child);
>         }
>         return domElement;
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org


Mime
View raw message