Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

help: Content is not allowed in prolog???

807603Jun 19 2007 — edited Jan 26 2008
below is part of my coding

public static int parseReceivedXML( String xmlStr ){
        String person="";
        String id="";
        String area="";
        String amount="";
        try{
            FileOutputStream ftemp = new FileOutputStream( "doc.xml");
            ftemp.write( xmlStr.getBytes());
            ftemp.flush();
            ftemp.close();
            DocumentBuilderFactory oFdb = DocumentBuilderFactory.newInstance();
            DocumentBuilder oBldr = oFdb.newDocumentBuilder();
            Document oDoc = oBldr.parse( "doc.xml" );
            Element oRoot = oDoc.getDocumentElement();
            String sRoot = oRoot.getTagName();   
this part of code will run until the server connection is close.. it run smoothly at the 1st time of data come in, but when the data come in for 2nd time, i get error as follow

[Fatal Error] doc.xml:1:1: Content is not allowed in prolog.

this error apprear when i trace until

Document oDoc = oBldr.parse( "doc.xml" );
anyone hav any idea? thanks...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 23 2008
Added on Jun 19 2007
9 comments
709 views