3 Replies Latest reply on Jul 10, 2010 4:45 AM by aguizar

    JBPM4.4: XMLUtil.element(Element, String, Parse) always returns null

    kevinmoodley

      This method uses the org.w3c.dom.Node.getLocalName() method.

      In my environment org.w3c.dom.Node is implemented by com.sun.org.apache.xerces.internal.dom.NodeImpl in JDK 1.6.

       

      Unfortunately, in this implementation the getLocalName() method always returns null.

       

      /**
           * Introduced in DOM Level 2. <p>
           *
           * Returns the local part of the qualified name of this node.
           * For nodes created with a DOM Level 1 method, such as createElement
           * from the Document interface, and for nodes of any type other than
           * ELEMENT_NODE and ATTRIBUTE_NODE this is the same as the nodeName
           * attribute.
           * @since WD-DOM-Level-2-19990923
           * @see AttrNSImpl
           * @see ElementNSImpl
           */
          public String             getLocalName()
          {
              return null;
          }

       

       

      Questions:
                Which implementation of org.w3c.dom.Node should I use?

                How do I get that implementation to be picked up instead of the default com.sun.org.apache.xerces.internal.dom.NodeImpl.[Note: Using Maven]

       

      Thanks

      Kevin

        • 1. Re: JBPM4.4: XMLUtil.element(Element, String, Parse) always returns null
          aguizar

          I can run the jBPM test suite with Sun JDK 1.5.0_20 and OpenJDK 1.6.0_18 on Fedora Linux and XML parsing works without any external JAXP library. Can you please indicate your OS and exact JDK version?

           

          If you are willing and able, please jBPM4 Building from Source and tell us what your test results are.

          • 2. Re: JBPM4.4: XMLUtil.element(Element, String, Parse) always returns null
            kevinmoodley

            Experienced the problem on:
                  Windows XP with sun JDK 1.6.0_20

                  Redhat Linux 5.4 with jdk 1.6.0_16-b01

             

            Note:

            I am trying to use XmlUtil directly, as a utility. I was not using it via the BPM Engine. This is probably why the default implementation of org.w3c.dom.Node (i.e com.sun.org.apache.xerces.internal.dom.NodeImpl)  gets used. I did use it successfully with jBPM 4.3

             

            I have subsequently created my own XmlParserUtility, so this is not a major issue at this time.

             

            I will attempt to build jbpm 4 from source. I have never done this before.

            • 3. Re: JBPM4.4: XMLUtil.element(Element, String, Parse) always returns null
              aguizar
              I am trying to use XmlUtil directly, as a utility. I was not using it via the BPM Engine. This is probably why the default implementation of org.w3c.dom.Node (i.e com.sun.org.apache.xerces.internal.dom.NodeImpl)  gets used. I did use it successfully with jBPM 4.3

              Alright, this makes things clearer. I believe the reason why your own Element instances return null to getLocalName is that the DocumentBuilder they were created with is not namespace aware. The jBPM Parser class always sets the namespaceAware property of its DocumentBuilderFactory instance to true. This is probably what your own app is missing.