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
6
votes
2 answers

Solve security issue parsing xml using SAX parser

I have an android app, in which user can enter any xml source url to parse. My app then parses the xml(if valid) and displays results. The issue is, if the user enters an untrusted xml source url, the app and/or the device might be effected. What…
dcanh121
  • 4,665
  • 11
  • 37
  • 84
5
votes
1 answer

how to ignore XML errors when parsing faulty XML with Sax (on Android)

Question on the Sax XML parser on Android, using Java: I need to parse XML files I get from the web, and that I have no control over. Some contain errors and cause the parser to abort with errors like "mismatched tag" or "not well-formed (invalid…
user1225364
5
votes
1 answer

Sax - ExpatParser$ParseException

I'm making an Android application that reads an XML Internet. This application uses SAX to parse XML. This is my code for the part of parsing: public LectorSAX(String url){ try{ SAXParserFactory spf=SAXParserFactory.newInstance(); …
Lobo
  • 4,001
  • 8
  • 37
  • 67
5
votes
3 answers

translate xml to json in node.js

could you, please, point me to some working xml -> json translation library for node.js? A SAX-styled would be preferable to get things done while the xml file is still receiving. Thanks
kalise
  • 221
  • 5
  • 12
5
votes
1 answer

How to apply validation of local DTD file to xml file in java?

I need to parse a bunch of incoming XML documents but it does not contain DTD declaration. Currently I am parsing xml documents using SAX Parser but without DTD validation. Now I want to apply DTD validation. DTD is created by myself. How can I…
Khushbu Shah
  • 1,603
  • 3
  • 27
  • 45
5
votes
1 answer

Parse XML with SAX in java, case insensitive.

I can parse xml just fine with SAXParserFactory in Java, BUT in some files, there are some non-lowercase attributes present, like linear3D="0.5" etc. I would like to somehow make attributes.getValue(attr) case-insensitive, so that…
Per Alexandersson
  • 2,443
  • 1
  • 22
  • 28
5
votes
1 answer

Android: why use XMLReader?

Is there any reason why I should use a XMLReader with the SAXParser? I'm seeing this kind of usage quite a lot: sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); LoginContentHandler uch = new LoginContentHandler(); …
user393964
5
votes
2 answers

How to get "xmlns:XXX" attribute if set setNamespaceAware(true) in SAX?

Here is my code: path = wsdlPath; SAXParserFactory saxfac = SAXParserFactory.newInstance(); saxfac.setNamespaceAware(true); saxfac.setXIncludeAware(true); saxfac.setValidating(false); SAXParser saxParser =…
DeepNightTwo
  • 4,809
  • 8
  • 46
  • 60
5
votes
2 answers

performing xml validation against xsd

I have XML as a string and an XSD as a file, and I need to validate the XML with the XSD. How can I do this?
volcano
  • 91
  • 1
  • 2
  • 4
5
votes
1 answer

Jython and the SAX Parser: No more than 64000 entities allowed?

I've done a simple test of the xml.sax parser in Jython on a large XML file (800 MB) and encountered the following error: Traceback (most recent call last): File "src/project/xmltools.py", line 92, in sys.exit(main()) File…
clstaudt
  • 21,436
  • 45
  • 156
  • 239
5
votes
2 answers

SAXParser fails to parse some characters

I am doing some simple SAXParsing with SAXParser etc on android/java It can parse files properly, but hiccups when it encounters some special characters, for example if it parses this xml below:
Ahmad Mushtaq
  • 1,395
  • 1
  • 10
  • 32
5
votes
2 answers

Why does SAXParser read so much before throwing events?

Scenario: I'm receiving a huge xml file via extreme slow network so I want so start the excessive processing as early as possible. Because of that I decided to use SAXParser. I expected that after a tag is finished I will get an event. The following…
Marcel
  • 4,054
  • 5
  • 36
  • 50
5
votes
2 answers

parsing XML in Java using SAX: value cut in 2 halves

I am trying to read a file format that is based on xml and is called mzXML using SAX in JAVA. It carries partially encoded mass spectrometric data (signals with intensities). This is what the entry of interest looks like (there is more information…
MichaG
  • 457
  • 5
  • 11
5
votes
2 answers

org.xml.sax.SAXParseException: Invalid byte 2 of 3-byte UTF-8 sequence

I am encountering the above error in production environment whereas the process went fine in UAT. I was wondering whether this error is related to jar file loading. We are using webmethods and the above error occurred for a java service.
abhijith501
  • 79
  • 1
  • 1
  • 7
5
votes
2 answers

Using SAX parser on xml file inside a zip

This may be beyond the capabilities of the Java VM due to the size of the files being dealt with (50-100MB xml files) Right now I have a set of xml files sent as zips, which are in turn all decompressed and then all XML in the directory are…
FaultyJuggler
  • 532
  • 1
  • 8
  • 29
1 2
3
62 63