Ted, Neil,
Here's a sample test case....It's a modified version of sax.Counter. See enclosed
patch to
sax.Counter to reproduce the problem with any xml file + xerces2's jar (i used
build.xml from
xerces2 to test). If you run the same with Xerces1's jar, you will not see the
NullPointerException. This is due to the URI that is stored...In Xerces2 getURI()
returns null, in
Xerces1 getURI() returns an empty string. If you need more information, shoot me a
mail.
Thanks,
dims
--- "Theodore W. Leung" <[EMAIL PROTECTED]> wrote:
> Do you have the data valies for p1, p2 and p3 in the startElement method
> below? Some of the original problems that I fixed in the X2 DOM were
> related to namespaces. It would be good to know which element in the
> input document was causing the problem, and to know whether a prefixed
> attribute was involved.
>
> Ted
>
> On Mon, 2001-11-19 at 12:12, Sam Ruby wrote:
> > Doing performance measurements w/Xerces1, we are finding that approximately
> > 40% of the time is being spent in the parser. Clearly this represents a
> > fertile opportunity for improvment. Measuring the same workloads with
> > Crimson resulted in a slight degradation.
> >
> > I would like to measure Xerces2 and explore both XNI and constructing a
> > minimal pipeline which eliminates any unnecessary overhead (e.g., DTD
> > validation), but I am still unable to progress past the following problems
> > exposed by the unit tests. Debugging, it looks like the Axis code which
> > causes the problem down stream is as follows:
> >
> > public int startElement(String p1, String p2, String p3,
>org.xml.sax.Attributes p4) {
> > if (numattrs == attrs.length) {
> > Object[] nattrs = new Object[numattrs * 2];
> > System.arraycopy(attrs, 0, nattrs, 0, numattrs);
> > attrs = nattrs;
> > }
> >
> > attrs[numattrs++] = new AttributesImpl(p4);
> > return events.add(STATE_START_ELEMENT, st.addSymbol(p1),
>st.addSymbol(p2),
> st.addSymbol(p3), numattrs-1);
> > }
> >
> > Later attempts to reference the copied attributes results in:
> >
> > java.lang.NullPointerException
> > at org.xml.sax.helpers.AttributesImpl.getValue(Unknown Source)
> > at
>
org.apache.axis.encoding.DeserializationContext.getTypeFromAttributes(DeserializationContext.java:301)
> > at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:160)
> > at
>
>org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:606)
> > at
>org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:200)
> > at
>org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:387)
> > at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:115)
> > at org.apache.axis.message.RPCElement.getParam(RPCElement.java:124)
> > at test.encoding.TestSer.doTestData(TestSer.java:87)
> > at test.encoding.TestSer.testDataWithHrefs(TestSer.java:44)
> > at java.lang.reflect.Method.invoke(Native Method)
> > at junit.framework.TestCase.runTest(TestCase.java:157)
> > at junit.framework.TestCase.runBare(TestCase.java:131)
> > at junit.framework.TestResult$1.protect(TestResult.java:106)
> > at junit.framework.TestResult.runProtected(TestResult.java:124)
> > at junit.framework.TestResult.run(TestResult.java:109)
> > at junit.framework.TestCase.run(TestCase.java:122)
> > at junit.framework.TestSuite.runTest(TestSuite.java:173)
> > at junit.framework.TestSuite.run(TestSuite.java:168)
> > at junit.framework.TestSuite.runTest(TestSuite.java:173)
> > at junit.framework.TestSuite.run(TestSuite.java:168)
> > at
>
>org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:241)
> > at
>
>org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:419)
> >
> > I'll keep debugging, but I thought I would post this here to see if it generates
>any thoughts
> or suggestions...
> >
> > - Sam Ruby
>
>
=====
Davanum Srinivas - http://jguru.com/dims/
__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1
Index: java/samples/sax/Counter.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/samples/sax/Counter.java,v
retrieving revision 1.4
diff -d -u -b -B -w -u -r1.4 Counter.java
--- java/samples/sax/Counter.java 2001/11/13 20:34:14 1.4
+++ java/samples/sax/Counter.java 2001/11/20 13:46:46
@@ -254,9 +254,11 @@
fTagCharacters++; // open angle bracket
fTagCharacters += raw.length();
if (attrs != null) {
+ attrs = new org.xml.sax.helpers.AttributesImpl(attrs);
int attrCount = attrs.getLength();
fAttributes += attrCount;
for (int i = 0; i < attrCount; i++) {
+ System.out.println("URI:" + attrs.getURI(i));
fTagCharacters++; // space
fTagCharacters += attrs.getQName(i).length();
fTagCharacters++; // '='
@@ -266,6 +268,7 @@
}
}
fTagCharacters++; // close angle bracket
+ System.out.println("Testing:" + attrs.getValue("test","type"));
} // startElement(String,String,StringAttributes)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]