ws-soap-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From duft...@us.ibm.com
Subject Xerces 1.1.2 Bug
Date Tue, 18 Jul 2000 17:51:50 GMT
As has been discussed here previously, Xerces v1.1.2 has a bug in the
Element.getAttributeNS(String) method. This method is supposed to return a
null if the attribute is not present (and doesn't have a default value).
However, in 1.1.2 an empty string is returned instead. I have attached
below a small test case to demonstrate the bug. Run the test using both
Xerces v1.0.3 and Xerces v1.1.2, and you will see the difference. I am in
the process of removing the dependancies on Xerces v1.1.2 so that we can
temporarily go back to using Xerces v1.0.3 which does not have this bug.


You can run the test on any simple XMl file, including the one below.


TestAttrNS.java file:

import java.io.*;
import org.w3c.dom.*;
import org.apache.xerces.dom.*;
import org.apache.xerces.parsers.*;
import org.xml.sax.*;

public class TestAttrNS
{
  public static void main(String[] argv) throws Exception
  {
    FileReader fileIn = new FileReader(argv[0]);
    InputSource in = new InputSource(fileIn);
    DOMParser parser = new DOMParser();

    parser.setFeature("http://xml.org/sax/features/namespaces", true);
    parser.parse(in);

    Document doc = parser.getDocument();
    Element root = doc.getDocumentElement();
    String attrVal = root.getAttributeNS("http://www.a.b.c", "def");

    System.err.println("attrVal=" + attrVal);
  }
}

Sample XML file:

<nada/>


-Matt



Mime
View raw message