xml-parsing

Importing and parsing a large XML file in SQL Server (when “normal” methods are rather slow)

无人久伴 提交于 2019-12-13 05:16:22
问题 I have a large XML file that I need to import and parse into tabular structure ("flatten") in SQL Server. By "large" I mean a file that is around 450 MB, contains up to 6-7 nested levels and lots of elements, ~300. I tried parsing the file both with OPENXML and Xml.Nodes . Both of the methods are slow. A partial query which reads a parent element and it's nested grandchildren takes several minutes if not dozens to run. I tried using the SQLXML Bulk Load method. Unfortunately I couldn't -

XML - System.Xml.XmlException - hexadecimal value 0x06

只愿长相守 提交于 2019-12-13 05:13:42
问题 I get this error. Later I searched and found out the reason of illegal characters in my XML and its solution. But I don't have the access to edit any of these files. My job is to read and fetch the tag value, attribute value and similar stuff. SO I can't replace the binary characters with escapes like '\x01' with &#01. Also I tried to include CheckCharacters =false in XMLreader settings. It doesn't take this. Still it is throwing the same error. Is it not possible to fix in XMLreader? I read

android get nodelist attribute from xml file

此生再无相见时 提交于 2019-12-13 04:58:02
问题 I make listview from xml file http://view-source:http://www.macetlagi.com/maps/st/canvaser/3/tb/tb123.I will get element from "segment" tag.When i run and debug my code,i get this error java.lang.NullPointerException .Please correct my code if i do my stupid coding.This is my java code in android : public class ListSegment extends ListActivity { String URL_XML = "http://www.macetlagi.com/maps/st/canvaser/3/tb/tb123"; static final String KEY_SEGMENT = "segment"; static final String KEY_SEGMENT

Why do I get the following exception 'first argument to the non-static Java function'?

房东的猫 提交于 2019-12-13 04:56:52
问题 I get this exception: FATAL ERROR: 'The first argument to the non-static Java function *** is not a valid object reference.' This happens when I try to transform an XML document using the xml-maven-plugin. <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>xml-maven-plugin</artifactId> <version>1.0</version> <executions> <execution> <goals> <goal>transform</goal> </goals> </execution> </executions> <configuration> <transformationSets> <transformationSet> <dir>target/generated/wsdl</dir

store xml in object

谁说我不能喝 提交于 2019-12-13 04:45:07
问题 say, i have such xml file: <?xml version="1.0"?> <catalog> <title>My book catalog</title> <link>http://example.com/catalog</link> <book id="bk101"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genre> <price>44.95</price> <publish_date>2000-10-01</publish_date> <description>An in-depth look at creating applications with XML.</description> </book> <book id="bk102"> <author>Ralls, Kim</author> <title>Midnight Rain</title> <genre>Fantasy</genre>

Removing spaces and non-printable character in Python

风流意气都作罢 提交于 2019-12-13 04:41:36
问题 I am working with xml file using lxml etree xpath method. My code is from lxml import etree File="c:\file.xml" doc=etree.parse(File) alltext = doc.xpath('descendant-or-self::text()') clump = "".join(alltext) clump I got the following output: "'\n\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n\t\n\t\t\t\n\t\n\t\t\n\t\t\t\n\t\t\t\tIntroduction\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\tAccessibility\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\tOpening eBooks\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\ I want to remove

Why does XmlReader.ReadInnerXmlAsync hang when reading <ns:element>?

一世执手 提交于 2019-12-13 04:38:30
问题 I encounter strange behavior of the XmlReader.ReadInnerXmlAsync() method. While the following code works... using (XmlReader r = XmlReader.Create(stream, new XmlReaderSettings() { Async = true })) { while (await r.ReadAsync()) { switch (r.NodeType) { case XmlNodeType.Element: if (r.Name.Equals("c")) { string x = await r.ReadInnerXmlAsync(); OnReceive("[ " + x + " ]"); } break; } } } ...and the whole element <c></c> from the following XML is read as string. <?xml version='1.0' encoding='UTF-8'

Prevent adding first line when using htmlParse() from 'XML' package

拈花ヽ惹草 提交于 2019-12-13 04:32:15
问题 I have a problem while doing a htmlParse() on a XHTML document. When it loads into R as an 'externalptr', I can see that one line is added, at the top of the file: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> I don't want to make this line appear because it breaks my application. I would like to delete it within the htmlParse() function, and not having to delete this line manually for each XHTML I have. Any suggestions? I've tried

XML: setting values of namespace elements

孤者浪人 提交于 2019-12-13 04:31:53
问题 Continuing my previous question: simplexml_load_file does not recognize <dc:title> tags How would you go about setting a value for a <dc: element? I managed to print its value but I read online that the XML parser is only for selecting data, not setting it. EDIT: Using simplexml_load_file() and PHP What i'm trying to do using PHP basically is to change this <dc:title>test</dc:title> to <dc:title>HELLO</dc:title> for example, and if that tag <dc:title> doesn't exist than add it. 回答1: a <dc:

Searching for XML tag by value between them and inserting a new tag in shell script

回眸只為那壹抹淺笑 提交于 2019-12-13 04:07:17
问题 Say I have this test.xml file which has these contents <d> <p> <n>hi</n> <r> <s>1.0</s> </r> </p> <p> <n>hello</n> <r> <s>1.0</s> </r> </p> </d> I want to add a new <s>2.0</s> for "hello" object as shown below. <d> <p> <n>hi</n> <r> <s>1.0</s> </r> </p> <p> <n>hello</n> <r> <s>1.0</s> <s>2.0</s> </r> </p> </d> I have to do this using shell script. There is a way of searching through the XML DOM and adding tags using xmlstarlet given here http://www.technomancy.org/xml/add-a-subnode-command