Skip to main content

Possible bug in JAXP 1.4?

1 reply [Last post]
Joined: 2004-08-07

I've tracked down what I believe to be a problem in JAXP 1.4. A piece of code that we have that used to work in Java 1.5/JAXP 1.3 is broken in Java 1.6/JAXP 1.4. Here is a boiled-down version of the java code that demonstrates the problem. The output from the java file should be "foo", but comes out as "". The XML in question starts with a processing instruction and no prolog, but I think the parser gets confused and treats it as the prolog but throws away the data.. not really sure.

import org.w3c.dom.*;
import org.xml.sax.*;

class test {
public static void main( String[] args ) throws Exception {
ByteArrayInputStream bais = new ByteArrayInputStream( "<?xmltarget foo?>".getBytes() );
DOMParser p = new DOMParser();
p.parse( new InputSource( bais ) );
System.out.println( ( (ProcessingInstruction)p.getDocument().getFirstChild() ).getData() );

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2004-12-15

Thanks for reporting the issue. Add a link here: