Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: use a separate thread to parse xml file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: use a separate thread to parse xml file



I am developing an xml editor that will parse xml files and display it
as a tree in JPanel. I would like to show a status dialog while
downloading and parsing are going on. The user can stop the parsing by
pressing the "Cancel" button in status dialog. I guess I have to use a
separate thread to do this. Is there anyone who has done this before.


One approach.

...
// Create handlers
ContentHandler contentHandler = new AppContentHandler();
ErrorHandler errorHandler = new AppErrorHandler(System.err);
EntityResolver entityResolver = new AppEntityResolver();

// Set up progress monitor
InputStream in = new BufferedInputStream(
new ProgressMonitorInputStream(
null,
"Reading XML data...",
new FileInputStream(file.getAbsoluteFile())));

// Parse the XML document
try
{
XmlUtil.parseXML(new InputSource(in),
contentHandler,
errorHandler,
entityResolver,
validate);
}
catch (NoDataException nde)
{
throw nde;
}
...


--
----------------------------------------------------------
Out of the 10Base-T, through the router, down the T1, over the
leased line, off the bridge, past the firewall... nothing but Net.
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.

References: 
 >use a separate thread to parse xml file (From: "Jerry (Zhijun) Tang" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.