xml-parsing

Get the values of attributes with namespace, using Nokogiri

我是研究僧i 提交于 2020-01-14 02:22:46
问题 I'm parsing a document.xml file using Nokogiri, extracted from .docx file and need to get values of attributes with names, like " w:val ". This is a sample of the source XML: <w:document> <w:body> <w:p w:rsidR="004D5F21" w:rsidRPr="00820E0B" w:rsidRDefault="00301D39" pcut:cut="true"> <w:pPr> <w:jc w:val="center"/> </w:pPr> </w:body> </w:document> This is a sample of the code: require 'nokogiri' doc = Nokogiri::XML(File.open(path)) doc.search('//w:jc').each do |n| puts n['//w:val'] end There

Get the values of attributes with namespace, using Nokogiri

天大地大妈咪最大 提交于 2020-01-14 02:22:10
问题 I'm parsing a document.xml file using Nokogiri, extracted from .docx file and need to get values of attributes with names, like " w:val ". This is a sample of the source XML: <w:document> <w:body> <w:p w:rsidR="004D5F21" w:rsidRPr="00820E0B" w:rsidRDefault="00301D39" pcut:cut="true"> <w:pPr> <w:jc w:val="center"/> </w:pPr> </w:body> </w:document> This is a sample of the code: require 'nokogiri' doc = Nokogiri::XML(File.open(path)) doc.search('//w:jc').each do |n| puts n['//w:val'] end There

Adding and Removing Xmlnode using Powershell

点点圈 提交于 2020-01-13 07:51:46
问题 I am trying to add and remove elements from multiple xml files. i ran into two issue. it removed empty elements automatically and second it did not remove what i wanted to I have my xml like this <Entity> <App> <item1>1</item1> <emptyItem/> <person> <itemToRemove>true</itemToRemove> <emptyItem/> <otheritem>1</otheritem> </person> <person> <itemToRemove>false</itemToRemove> <emptyItem/> <otheritem>3</otheritem> </person> <person> <itemToRemove>false</itemToRemove> <emptyItem/> <otheritem>3<

XML Parsing - SQL Server

时光总嘲笑我的痴心妄想 提交于 2020-01-13 06:57:07
问题 I have an XML that looks like below: declare @xml xml = '<Margins > <Margin type="type1" currencyCode="currencyCode1"> <MarginRevenue>1.1</MarginRevenue> <MarginRevenue>1.2</MarginRevenue> <MarginRevenue>1.3</MarginRevenue> <MarginCost>2.1</MarginCost> <MarginCost>2.2</MarginCost> <MarginCost>2.3</MarginCost> <MarginValue>3.1</MarginValue> <MarginValue>3.2</MarginValue> <MarginValue>3.3</MarginValue> </Margin> <Margin type="type2" currencyCode="currencyCode2"> <MarginRevenue>1.4<

Using xpath to extract data from an XML column in postgres

荒凉一梦 提交于 2020-01-12 23:22:06
问题 I've made the following table: create table temp.promotions_xml(id serial promotion_xml xml); I've inserted the following data into temp.promotions: <promotions xmlns="http://www.demandware.com/xml/impex/promotion/2008-01-31"> <campaign campaign-id="2013-1st-semester-jet-giveaways"> <description>2013 1st Semester Jet Giveaways</description> <enabled-flag>true</enabled-flag> <start-date>2013-01-01T05:00:00.000Z</start-date> <end-date>2013-07-01T04:00:00.000Z</end-date> <customer-groups>

Using xpath to extract data from an XML column in postgres

末鹿安然 提交于 2020-01-12 23:20:12
问题 I've made the following table: create table temp.promotions_xml(id serial promotion_xml xml); I've inserted the following data into temp.promotions: <promotions xmlns="http://www.demandware.com/xml/impex/promotion/2008-01-31"> <campaign campaign-id="2013-1st-semester-jet-giveaways"> <description>2013 1st Semester Jet Giveaways</description> <enabled-flag>true</enabled-flag> <start-date>2013-01-01T05:00:00.000Z</start-date> <end-date>2013-07-01T04:00:00.000Z</end-date> <customer-groups>

java xml cast Node to Element

跟風遠走 提交于 2020-01-12 14:07:47
问题 I know this was asked many times but I still cannot get it to work. I convert xml string to Document object and then parse it. Here is the code: import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.*; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder; try { builder = factory.newDocumentBuilder(); Document document = builder.parse( new InputSource( new StringReader( result ) ) ); Node head =

Parsing xml to and replacing specific tags shell script

浪子不回头ぞ 提交于 2020-01-12 05:50:10
问题 For the below xml ,I need to replace <studentStatus> for <studentName>CLASSA</studentName> to <studentStatus>failed</studentStatus> . <studentFile> <student> <studentName>CLASSA</studentName> <studentStatus>Success</studentStatus> <studentActions> <studentAction> <studentType>Juniour</studentType> <studentStatus>Completed</studentStatus> <studentMsg/> </studentAction> <studentAction> <studentType>HighSchool</studentType> <studentStatus>Completed</studentStatus> <studentMsg/> </studentAction>

MathML to LaTeX conversion

 ̄綄美尐妖づ 提交于 2020-01-12 04:58:07
问题 I'm trying to figure out how to convert a MathML representation of a math equation and convert it to the LaTeX representation of that math equation. So for example... <math> <mrow> <mfrac> <mrow><mi>x</mi></mrow> <mrow><mi>y</mi></mrow> </mfrac> </mrow> </math> ... is a simple stacked fraction and it's LaTeX representation would be... \frac{x}{y} I'm guaranteed that the MathML has no presentational markup because I am constructing the MathML string dynamically and I control how/where the

Reading RSS feed with jQuery?

烈酒焚心 提交于 2020-01-11 19:40:36
问题 Using the jQuery rss pluging jFeed, and using their example code on their website, I have created the following code which does not seem to work: jQuery.getFeed({ url: 'http://www.hotukdeals.com/rss/hot', success: function(feed) { alert(feed.title); } }); I get a message saying: XMLHttpRequest cannot load http://www.hotukdeals.com/rss/hot. Origin http://intranet is not allowed by Access-Control-Allow-Origin. Anyone know why I am getting this access control message? This rss feed works fine in