[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Cannot close an XML file used for parsing
Hi Everyone, I have added the additional I/O statements in the finally clause as follows but the problem still persisted: readData() // reading data (html) from the webpage and save it in html format. try { â¦. } catch { â¦. } finally { System.out.flush(); isInHtml.close(); disInHtml.close(); fosOutHtml.flush(); fosOutHtml.getFD().sync(); fosOutHtml.close(); } // convert the html webpage format to xml format try { â¦. } catch { â¦. } finally { System.out.flush(); fwOutXml.flush(); fwOutXml.close(); pwOutXml.flush(); pwOutXml.close(); } Below is a short listing of the new XML file: <?xml version="1.0" encoding="iso-8859-1" ?> - <<html> - <<head> <<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <<meta name="keywords" content=" <<meta name="description" content="Cities, towns and suburbs in <<title>Cities and Towns in <<link rel="stylesheet" href="http://www.abc.com/style.css" type="text/css" media="screen" /> </head> - <<body> <<a name="top" /> - <<div id="container"> - <<div id="header"> <<div id="postmark" /> - <<a href="http://www.abc.com/" class="imglink"> <<img id="logoimg" src="http://www.abc.com/images/zipcodes.gif" width="192" height="33" alt="Zipcodes America Logo" /> </a> <<hr /> </div> - <<div id="nav"> - <<ul> - <<li> <<a href="http://www.abc.com/" title="Home Page">Home</a> </li> - <<li> <<strong>Search</strong> (zipcode or suburb) - <<div class="hide"> <<form method="post" action="http://www.abc.com/search" /> // line 23 </div> <<input type="text" name="q" class="searchbox" alt="Search query" /> <<br /> <<input type="submit" value="find!" class="searchbutton" alt="Perform search" /> <<div class="hide" /> </li> ⦠What I find it interesting is that it is possible to parse the above XML file with the same parseData() from another class without any problem. As a result, I have come to the following conclusion so far: ( i ) There is some file locking that is prevent saxBuilder from parsing the XML file at the time. ( ii ) The light_html2xml does not appears to have correctly converted over the orginal Html to Xml but some how it has been picked up by the parser in the same class, but not by the same parser from another class. ( iii ) I would like to use another conversion tool such as Tagsoup in place of light_html2xml to determine where the cause of this issue is coming from. As a result, would anyone be able to assist me coming up with a few lines of conversion statements using Tagsoup since I am not familiar with using this tool? ( iv ) light_html2xml is good as it strip out all namespace, DTD, Entity Resolver, etc and only return what I need. JTidy does correct conversion but include namespace, DTD, Entity Resolver which makes parsing difficulty. Many thanks again, Jack From: Sheila M. Morrissey <Sheila.Morrissey@p...> To: Jack Bush <netbeansfan@y...> Sent: Wednesday, 29 October, 2008 12:52:06 AM Subject: RE: Cannot close an XML file used for parsing Jack â did you try fosOutHtml.getFD().sync() after the flush? Regards Sheila
From: Jack Bush [mailto:netbeansfan@y...]
Hi Robert,
Thanks for responding to this post.
I have added your suggestion but the issue still persist. Nevertheless, I do believe that this is caused by the new XML file not having been closed properly.
There is no problem with http://sourceforge.net/projects/light-html2xml method which has worked in the past.
Any more suggestion to try out?
Thanks,
Jack
From: Robert Koberg <rob@k...>
Search 1000's of available singles in your area at the new Yahoo!7 Dating. http://au.rd.yahoo.com/dating/mail/tagline1/*http:/au.dating.yahoo.com/?cid=53151&pid=1011. Search 1000's of available singles in your area at the new Yahoo!7 Dating. http://au.rd.yahoo.com/dating/mail/tagline1/*http://au.dating.yahoo.com/?cid=53151&pid=1011.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|