Questions tagged [saxparser]

SAX (Simple API for XML) is an event-based parser for XML documents.

SAX is an alternative model to DOM for processing XML documents. Where DOM works on the document as a whole, SAX works piece by piece.

935 questions
4
votes
2 answers

How to set UTF-8 for the parsed xml file using SAX Parser in android

I am parsing an XML file obtained from the remote server,which consists of some different fonts using SAX Parser and I want to set UTF-8 to this.How can I set? Code is: SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp =…
Vivek Kalkur
  • 2,200
  • 2
  • 21
  • 40
4
votes
3 answers

How to use SAX on this xml file

I have an XML file that I am trying to parse with Sax (this is my first time doing this). I've researched how to implement the parser, and that all makes sense, but I'm unsure of the best way to tackle this problem. I have scattered pieces of…
Steve
  • 4,457
  • 12
  • 48
  • 89
4
votes
1 answer

Groovy - NekoHTML Sax parser

I am having hard time with my NekoHTML parser. It is working fine on URL's but when I want to test in on a simple XML test, it does not read it properly. Here is how I declare it: def createAndSetParser() { SAXParser parser = new SAXParser() …
Alexandre Bourlier
  • 3,972
  • 4
  • 44
  • 76
4
votes
5 answers

SAXParser fails when responce contains Hindi or other special characters

I am using SAX parser to parse a XML response but it throws an exception. ExpatParser$ParseException : (not well formed) invalid token Is there any solution? Here is my code: HttpParams params = new BasicHttpParams(); …
Vaibhav Jani
  • 12,428
  • 10
  • 61
  • 73
4
votes
1 answer

Is SAXParserFactory susceptible to XXE attacks?

We read our XML template files using javax.xml.parsers.SAXParserFactory. If there is XXE in the XML file we're reading, is there a way to turn off processing that? thanks - dave
David Thielen
  • 28,723
  • 34
  • 119
  • 193
4
votes
1 answer

Android SAX Parsing: How to Preserve Newlines from within a CDATA Tag

I have an Android application that uses the SAX parsers to extract data from an XML file. Some of the data is found within some CDATA tags and sometimes contains newline characters. Those newline characters are being removed during parsing. How do I…
mahdaeng
  • 791
  • 4
  • 15
  • 25
4
votes
1 answer

Sax parsing best practices

What are the best ways to minimize the pain of implementing a sax parser to build an object tree? Like, in what method do you create java objects and where do you store them, how do you keep and use a stack for complex hierarchies, how do you…
gtrak
  • 5,598
  • 4
  • 32
  • 41
4
votes
1 answer

How to parse the html content in android using SAX PARSER

There is description tag in xml. It contains the html tags. I am using SAX parser in android to parse. But when it fetch data from the description tag then it does not fetch the html contents, not any tags. Then how i solve the problem of the html…
Amit Thaper
  • 2,117
  • 4
  • 26
  • 49
4
votes
1 answer

Parsing Very Large XML file with Ruby on Rails (1.4GB) -- Is there a better way than SAXParser?

Currently, I'm using LIBXML::SAXParser::Callbacks to parse a large XML file containing data 140,000 products. I'm using a task to import the data for these products into my rails app. My last import took just under 10 hours to complete: rake…
DBruns
  • 269
  • 1
  • 10
4
votes
2 answers

org.xml.sax.SAXParseException: The entity "ndash" was referenced, but not declared

I'm parsing the the following...
dacracot
  • 22,002
  • 26
  • 104
  • 152
4
votes
2 answers

How to set FEATURE_SECURE_PROCESSING in XMLReaderFactory?

I am using Piccolo jar and creating XML reader using XMLReaderFactory. I need to set the secure processing feature and hence i did this way, xmlReader =…
Srikanth Sridhar
  • 2,317
  • 7
  • 30
  • 50
4
votes
0 answers

org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 0: not well-formed

first i am sorry for my english i am not a native speaker. I have a android app in which i try to parse an xml file which is anywhere on the phone(is selected via a filechooser). I get from the filechooser a path like this:…
user3445226
4
votes
2 answers

org.apache.harmony.xml.ExpatParser$ParseException(invalid token)

I am Using following two methods for parsing my Xml Data: private static XMLReader prepareSAX() throws ParserConfigurationException, SAXException { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp =…
Kishan Dhamat
  • 3,746
  • 2
  • 26
  • 36
4
votes
2 answers

xml.sax parser and line numbers etc

The task is to parse a simple XML document, and analyze the contents by line number. The right Python package seems to be xml.sax. But how do I use it? After some digging in the documentation, I found: The xmlreader.Locator interface has the…
Steve White
  • 373
  • 5
  • 9
4
votes
1 answer

How to process invalid HTML documents from web with library which wants proper HTML

I am getting this error while parsing a web site . ERROR: 'The declaration for the entity "ContentType" must end with '>'.' or input type must b closed
Ashu
  • 392
  • 1
  • 7
  • 16