xml-parsing

Extracting data from XML using Java

元气小坏坏 提交于 2019-12-22 11:14:03
问题 I have the following XML code: <CampaignFrameResponse xmlns="http://Qsurv/api" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Message>Success</Message> <Status>Success</Status> <FrameHeight>308</FrameHeight> <FrameUrl>http://delivery.usurv.com?Key=a5018c85-222a-4444-a0ca-b85c42f3757d&ReturnUrl=http%3a%2f%2flocalhost%3a8080%2feveningstar%2fhome</FrameUrl> </CampaignFrameResponse> What I'm trying to do is extract the nodes and assign them to a variable. So for example, I'd have a

Commenting and uncommenting XML via Python

末鹿安然 提交于 2019-12-22 11:10:08
问题 I would like to know of a way to comment and uncomment an element in XML using Python. <target depends="create-build-dir" name="build-Folio"> <property name="project.name" value="Folio"/> <ant antfile="build.xml" dir="Folio/FolioUI" inheritall="false" target="package"/> <ant antfile="build.xml" dir="Folio/Folio" inheritall="false" target="package"/> </target> How can I get it to look like this: <target depends="create-build-dir" name="build-Folio"> <property name="project.name" value="Folio"/

AdMob in android “AdView missing required XML attribute 'adSize' ”

我们两清 提交于 2019-12-22 09:09:48
问题 I am trying to implement AdMob in my Application. But dont know somehow its showing this error and my R.java file is not being generated due to it. I have tried all the ways to solve this problem, like Clean,Build, Build All. But non is working for me. Following my code snippet in which its showing error "Error in parsing XML: Unbound prefix" <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com

xml parsing in python using ElementTree

无人久伴 提交于 2019-12-22 08:57:46
问题 I'm very new to python and I need to parse some dirty xml files which need sanitising first. I have the following python code: import arff import xml.etree.ElementTree import re totstring="" with open('input.sgm', 'r') as inF: for line in inF: string=re.sub("[^0-9a-zA-Z<>/\s=!-\"\"]+","", line) totstring+=string data=xml.etree.ElementTree.fromstring(totstring) print data file.close which parses: <!DOCTYPE lewis SYSTEM "lewis.dtd"> <REUTERS TOPICS="YES" LEWISSPLIT="TRAIN" CGISPLIT="TRAINING

How do you move an attribute in the first child of a parent to the parent in XSLT?

蹲街弑〆低调 提交于 2019-12-22 08:27:13
问题 I'm a beginner to XSLT, I'm trying to convert flash Text Format into HTML based format There are <LI></LI> blocks in the source xml and all <LI> blocks contains 1 or many <FONT> nodes. I need to apply the styles of the <FONT> in inline css to the <LI> and remove the <FONT> node (first FONT child). ( Example for explanation only - start ) From: <LI> <FONT FACE="Lato" SIZE="24" COLOR="#F7941D" LETTERSPACING="0" KERNING="0"> <I>ertrr</I> <FONT SIZE="12" COLOR="#4B4B4B">sdfsd</FONT> </FONT> </LI>

Replace specific node value in xml using php

谁说胖子不能爱 提交于 2019-12-22 06:34:46
问题 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<

Address Out of bounds error when reading xml

左心房为你撑大大i 提交于 2019-12-22 06:11:16
问题 I am getting a weird segfault when using libxml to parse a file. This code worked previously when I compiled it as a 32bit application. I changed it to a 64 bit application and it stops working. The seg fault comes in at "if (xmlStrcmp(cur->name, (const xmlChar *) "servers"))" cur->name is a const xmlChar * and it points to an address that says its out out bounds. But when I debug and go to that memory location, that data is correct. int XmlGetServers() { xmlDocPtr doc; xmlNodePtr cur; doc =

xml.etree.ElementTree get node depth

ぃ、小莉子 提交于 2019-12-22 03:46:39
问题 The XML: <?xml version="1.0"?> <pages> <page> <url>http://example.com/Labs</url> <title>Labs</title> <subpages> <page> <url>http://example.com/Labs/Email</url> <title>Email</title> <subpages> <page/> <url>http://example.com/Labs/Email/How_to</url> <title>How-To</title> </subpages> </page> <page> <url>http://example.com/Labs/Social</url> <title>Social</title> </page> </subpages> </page> <page> <url>http://example.com/Tests</url> <title>Tests</title> <subpages> <page> <url>http://example.com

Android REST XML result to Listview

喜你入骨 提交于 2019-12-22 01:48:35
问题 I have a REST web service that returns an xml result like this: - <MyCategories xmlns="http://schemas.datacontract.org/2004/07/ceva" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> - <Category> <CategoryName>First category</CategoryName> <Id>1</Id> </Category> - <Category> <CategoryName>Second category</CategoryName> <Id>2</Id> </Category> - <Category> <CategoryName>Third category</CategoryName> <Id>3</Id> </Category> </MyCategories> I acces the web service like this: HttpClient

XML into JSON conversion in iOS

时间秒杀一切 提交于 2019-12-22 01:43:15
问题 I need to convert XML response to JSON and sand to the json To javaScript code. My XML response: <cell> <Result>True</Result> <sguid>02291c402-2220-422b-b199-f92f22e56d2f</sguid> </cell> I am using XMLReader supporting file from this site: XMLReader I am using this code to convert XML to JSON : + (NSString*) XMLToJson:(CXMLDocument *)xmlDocument { NSError *error = nil; NSArray *resultNodes = [xmlDocument nodesForXPath:@"//cell" error:&error]; if(error) NSLog(@"%@",error.description); CXMLNode