Subject: Saxon: java.lang.NullPointerException from Builder.setPreviewManager(...) From: "Randall J. Parr" <RParr@xxxxxxxxxxxxxxxx> Date: Wed, 23 Aug 2000 09:06:58 -0500 |
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@xxxxxxxxxxxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Preventing indents/new lines in, robin | Thread | Saxon: no DTD, bad DTD generates no, Randall J. Parr |
Re: Which XML parser gives the most, Lars Marius Garshol | Date | RE: translate quot to apos, Pawson, David |
Month |