>>-----Original Message----- >>From: Uma Shinde [mailto:[EMAIL PROTECTED] >>Sent: Friday, May 25, 2001 2:01 PM >>To: Xerces-J-User (E-mail); '[EMAIL PROTECTED]' >>Cc: Meena Kamath >>Subject: FW: Reader gets overwritten, bug? >> >> >>The problem here is that the parser is called twice, once from >>getAssociatedStylesheet and once from transform. And just >>calling the parser >>twice on the same input source does not work. Here's a code >>snippet I used >>to verify that. >> >> File file = new File(xmlFile); >> FileReader fstr = new FileReader(file); >> InputSource inp = new InputSource(fstr); >> DOMParser p = new DOMParser(); >> p.parse(inp); >> System.out.println("first Parse"); >> p.parse(inp); >> >>The second parse throws this exception: >>org.xml.sax.SAXParseException: The root element is required >>in a well-formed >>document. >> >> >>>>-----Original Message----- >>>>From: Shane Curcuru [mailto:[EMAIL PROTECTED] >>>>Sent: Thursday, May 24, 2001 10:09 PM >>>>To: [email protected] >>>>Subject: Re: Reader gets overwritten, bug? >>>> >>>> >>>>If I recall correctly, that's not a bug (but as I'm >>>>thinking about it, I'm not sure...) >>>> >>>>Basically it's common to only be able to use >>>>InputStreams/Readers once, and then have to recreate >>>>them. Thus you probably need to create a new >>>>StreamSource(new Reader(file.blah)) for the >>>>getAssociatedStylesheet() call, and then create a >>>>second StreamSource(new Reader(file.blah)) for the >>>>stylesheet build. (Or at least a new Reader, to set >>>>back into the same StreamSource). >>>> >>>>I suppose perhaps it shouldn't set the Source you >>>>passed in to null, but I'm betting that we're not >>>>going to allow you to re-use the underlying >>>>Reader/InputSource again. >>>> >>>>- Shane >>>>---- you Meena Kamath <[EMAIL PROTECTED]> >>>>wrote ---- >>>> >>>>I ran into this problem while using >>>>getAssociatedStylesheet() to work with >>>>an embedded stylesheet. To explain this problem >>>>better, I've attached the >>>>UseStylesheetPI example that I modified. >>>>If you notice the transform() and >>>>getAssociatedStylesheet() use the same >>>>StreamSource. The StreamSource has been constructed >>>>using a Reader. On >>>>execution I get this exception >>>> >>>>"javax.xml.transform.TransformerException: The root >>>>element is required in a >>>>well >>>>-formed document. >>>> at >>>>org.apache.xalan.transformer.TransformerImpl.transform(Trans >>formerImp >>>>l.java, Compiled Code) >>>> at >>>>org.apache.xalan.transformer.TransformerImpl.transform(Trans >>formerImp >>>>l.java:1174) >>>> at >>>>UseStylesheetPI.main(UseStylesheetPI.java:87)....." >>>> >>>>On debugging I found that the >>>>getAssociatedStylesheet() actually sets the >>>>reader to null. I tried it with FileReader as well as >>>>StringReader and get >>>>the same results. Is this a bug? >>>> >>>>Thanks >>>>Meena >>>> >>>> >>>>===== >>>><eof msg="This is not my regular email account" >>>> humor="This is not Shane's actual brain today" /> >>>> >>>>__________________________________________________ >>>>Do You Yahoo!? >>>>Yahoo! Auctions - buy the things you want at great prices >>>>http://auctions.yahoo.com/ >>>> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] >>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
