xml-parsing

Replace text holder with image in OpenXML

蹲街弑〆低调 提交于 2019-12-10 20:22:07
问题 Below I have code that inserts an image at the end of a document in word using OpenXML. What I need to do is try and find and item called [Image Holder] within the document and replace that with the image I'm passing over. Here is the current code that adds it to the end of a document var element = new Drawing( new DW.Inline( new DW.Extent() { Cx = 990000L, Cy = 792000L }, new DW.EffectExtent() { LeftEdge = 0L, TopEdge = 0L, RightEdge = 0L, BottomEdge = 0L }, new DW.DocProperties() { Id =

Keeping attributes when converting XML to Ruby hash

落花浮王杯 提交于 2019-12-10 20:04:13
问题 I have a large XML document I am looking to parse. In this document, many tags have different attributes within them. For example: <album> <song-name type="published">Do Re Mi</song-name> </album> Currently, I am using Rail's hash-parsing library by requiring 'active_support/core_ext/hash' . When I convert it to a hash, it drops the attributes. It returns: {"album"=>{"song-name"=>"Do Re Mi"}} How do I maintain those attributes, in this case, the type="published" attribute? This seems to have

Assign CSS class to HTML tags generated with SQL 'FOR XML'

末鹿安然 提交于 2019-12-10 19:53:23
问题 I am getting table rows and table data (with HTML tags) from SQL using 'FOR XML'. Is there a way I could assign CSS classes to the html tags in SQL? What I am currently getting: <tr><td>Name</td><td>Value</td></tr> SQL query: SELECT (SELECT [Name] as [td] FOR XML PATH(''), type), (SELECT [Value] as [td] FOR XML PATH(''), type) FROM table FOR XML PATH('tr') Desired output: <tr class="test1"> <td class="test2">Name</td> <td class="test3">Value</td> </tr> 回答1: I know I am answering my own

How to encode '<' & '>' Symbols in XML

北慕城南 提交于 2019-12-10 19:11:31
问题 Since < & > as part of XML syntax. How to add these symbols as part of the data like <Note>Have to have <> symbols</Note> I have heard there are different types of data in which XML can be sent like CDATA etc, since character data parses each character it doesn't allow these symbols. I do know about < and > but that isn't helpful. Are there are any modes of data in which XML can be sent to avoid any tool recognizing the symbols? 回答1: There are two ways to represent characters which have

Parsing XML with PHP

廉价感情. 提交于 2019-12-10 18:49:15
问题 I'm trying to parse a jobs feed using PHP's SimpleXML. I've only used JSON before and am having problems getting the parser to work. Here's some sample data: <shrs> <rq url="http://api.simplyhired.com/a/jobs-api/xml_v2/q-comission"> <t>Comission Jobs</t> <dt>2011-02-18T23:58:38Z</dt> <si>0</si> <rpd>10</rpd> <tr>192</tr> <tv>146</tv> <em url=""/> <h> <kw pos="1"/> </h> </rq> <rs> <r> <jt>Virtual Recruiter (IT) - Comission ...</jt> <cn url="">Remedy Intelligent Staffing</cn> <src url="http:/

Passing XML resource to XMLReader

一个人想着一个人 提交于 2019-12-10 18:45:21
问题 I am trying to pass a .xml file from my res folder to an XMLReader in order to parse it to an object: private void parseXML() { String parsedData = ""; try { Log.w("AndroidParseXMLActivity", "Start"); /** Handling XML */ SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); QuestionXMLHandler myXMLHandler = new QuestionXMLHandler(); xr.setContentHandler(myXMLHandler); InputSource inStream = new InputSource(); Log.w(

IOS How to find full rss feed link with nsscanner class

半世苍凉 提交于 2019-12-10 18:29:10
问题 I am working on fetching data from rss feed based project.From searching on google i found that generally RSS link found in this format in source of HTML. <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="http://feeds.abcnews.com/abcnews/topstories" /> so, I have to use nsscanner class to find the link of RSS feed from HTML source. but i don't know proper pattern and which i have to set scanUpToString: and haracterSetWithCharactersInString: or etc. So, please help me how

Read value from a complex XML structure using SQL Server

爷,独闯天下 提交于 2019-12-10 18:17:15
问题 I am trying to read a value in a SQL Server query out of a XML structure from a column of datatype ntext . This is the XML structure from which I want to extract VALUE TO READ!!! : <PrinterProcessDef xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://dev.docuware.com/settings/workflow/processdef" Id="3e62848d-040e-4f4c-a893-ed85a7b2878a" Type="PrinterProcess" ConfigId="c43792ed-1934-454b-a40f-5f4dfec933b0" Enabled="true" PCId=

How can I extract info from xml page with R

自作多情 提交于 2019-12-10 18:16:33
问题 I'm trying to get all the info from this page: http://ws.parlament.ch/affairs/19110758/?format=xml First I download the file into file and parse it then with xmlParse(file) . download.file(url = paste0(http://ws.parlament.ch/affairs/19110758/?format=xml), destfile = destfile) file <- xmlParse(destfile[]) I now want to extract all the information I need. For example the title and the ID-number. I tried something like this: title <- xpathSApply(file, "//h2", xmlValue) But this gives me only an

How to get only the top level node's text content with getTextContent()

拜拜、爱过 提交于 2019-12-10 17:55:35
问题 I'm trying to get just the top level text and none of the child text. So I have the following xml: <job> text1 <input> text2 </input> </job> and I would like to only get the parent(text1) text. So in this example I would do node.getTextContent(); and get text1 , not text1text2 which getTextContent is currently giving me. Now I've read the man pages and I know they say that getTextContent returns the concatenated string of all the children with the parent. But I would just like the text from