dear all,
 
just wondering if i could get some sort of status on this error.
 
posted the same message a few days ago but now able to
reproduce error every time. see attached files.
 
windows2000, jdk1.2.2
 
to reproduce the error
 
java XercesTest error.xml
 
strangely enough, the stack trace occurs on iteration 666,
but it seems like it's related to the total volume of nodes processed.
i.e. if i use a larger xml example it takes less iterations.
 
this is a real showstopper for us at the moment.
 
could someone please let me know if this is a known error,
if there is a workaround, if i'm doing something wrong, etc.
 
any help very much appreciated,
greg.
import org.w3c.dom.*;
import org.apache.xerces.domx.traversal.*;
import org.apache.xml.serialize.Serializer;
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
import org.xml.sax.InputSource;
import java.util.*;
import java.io.*;


public class XercesTest {

	public static void main( String args[] ) {

		int i=0;
		try {

			OutputFormat outputFormat = new OutputFormat();

			outputFormat.setOmitXMLDeclaration( true );
			outputFormat.setIndenting( false );
			outputFormat.setLineSeparator( "" );

			org.apache.xerces.parsers.DOMParser p1 = new org.apache.xerces.parsers.DOMParser();
			p1.parse( args[0] );
			Document doc = p1.getDocument();


			for( i=0; i<1000; i++ ) {

				ByteArrayOutputStream baos = new ByteArrayOutputStream();
				org.apache.xml.serialize.XMLSerializer s1 = new XMLSerializer( baos, outputFormat );
				s1.serialize( doc );

				org.apache.xerces.parsers.DOMParser parser = new org.apache.xerces.parsers.DOMParser();
				parser.setFeature( "http://xml.org/sax/features/validation";, false );
				InputSource is = new InputSource( new ByteArrayInputStream( baos.toByteArray()));
				parser.parse( is );
				Document doc2 = parser.getDocument();

				org.apache.xml.serialize.XMLSerializer s2 = new XMLSerializer( System.out, outputFormat );
				s2.serialize( doc2 );
			}

		} catch( Exception e ) {

			System.out.println( i );
			
			e.printStackTrace();
		}
	}
}
<person birthDate="01 Jan 1970" created="27 Jan 2000, 10:17:34 AM" firstName="Fred" gender="M" id="1722/2" jobTitle="Manager" lastName="Garcia"/>

Reply via email to