xml-parsing

android DOM parsing with entities in tags

蹲街弑〆低调 提交于 2019-12-20 07:32:39
问题 I might like to parse the following XML that contains entrities. <node> <text><title>foo fo <BR>bar bar </title></text> </node> The parsing works. But after the entrities I do not receive any output. Using CDATA is not possible at the position. I'm using the following code: urlConnection.getInputStream()); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setExpandEntityReferences(false); DocumentBuilder builder = factory.newDocumentBuilder(); doc = builder.parse

xml-flow NPM package - Unexpected XML Parsing Behaviour

纵然是瞬间 提交于 2019-12-20 07:31:58
问题 Background I am using xml-flow npm package to parse XML using streams. Issue is that the xml nodes are getting parsed in an unexpected way. My intention is to parse a huge XML file using a repeating xml node. The XML file can be any URL and the repeating node will be provided from UI. I tried to use the options with all possible values but the parsing behaviour doesn't seem to change. Sample Code I used following sample XML - <list> <item> <details> <id>1</id> </details> </item> <item>

Extracting the values from a xml url

非 Y 不嫁゛ 提交于 2019-12-20 07:08:29
问题 I need to print the values inside Identificador tags from this Url https://clip.unl.pt/sprs?lg=pt&year=2013&uo=97747&srv=rsu&p=1&tp=s&md=3&rs=8145&it=1030123459, but I get no output at all. function get_xmlcontent(StdClass $data) { $year = $data->year; $course = $data->clipid; $typeperiod = $data->typeperiod; if ($typeperiod == 's'||$typeperiod == 'a') { $period = $data->period; } else if ($typeperiod == 't') { $period = $data->trimester; } //file from CLIP $xmlUrl = 'https://clip.unl.pt/sprs

Splitting Xml Document according to node

痴心易碎 提交于 2019-12-20 06:40:09
问题 My xml document looks like .. (its actually a kml file for google map..) <kml xmlns="http://www.opengis.net/kml/2.2"> <Document> <Folder> <Name>Folder1</Name> <Placemark> <Name>Placemark1Folder1</Name> <LookAt> <longitude>-122.0839597145766</longitude> <latitude>37.42222904525232</latitude> </LookAt> </Placemark> <Placemark> <Name>Placemark2Folder1</Name> <LookAt> <longitude>-101.083959</longitude> <latitude>26.422</latitude> </LookAt> </Placemark> </Folder> <Folder> <Name>Folder2</Name>

Using C#, how can we pull attribute values from an XML Schema file and output that onto a CSV file?

♀尐吖头ヾ 提交于 2019-12-20 06:31:04
问题 I am trying to pull the attribute values for each of the element, that is in this XMl Schema file. 回答1: you can use System.Xml.Linq to get all the elements and the required attributes as below XDocument document = XDocument.Load(@"D:\New Text Document.xml"); var eleCollection = document.Elements("element"); foreach (var element in eleCollection) { var type = element.Attribute("Type").Value; } 回答2: This is easiest way one can use for loops on nodes to get the information in each node. use node

Parsing XML with multiple namespaces

随声附和 提交于 2019-12-20 06:27:02
问题 So I wanted to parse this XML: <?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <requestContactResponse xmlns="http://webservice.foo.com"> <requestContactReturn> <errorCode xsi:nil="true"/> <errorDesc xsi:nil="true"/> <id>744</id> </requestContactReturn> </requestContactResponse> </soapenv:Body> </soapenv:Envelope>

Format and combine output of xpath in bash

南笙酒味 提交于 2019-12-20 06:14:56
问题 I'm trying to parse this xml input using the bash utility xpath : <?xml version="1.0" encoding="UTF-8"?> <feed version="0.3" xmlns="http://purl.org/atom/ns#"> <entry> <title>Title 1</title> <author>Author 1</author> </entry> <entry> <title>Title 2</title> <author>Author 2</author> </entry> </feed> I need an output in this format: 1. Title: Title 1 Author: Author 1 2. Title: Title 2 Author: Author 2 I've fiddled around a lot trying to achieve this in a simple way (using only a single xpath

Parsing blank XML tags with LXML and Python

跟風遠走 提交于 2019-12-20 06:12:47
问题 When parsing XML documents in the format of: <Car> <Color>Blue</Color> <Make>Chevy</Make> <Model>Camaro</Model> </Car> I use the following code: carData = element.xpath('//Root/Foo/Bar/Car/node()[text()]') parsedCarData = [{field.tag: field.text for field in carData} for action in carData] print parsedCarData[0]['Color'] #Blue This code will not work if a tag is empty such as : <Car> <Color>Blue</Color> <Make>Chevy</Make> <Model/> </Car> Using the same code as above: carData = element.xpath('

Error thrown with Microsoft.XMLDOM XML Parser in Edge with XML string content

北战南征 提交于 2019-12-20 05:41:37
问题 I'm getting the following error with the Microsoft.XMLDOM XML parser in Microsoft EDGE: Script(1,1) Sometimes it says start tag does not match end tag . And other times it gives another error. I wish I could provide the actual error messages but I'm away from a Windows machine and this is what I remember from memory. The exact same XML content works in Firefox and other browsers. Can anyone see what is going on? This could be an easy fix but again I don't have a Windows computer. Here is my

sax parser stringbuilder only returning one line [duplicate]

风格不统一 提交于 2019-12-20 05:22:21
问题 This question already has an answer here : Java Sax Parser only returning one line of a tag (1 answer) Closed 6 years ago . I've tried using a StringBuilder named object, but I'm still not getting all the CDATA from the description tag.The xml is located at Events-Ovations365: Basically it only gets the CDATA on one line: img is :http://www.ovations365.com/sites/ovations365.com/images/org/81/newtown_medium.jpg alt="Ocmulgee Heritage Trail Ribbon Cutting"> package com.example.ovations_proj;