xml-parsing

Which is much faster, XMLParser or SimpleXML

别等时光非礼了梦想. 提交于 2019-12-05 12:40:57
What do you think guys? I currently using SimpleXML for my entire project, which have average of 250KB in memory usage w/ 500micro seconds processing per execution. I just plan to switch to XMLParser, your advice is much appreciated. Edit : The actual microtime is 0.000578 micro seconds. Im just confused in milli and micro, lol. In most cases, XML Parser will be much slower both in terms of development and execution, mainly because you have to write/execute tons of userland PHP code to navigate/read your document. In some cases, you can find some improvement using XMLReader (not sure about XML

Small, minimalistic and fast XML library for Java?

时间秒杀一切 提交于 2019-12-05 12:37:33
Sometimes I need to parse XML file - and only parse, and I don't want to do this manually via String.indexOf . So my need would be to use possibly smallest and fast XML parsing library. Unfortunatelly, I don't know anything similar to GSON (180kb). I've imported dom4j , but after that I've got exception: java.lang.NoClassDefFoundError: org/jaxen/JaxenException So I've added jaxen dependency (maven), and this is very shocking experience: about 7MB dependencies added, the biggest from them xercesImpl and icu4j . Another guess is Jericho , but this is mostly designed for parsing bad-formed HTML,

XSLTProcessor xmlSAX2Characters: out of memory

我怕爱的太早我们不能终老 提交于 2019-12-05 12:12:09
I have a page which load a 500 mb xml file and parses the file using an xsl template. The parser works perfectly in my local environment. I am using WAMP. On the web server. Warning: DOMDocument::load() [domdocument.load]: (null)xmlSAX2Characters: out of memory in /home/mydomain/public_html/xslt/largeFile.xml, line: 2031052 in /home/mydomain/public_html/xslt/parser_large.php on line 6 My Code is as below, line 6 loads the xml file <?php $xslDoc = new DOMDocument(); $xslDoc->load("template.xslt"); $xmlDoc = new DOMDocument(); $xmlDoc->load("largeFile.xml"); $proc = new XSLTProcessor(); $proc-

Parsing xml in NSXMLParser

我们两清 提交于 2019-12-05 11:22:53
I have read many examples of how to get text out of xml files, but just don't get how to. Here is a sample xml file: <?xml version="1.0" encoding="UTF-8"?> <questions> <set> <question>Question</question> <answer>Answer</answer> </set> </questions> Using -(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI , what's the easiest way to get the values Question and Answer ? I already have my parser delegate hooked up and all that blah. Nirav For implementing NSXMLParser you need to implement delegate method of it. First of all initiate

SAXParseException XML-20221 Invalid char in text

天大地大妈咪最大 提交于 2019-12-05 11:05:55
For a standalone Java application, we are seeing very rare errors where Strings containing valid XML content are causing JAXB to throw exceptions like: javax.xml.bind.UnmarshalException - with linked exception: [org.xml.sax.SAXParseException: <Line 1, Column 129>: XML-20221: (Fatal Error) Invalid char in text.] This is a very old Java application, that was written for an older version of Java, and we have an existing dependency: <dependency> <groupId>com.oracle</groupId> <artifactId>xdb-xmlparser</artifactId> <version>10.2.0.3.0</version> </dependency> The error code is consistently XML-20221,

Fastest way to parse XML in Python

我的未来我决定 提交于 2019-12-05 11:00:21
I'm trying to find the qickest way to parse sensor data from a smartphone for a realtime application. The Format looks like this: <?xml version='1.0' encoding='UTF-8' standalone='yes' ?> <NodeId>0</NodeId> <Accelerometer> <Accelerometer1>-.1875240802764893</Accelerometer1> <Accelerometer2>4.6734819412231445</Accelerometer2> <Accelerometer3>8.312667846679688</Accelerometer3> </Accelerometer> <Gyroscope> <Gyroscope1>-0.10551923513412476</Gyroscope1> <Gyroscope2>0.009592439979314804</Gyroscope2> <Gyroscope3>0.019185146316885948</Gyroscope3> </Gyroscope> <Gravity> <Gravity1>-1.2976515293121338<

Node + xmldom: How do I change the value of a single XML field in javascript?

纵然是瞬间 提交于 2019-12-05 10:49:19
Using node v.0.10.29, Express v4.12.0, and xmldom v0.1.19, I'm trying to do the following: Steps Read an XML file into a string Convert the string into an XML object using xmldom Set the <name>default</name> field to <name>test</name> Convert the XML object back into a string Problem The problem is that after I set the <name> field, it sets correctly in the object, but when I convert it to a string, the <name> field is back to being the old value (wrong). Code Here's what the code looks like for this: var fs = require('fs'); var DOMParser = require('xmldom').DOMParser; var XMLSerializer =

Reading xml with out using local/webserver

岁酱吖の 提交于 2019-12-05 10:39:30
问题 I am new to javascript.I am trying to read an xml file from application folder, which is located in the hard disk. "Cross origin requests are only supported for HTTP." this is the error that is being thrown. If I try to access the same xml file via local server/web server it works fine. Since i am trying to develop offline application. How do i make it work locally. Thanks, 回答1: I can imagine a few reasons why you want to develop an offline application : If you want an actual online

How to read streaming data in XML format from Kafka?

流过昼夜 提交于 2019-12-05 10:27:54
I am trying to read XML data from Kafka topic using Spark Structured streaming. I tried using the Databricks spark-xml package, but I got an error saying that this package does not support streamed reading. Is there any way I can extract XML data from Kafka topic using structured streaming? My current code: df = spark \ .readStream \ .format("kafka") \ .format('com.databricks.spark.xml') \ .options(rowTag="MainElement")\ .option("kafka.bootstrap.servers", "localhost:9092") \ .option(subscribeType, "test") \ .load() The error: py4j.protocol.Py4JJavaError: An error occurred while calling o33

Replace specific node value in xml using php

一曲冷凌霜 提交于 2019-12-05 09:59:28
Hi i am parsing multiple xml feed and combine into one and its working fine for me but now i am bit of stuck at one point because i need to add some prefix into specific node value i mean i need to change the value of that node. here i am providing some example code what actual i want. XML <JobRecords> <JobRecord> <Brand>Corporate1</Brand> <JobId>45982</JobId> <WorkTypes> <WorkTypeRecord> <Title>Permanent1</Title> </WorkTypeRecord> </WorkTypes> </JobRecord> <JobRecord> <Brand>Corporate2</Brand> <JobId>45983</JobId> <WorkTypes> <WorkTypeRecord> <Title>Permanent2</Title> </WorkTypeRecord> <