Another strange error with another day, SAX, Java, and friends.
I should run again file
a list of items and pass them on the SAX Parser. However, the parser fails due to a IOException
. However, various file
object methods confirm that the file actually exists.
The output I get is:
11: 53: 57.838 [MainThread] DEBUG DefaultReactionFinder - C: \ project \ trunk \ application \ config \ responses \ TestReactions.xml 11: 53: 57.841 [MENTHHOO] Error Default ReactionFinder - C: \ project \ trunk \ application \ config \ responses \ null (system can not find the file specified)
I have tried almost all the changes to pass the file as a parameter; In the form of string
(both getAbsolutePath ()
and hand-entered), URI
and, in a very strange way , In the form of FileInputStream
(I get the same error for this, except that the whole relative path is reported as zero, hence the C: \ Project \ trunk \ null
).
Whatever I can think of is that the SAXParserFactory
is configured incorrectly. I do not know what is wrong, though.
Here is the related code:
SAXParserFactory factory = SAXParserFactory.newInstance (); Factory.setValidating (true); Try {Pars = Factory NASAspex (); } Hold (Parser Configuration Exception E) {Throw New Exception Exception ("Error Error Configuring XML Parser." Error Message: \ "" + + e.getMessage () + "\".););} Hold (SAXException e) {New error (error message: "+ e.getMessage (+ +" ".");); Error; Error creating a SAX parser. } ... for (file f: fileLister.getFileList ()) {logger.debug (f.getAbsolutePath ()); Try {Parser.ps (F, New ReactionHandler (Input)); // FileInputStream FS = New FileInputStream (f); //parser.parse(fs, new ReactionHandler); //fs.close (); } Hold (IOException e) {logger.error (e.getMessage ()); Throw New Reaction Knotfound Ablation ("An Error Processing File \" + + + "+" "" ""); } ...}
I have not made any special provision to provide a custom SAX Parser implementation: I use system default I
Edit More info:
My code when I use currents:
FileInputStream Fs = New FileInputStream (f); Input Source = New Input Source (FS); . //is.setSystemId(f.toURI () toString ()); Parser.from (is, new ReactionHandler (input));
returns output
11: 07: 10.703 [maththread] debug default feedbackfinder - c: \ project trunk \ application \ config \ responses \ test Relation. Xml 11: 07: 10.706 [Mentethight] Error default reflectionfinder - C: \ project \ trunk \ application \ null (system can not find the specified file)
which states that the related directory XML The file is not resolved properly if I include the line at which the comment is made, then the relative directory is resolved correctly once again. From this I think that some setting is wrong ...
Uh, I should know .. . The problem is not with the code, but with the DOCTYPE
definition in the XML file! I gave a public identifier but not an system identifier. This means that the file could not solve the Parser, it was not just the XML file but rather the DTI file!
Comments
Post a Comment