sax

Java SAX parser progress monitoring

∥☆過路亽.° 提交于 2019-12-19 16:00:09
问题 I'm writing a SAX parser in Java to parse a 2.5GB XML file of wikipedia articles. Is there a way to monitor the progress of the parsing in Java? 回答1: Use a javax.swing.ProgressMonitorInputStream. 回答2: Thanks to EJP's suggestion of ProgressMonitorInputStream , in the end I extended FilterInputStream so that ChangeListener can be used to monitor the current read location in term of bytes. With this you have finer control, for example to show multiple progress bars for parallel reading of big

XML SAX: Explain result in `qName` and `localName` in one example XML file

亡梦爱人 提交于 2019-12-19 11:25:45
问题 I am testing how to use SAXParser and understanding its component . Here is my XML file that I used to test: <?xml-stylesheet href="/externalflash/NASA_Detail/NASA_Detail.xsl" type="text/xsl"?> <rss version="2.0"> <channel> <title>NASA Image of the Day</title> <link>http://www.nasa.gov/multimedia/imagegallery/index.html</link> <description>The latest NASA "Image of the Day" image.</description> <language>en-us</language> <docs>http://blogs.law.harvard.edu/tech/rss</docs> <managingEditor

porting to Android: why am I getting “Can't create default XMLReader; is system property org.xml.sax.driver set?”?

…衆ロ難τιáo~ 提交于 2019-12-19 07:51:10
问题 I am porting some Java code that worked fine on my desktop to Android. I have the following code segment: import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import org.xml.sax.helpers.XMLReaderFactory; // ... XMLReader p = XMLReaderFactory.createXMLReader(); At the last line I get the following exception: Can't create default XMLReader; is system property org.xml.sax.driver set? When I was testing the code on desktop, it was working fine. Why am I getting this exception on Android

How to use SAX with Nokogiri?

允我心安 提交于 2019-12-19 04:00:15
问题 I want to parse a very big file 240Mb, and have to SAX to avoid to load the file in memory. My XML looks like: <?xml version="1.0" encoding="utf-8"?> <hotels> <hotel> <hotelId>1568054</hotelId> <hotelFileName>Der_Obere_Wirt_zum_Queri</hotelFileName> <hotelName>"Der Obere Wirt" zum Queri</hotelName> <rating>3</rating> <cityId>34633</cityId> <cityFileName>Andechs</cityFileName> <cityName>Andechs</cityName> <stateId>212</stateId> <stateFileName>Bavaria</stateFileName> <stateName>Bavaria<

How to properly parse XML with SAX?

僤鯓⒐⒋嵵緔 提交于 2019-12-18 12:45:22
问题 I am receiving an XML document from a REST service which shall be parsed using SAX. Please see the following example which was generated out of the XSD. Setting up the parser is not a problem. My main problem is the actual processing in the startElement() , endElement() methods etc. I don't understand how to extract the items I need and store them as they are somewhat "nested". Example The ConnectionList can occur once or twice and may contain any number of Connection elements which -in turn-

Is there a SAX Parser for Delphi and Free Pascal? [closed]

十年热恋 提交于 2019-12-18 08:54:10
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Besides MSXML and SAX for Pascal, can you recommend a SAX parser for Delphi? It would be great if it could be used in cross-platform applications with Free Pascal. 回答1: The open-source libxml2 engine supports SAX, and has a Pascal binding available. 回答2: OXML also provides support for SAX and outperforms most

Is XMLReader a SAX parser, a DOM parser, or neither?

牧云@^-^@ 提交于 2019-12-18 08:46:08
问题 I am testing various methods to read (possibly large, with very frequent reads) XML configuration files in PHP. No writing is ever needed. I have two successful implementations, one using SimpleXML (which I know is a DOM parser) and one using XMLReader . I know that a DOM reader must read the whole tree and therefore uses more memory. My tests reflect that. I also know that A SAX parser is an "event-based" parser that uses less memory because it reads each node from the stream without

Parsing and modifying xml string with sax parser

假装没事ソ 提交于 2019-12-17 16:52:31
问题 I have an XML file, I need to search for a specific tag in it and update it's value. The problem is that, using Sax parser is "must". I have to find these tags by using Sax Parser "only", dom stax j4dom dom4j parsers are out of consideration. Can I accomplish this task by converting my xml file to a string and parse it by using sax parser and append the new value by StringBuilder object? Would it be okay? Or what would you recommend? 回答1: This is a working code, just add missing imports. It

Android: parse XML from string problems

馋奶兔 提交于 2019-12-17 14:09:08
问题 I've got a custom contentHandler (called XMLHandler), I've been to a lot of sites via Google and StackOverflow that detail how to set that up. What I do not understand is how to USE it. Xml.parse(...,...) returns nothing, because it is a void method. How do I access my parsed XML data? I realize this question is probably trivial, but I've been searching for (literally) hours and have found no solution. Please help. String result = fetchData(doesntmatter); Xml.parse(result, new XMLHandler());

Exception reading XLSB File Apache POI java.io.CharConversionException

笑着哭i 提交于 2019-12-17 13:06:17
问题 Im developing a Java aplication that reads an excel xlsb file using Apache POI, but I got an exception while reading it, my code is as follows: import java.io.IOException; import java.io.InputStream; import org.apache.poi.xssf.eventusermodel.XSSFReader; import org.apache.poi.xssf.model.SharedStringsTable; import org.apache.poi.xssf.usermodel.XSSFRichTextString; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.exceptions.OpenXML4JException;