xml-parsing

How to get invalid XMLNode in XmlReaderSettings.ValidationEventHandler in C#

大憨熊 提交于 2019-12-11 09:26:48
问题 I am trying to construct a custom Error Message for unsuccessful XML validation using the callback validation event. I noticed that the sender object of the element is XMLReader and i got the Element or current Node name from ((XmlReader)sender).Name and exeception message from ValidationEventargs.Exception.Message. I trying to build the path of the current node failing in the validation by getting the parent nodes of the current node Given below is the code snippet XmlReaderSettings xrs =

Android RSS parsing - Google News RSS feeds are not “most recent” as opposed to search results. How to solve?

坚强是说给别人听的谎言 提交于 2019-12-11 09:26:04
问题 1) Check this news output link: www.google.com/search?q=example&num=10&hl=en&gl=us&authuser=0&tbm=nws&source=lnt&sbd:1&sa=X&ved=0CBUQpwVqFQoTCJi2r5XYl8gCFYeNDQodbDQF1g&biw=1242&bih=599&dpr=1.1 The parameters used are tbs=sbd:1, &tbm=nws&source=lnt - This SHOULD give you a time-sorted list of news. The most recent at the top. (Sorted by date as the parameter - sbd:1). However, when you click it, it goes back to sorted by relevance for some reason. Please check the meaning of URL tags here:

HXT: Can an input change with the arrow syntax?

醉酒当歌 提交于 2019-12-11 09:24:50
问题 With the following code {-# LANGUAGE Arrows #-} {-# LANGUAGE NoMonomorphismRestriction #-} import Text.XML.HXT.Core parseXml :: IOSArrow XmlTree XmlTree parseXml = getChildren >>> getChildren >>> proc x -> do y <- x >- hasName "item" returnA -< x main :: IO () main = do person <- runX (readString [withValidate no] "<xml><item>John</item><item2>Smith</item2></xml>" >>> parseXml) putStrLn $ show person return () I get the output [NTree (XTag "item" []) [NTree (XText "John") []]] So it seems

Remove “xmlns:py…” with lxml.objectify

寵の児 提交于 2019-12-11 09:23:15
问题 I just discovered lxml.objectify which seems nice and easy for reading/writing simple XML files. Firstly, is it a good idea to use lxml.objectify ? For instance is it mature and still developed and likely to be available in the future? Secondly, how do I prevent objectify from addding markup like xmlns:py="http://codespeak.net/lxml/objectify/pytype" py:pytype="str" in the output below ?. Input : config.xml <?xml version="1.0" encoding="utf-8"?> <Test> <MyElement1>sdfsdfdsfd</MyElement1> <

XML parse by id help

狂风中的少年 提交于 2019-12-11 09:16:51
问题 XML newbie, have no idea what I'm doing. I need a well explained, simple way to do this please. From a previous page I use query strings to get an id example: test.php?id=AT I need to display all the employee names within the department that they select. Below is a snipit of my XML document. <SOT> <DEPARTMENT name="Aviation Technology" id="AT"> <EMPLOYEE type="Faculty"> <LOGIN>bdbowen</LOGIN> <PASSWORD>bdbowen</PASSWORD> <NAME>John J. Doe</NAME> <IMAGE>images/faculty/bdbown.jpg</IMAGE>

Python get XML siblings into dictionary

一个人想着一个人 提交于 2019-12-11 09:09:35
问题 I have an xml that looks like this: <root> <G> <G1>1</G1> <G2>some text</G2> <G3>some text</G3> <GP> <GP1>1</GP1> <GP2>a</GP2> <GP3>a</GP3> </GP> <GP> <GP1>2</GP1> <GP2>b</GP2> <GP3>b</GP3> </GP> <GP> <GP1>3</GP1> <GP2>c</GP2> <GP3>c</GP3> </GP> </G> <G> <G1>2</G1> <G2>some text</G2> <G3>some text</G3> <GP> <GP1>1</GP1> <GP2>aa</GP2> <GP3>aa</GP3> </GP> <GP> <GP1>2</GP1> <GP2>bb</GP2> <GP3>bb</GP3> </GP> <GP> <GP1>3</GP1> <GP2>cc</GP2> <GP3>cc</GP3> </GP> </G> <G> <G1>3</G1> <G2>some text</G2

WebClient() never reaching DownloadStringCompleted on WPF application

半腔热情 提交于 2019-12-11 09:06:04
问题 So I'm confused, about why my WebClient is not accessing its DownloadStringCompleted . After reading the possible problems that the WebClient is being disposed, before it can finish its download. Or that exceptions are not being caught during DownloadData or that simply the Uri is inaccessible. I've checked against all these problems, and my WebClient has not yet accessed its DownloadStringCompleted . PMID WebClient Class /// <summary> /// Construct a new curl /// </summary> /// <param name=

XSLT Transformation of Google product feed xml

给你一囗甜甜゛ 提交于 2019-12-11 09:02:57
问题 I have a Google Product feed XML that I need to perform an XSLT transform on to convert to a new format that is compatible with an affiliate network. I can extract title, description and link but cannot figure out how to reference values such as g:id or g:condition. Any help greatly appreciated. Here is source XML: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <rss xmlns:g="http://base.google.com/ns/1.0" version="2.0"> <channel> <item> <g:id>B1005778</g:id> <title>Butterfly Twists

How to make an XML Serializable? [closed]

女生的网名这么多〃 提交于 2019-12-11 08:55:57
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago . I had an XML File that I needed to serialize. I used VS feature Paste Special->Convert XML to C# Classes feature and got the C# classes for that XML file. The C# file for the XML has Multiple Classes as shown in the image below: The generated C# of XML has the following structure [System.Xml

Python ElementTree XML IOError: [Errno 22] invalid mode ('rb') or filename

独自空忆成欢 提交于 2019-12-11 08:47:27
问题 With the following code: import xml.etree.cElementTree as ET tree = ET.parse(r'https://apitest.batchbook.com/api/v1/people.xml?auth_token=GR5doLv88FrnLyLGIwok') I get the error message: IOError Traceback (most recent call last) <ipython-input-10-d91d452da3e7> in <module>() ----> 1 tree = ET.parse(r'https://apitest.batchbook.com/api/v1/people.xml?auth_token=GR5doLv88FrnLyLGIwok') <string> in parse(source, parser) <string> in parse(self, source, parser) IOError: [Errno 22] invalid mode ('rb')