This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Saxon: java.lang.NullPointerException from Builder.setPreviewManager(...)
- To: XSL-list <xsl-list at mulberrytech dot com>
- Subject: Saxon: java.lang.NullPointerException from Builder.setPreviewManager(...)
- From: "Randall J. Parr" <RParr at TemporalArts dot COM>
- Date: Wed, 23 Aug 2000 09:06:58 -0500
- Organization: TemporalArts
- Reply-To: xsl-list at mulberrytech dot com
Using Saxon 5.4.1 Java API with Sun JDK 1.2.2 on RedHat Linux 6.0 (with
updates) with default parser, etc.
Trying to right a very simple "identity"Java utilty that reads an XML
file and copies/writes the results on stdout (ie System.out).
(code fragment)-------------------------------------------
...
PreviewManager pm = new PreviewManager();
pm.setPreviewMode( "preview" );
pm.setPreviewElement( new Name( "ROW" ) );
Builder b = new Builder()
b.setPreviewManager( pm )
DocumentInfo docinfo = b.build( new ExtendedInputSource( new File(
filename ) ) );
....
(A) ---------------------------------------------------
IF
b.setPreviewManager( pm ) has been called
and
XML source file filename has no <DOCTYPE .... >
or souce XML file has a <DOCTYPE ...> but the source is invalid for
the referenced DTD
THEN
the call to b.build( .... ) above fails with nothing but a
"java.lang.NullPointerException".
(B)---------------------------------------------------
IF
b.setPreviewManager( pm ) has NOT been called
and
XML source file filename has no <DOCTYPE .... >
or souce XML file has a <DOCTYPE ...> but the source is invalid for
the referenced DTD
THEN
the call to b.build( .... ) above succeeds BUT no output is produced
[see post "no DTD, bad DTD generates no error, no output"]
(C)---------------------------------------------------
IF
b.setPreviewManager( pm ) has been called
and XML source file has a <DOCTYPE...> and is valid for that DTD
THEN
the call to b.build(...) succeeds and output is produced.
---------------------------------------------------
If a DTD is always required, then I think situation A should generate an
error not a java.lang.NullPointerException.
If a DTD is not required, then I think situation A should not fail and
both situation A and B should produce output
I am trying to find out if these are bugs or incorrect useage by someone
new to Saxon.
Thanks
R.Parr
Temporal Arts
330 S. Yellowstone Drive, Suite 3
Madison, WI 53705, U.S.A.
608.833.4578
RParr@TemporalArts.COM
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list