You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by du...@us.ibm.com on 2000/07/18 19:51:50 UTC

Xerces 1.1.2 Bug

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



RE: Xerces 1.1.2 Bug

Posted by Steven McDowall <sj...@aptest.com>.

Before going and ripping out other code which may now depend on 1.1.2, 
let's ask a simple question..

How isolated is the code that is affected by this bug? If the affected 
code is in one area, and since we know what the bug IS, why don't we just
allow for the "problem" and check the return from Element.getAttributeNS()
and if the return value is not null, but is an empty string, then set it
to a NULL and continue on our path?

-Steve

-----Original Message-----
From: duftler@us.ibm.com [mailto:duftler@us.ibm.com]
Sent: Tuesday, July 18, 2000 12:52 PM
To: soap-dev@xml.apache.org
Cc: soap-user@xml.apache.org
Subject: Xerces 1.1.2 Bug


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



RE: Xerces 1.1.2 Bug

Posted by Steven McDowall <sj...@aptest.com>.

Before going and ripping out other code which may now depend on 1.1.2, 
let's ask a simple question..

How isolated is the code that is affected by this bug? If the affected 
code is in one area, and since we know what the bug IS, why don't we just
allow for the "problem" and check the return from Element.getAttributeNS()
and if the return value is not null, but is an empty string, then set it
to a NULL and continue on our path?

-Steve

-----Original Message-----
From: duftler@us.ibm.com [mailto:duftler@us.ibm.com]
Sent: Tuesday, July 18, 2000 12:52 PM
To: soap-dev@xml.apache.org
Cc: soap-user@xml.apache.org
Subject: Xerces 1.1.2 Bug


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