xml-parsing

xslt xml getting first occurrence and merging the tags

徘徊边缘 提交于 2020-01-06 05:41:05
问题 Below is the XML and I am looking for output as below Input XML (xml version="1.0") <dynamic> <rpc xmlns="http://namespace/example" > <route> <table> <tablename>employee</tablename> <count>20</count> </table> <table> <tablename>employee</tablename> <count> 21</count> <rt> 1</rt> <rt> 2</rt> <rt> 3</rt> <rt> 4</rt> </table> <table> <tablename>dept</tablename> <count>20</count> <rt> a</rt> <rt> b</rt> <rt> c</rt> </table> <table> <tablename>dept</tablename> <count>44</count> <rt> d</rt> <rt> e<

Different behaviour between “new XmlTextReader” and “XmlReader.Create”

帅比萌擦擦* 提交于 2020-01-06 03:00:45
问题 Given the following source code: using System; using System.IO; using System.Xml; using System.Xml.Schema; namespace TheXMLGames { class Program { static void Main(string[] args) { XmlReaderSettings settings = new XmlReaderSettings { Async = false, ConformanceLevel = ConformanceLevel.Fragment, DtdProcessing = DtdProcessing.Ignore, ValidationFlags = XmlSchemaValidationFlags.None, ValidationType = ValidationType.None, XmlResolver = null, }; string head = File.ReadAllText("sample.xml"); Stream

How to separate img tags in description of xml (RSS FEED)

大城市里の小女人 提交于 2020-01-06 02:58:06
问题 I am unable to retrieve images from RSS feeds i.e., in description. I am using the following code to retrieve information. var rssFeed = from el in doc.Elements("rss").Elements("channel").Elements("item") orderby datetime(el.Element("pubDate").Value) descending select new { Title = el.Element("title").Value, Link = el.Element("link").Value, Description =el.Element("description").Value, PubDate = datetime(el.Element("pubDate").Value), }; When Description is being displayed, both text and image

lxml xml parsing with html tags inside xml tags

本秂侑毒 提交于 2020-01-05 13:14:13
问题 <xml> <maintag> <content> lorem <br>ipsum</br> <strong> dolor sit </strong> and so on </content> </maintag> </xml> The xml file that i regularly parse, may have html tags inside of content tag as shown above. Here how i parse the file: parser = etree.XMLParser(remove_blank_text=False) tree = etree.parse(StringIO(xmlFile), parser) for item in tree.iter('maintag'): my_content = item.find('content').text #print my_content #output: lorem as a result it results my_content = ' lorem ' instead of

how should I go about converting xml into csv

牧云@^-^@ 提交于 2020-01-05 12:03:09
问题 I am trying to take some xml code, a sample being below: <time_report> <project_ID>4</project_ID> <project_status>close</project_status> <client_ID>6001</client_ID> <time_record> <project_start_time>15:02:33</project_start_time> <project_end_time>15:07:44</project_end_time> <project_total_time>PT00H05M11S</project_total_time> </time_record> <employee_ID>10001</employee_ID> <employee_name>Mary Beth</employee_name> <date_created>2009-08-25</date_created> </time_report> and then output it so it

Xpath find files for windows? xml parser to find files in windows

烂漫一生 提交于 2020-01-05 08:53:20
问题 So we have 1500 xhtml pages in lets say 100 subfolders of /myfolder. I want to find evil constellations of <goodTag> .... <evilTag/> .... <evilTag/> .... </goodTag> In my current case, it is only allowed to have <goodTag> .... <evilTag/> ... </goodTag> and not 2 evil Tags within a good Tag. This is just an example though. Sometimes I must search for something like <outter> .... <someTag someAttribute="iDoEvil" /> ... </outter> I've been browsing for a while now and could not find a tool which

Simplexml_load_file errors

依然范特西╮ 提交于 2020-01-05 08:18:34
问题 I'm triying to parse this address in PHP $url = 'http://pubapi.yp.com/search-api/search/devapi/search?searchloc=91203&term=pizza&format=xml&sort=distance&radius=5&listingcount=10&key=t266jc29dx' ; $x1 = simplexml_load_file($url); But here's what I keep getting Warning: simplexml_load_file(http://pubapi.yp.com/search-api/search/devapi/search?searchloc=91203): failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in... As you can see I'm only getting part of the url

How to return data from xml file

拜拜、爱过 提交于 2020-01-05 08:12:03
问题 How to return data from product-lineitems. I mean: Quantity, Quantity-unit I expect: Product-Id unit quantity tax-rate 0001 BOX 1.0 0.23 0002 PCS 1.0 0.23 I am trying like that: But it's return duplicate rows :( WITH XMLNAMESPACES(DEFAULT N'www address') SELECT o.value(N'(current-order-no/text())[1]',N'varchar(10)') AS OrderNo , n.value(N'(quantity/text())[1]',N'varchar(10)') AS Qty , u.value(N'@unit',N'varchar(10)') AS Unit FROM dbSupply.dbo.MyXmlTable t CROSS APPLY t.XMLData.nodes(N'/orders

Large XML Parsing Efficiently

我与影子孤独终老i 提交于 2020-01-05 08:06:52
问题 I need to parse large XML Files and save data to MS SQL DB Tables. One way obviously to write C# Program. Obviously this raise a question of performance. Do you know any fastest and efficient way to process large scale XML? 回答1: If you want to pursue a C# solution, look into XmlReader . This will give you forward only streaming access to your XML file. Note the forward only part. If you need to do more complex manipulations for child nodes, you'd probably do well to use a combination of

Large XML Parsing Efficiently

江枫思渺然 提交于 2020-01-05 08:05:51
问题 I need to parse large XML Files and save data to MS SQL DB Tables. One way obviously to write C# Program. Obviously this raise a question of performance. Do you know any fastest and efficient way to process large scale XML? 回答1: If you want to pursue a C# solution, look into XmlReader . This will give you forward only streaming access to your XML file. Note the forward only part. If you need to do more complex manipulations for child nodes, you'd probably do well to use a combination of