sax

Sax - ExpatParser$ParseException

放肆的年华 提交于 2019-12-01 03:10:04
问题 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(); SAXParser sp = spf.newSAXParser(); DefaultHandler lxmlr=new LibraryXMLReader() ; sp.parse(url, lxmlr); nodo=((LibraryXMLReader)lxmlr).getNodoActual(); }catch(ParserConfigurationException e){ System.err.println("Error de parseo en LectorSAX.java: "+e); }catch

Java (JAXP) XML parsing differences of DocumentBuilder

好久不见. 提交于 2019-12-01 01:47:24
问题 Is there any kind of difference between DocumentBuilder.parse(InputStream) and DocumentBuilder.parse(InputSource) ? I could only find that for the first case, the parser detects the encoding from the stream so it is safer while in the latter I am not sure if it is required to set the encoding. Any other points (e.g. performance) I should be aware? 回答1: The main difference is that the first one allows you to read your XML content only from binary sources, based on the implementations of the

How to parse a complex SOAP response in Android

ⅰ亾dé卋堺 提交于 2019-12-01 00:55:39
Since two days I am trying to consume a WCF (.NET) Soap Service and serialize it's response without success. I am getting a correct response (I had to put it on pastebin: SOAP Response Example ), but KSOAP2 is not able to handle .NET Datasets correctly. I already consultated various articles about this specific problem, but none has a .NET Dataset to handle. The main article which gave guideance was an article by IBM "Working with XML on Android" I tried following steps to parse my data without success: Parsing with SAX (android) -> Seems not to work with this complex document because of the

How to parse a complex SOAP response in Android

谁都会走 提交于 2019-11-30 19:21:55
问题 Since two days I am trying to consume a WCF (.NET) Soap Service and serialize it's response without success. I am getting a correct response (I had to put it on pastebin: SOAP Response Example), but KSOAP2 is not able to handle .NET Datasets correctly. I already consultated various articles about this specific problem, but none has a .NET Dataset to handle. The main article which gave guideance was an article by IBM "Working with XML on Android" I tried following steps to parse my data

Parse XML string using SAX

半腔热情 提交于 2019-11-30 17:46:59
Is there any way to parse an XML string using Android SAX? Yes, first define a SAX ContentHandler : class MyXmlContentHandler extends DefaultHandler { ... // implement SAX callbacks here } then you can use the Xml utility class: Xml.parse(xmlString, new MyXmlContentHandler()); 来源: https://stackoverflow.com/questions/1850412/parse-xml-string-using-sax

Parse XML string using SAX

北城余情 提交于 2019-11-30 16:52:51
问题 Is there any way to parse an XML string using Android SAX? 回答1: Yes, first define a SAX ContentHandler: class MyXmlContentHandler extends DefaultHandler { ... // implement SAX callbacks here } then you can use the Xml utility class: Xml.parse(xmlString, new MyXmlContentHandler()); 来源: https://stackoverflow.com/questions/1850412/parse-xml-string-using-sax

Remove multiple nodes from an xml file using sax and java

試著忘記壹切 提交于 2019-11-30 10:16:28
I am new to XML parsing using Java and SAX parser. I have a really big XML file and because of its size I have been advised to use SAX parser. I have finished parsing part of my tasks and it works as expected. Now, there is one task left with XML job: deleting/updating some nodes upon user's request. I am able to find all tags by their names, change their data attributes, etc. If I am able to do these with SAX, deleting also may be possible. Sample XML describes some functionality under some case's. User's inputs are the "case"s names ( case1 , case2 ). <ruleset> <rule id="1"> <condition>

How to use ESC (&#27;) character in XML?

守給你的承諾、 提交于 2019-11-30 09:24:43
问题 I'm trying this: <root> text: &#27; </root> But parser says: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 12; Character reference "&#27" is an invalid XML character. at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) How to use it there? 回答1: You cannot ( in XML 1.0). In XML 1.1 there is a slightly larger range of characters you can

OpenXML Sax method for exporting 100K+ rows to Excel fast

 ̄綄美尐妖づ 提交于 2019-11-30 07:39:09
I have been trying to improve the performance of the SAX method for writing to an xlsx. I know there is a limit of 1048576 rows in Excel. I have hit this limit only a few times. In most cases though I only write out about 125K to 250K rows (a large dataset). The code that I have tried doesn't seem to be as fast as it could be because of the many times it will write to the file. I would hope that there is some caching involved but it still seems like there is way too much disk access in the way the code works now. The code below is similar to Using a template with OpenXML and SAX because I have

Using Python's xml.etree to find element start and end character offsets

泄露秘密 提交于 2019-11-29 22:11:56
问题 I have XML data that looks like: <xml> The captial of <place pid="1">South Africa</place> is <place>Pretoria</place>. </xml> I would like to be able to extract: The XML elements as they're currently provided in etree. The full plain text of the document, between the start and end tags. The location within the plain text of each start element, as a character offset. (3) is the most important requirement right now; etree provides (1) fine. I cannot see any way to do (3) directly, but hoped that