xml

best java Xml parser to manipulate/edit an existing xml document

TASK : I have an existing xml document (UTF-8) which uses xml namespaces and xml schema. I need to parse to a particular element, append content (that also needs to use xml namespace prefixes) to this element and then write out the Document again. which is the best XML parser library that I should be using for this TASK ? I've see...

How to display only necessary information from xml

I have xml table: <?xml version="1.0" encoding="UTF-8"?> <table> <user> <id>1</id> <info> <more> <nick>John</nick> <adress>blabla</adress> </more> <more> <nick>Mike</nick> <adress>blablabla</adress> <tel>blablabla</tel> </more> </info> </user> <user> <id>2</id> <info> ...

Clearing Only inner text and not the childnodes

I have an xml as below < Image>ImageValue11 <Type>png</Type> <Value>ImageValue11</ Value> </ Image> Here ImageValue1 is present in two places.I want to remove innerText for Image node which is the parent.For which i am usign below code XmlNode customImageNode = imagedoc.SelectSingleNode("//Image"); customImageNode.InnerText = string....

XML Parsing: how to ignore whitespace or enter/return space

hi guys, i have an online xml file filled with items. At startup i check my internet connection, if so, i parse the xml and compare the item objects to those in my sqlite database. One of the item values is 'lastupdated', whichs is a php generated string. if the lastupdated value from the xml item is different from the value of the on...

Using XSLT, how can I produce a table with elements at the position of the the node's attributes?

Given the following XML: <items> <item> <name>A</name> <address>0</address> <start>0</start> <size>2</size> </item> <item> <name>B</name> <address>1</address> <start>2</start> <size>4</size> </item> <item> <name>C</name> <address>2</addre...

Is it legal to have different SOAP namespaces/versions between the request and response?

THIRD EDIT: I now believe that this problem is due to a SOAP version mismatch (1.1 request, 1.2 response) masquerading as a namespace problem. Is it illegal to mix versions, or just bad style? Am I completely out of luck if I can't change my SOAP version or the service's? SECOND EDIT: Clarified error message, and tried to reduc...

Append XML File

I have an XML Template file. This file contains a header and some predefined element Sections. eg: <?xml version="1.0" encoding="utf-8"?> <Sections> <Section PageSize="Letter" PageMargins="35" PagePaddings="5"> <Header Height="130" Repeat="False" > <Image Source="Resources/logo1.b...

Entity references and lxml

Here's the code I have: from cStringIO import StringIO from lxml import etree xml = StringIO('''<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE root [ <!ENTITY test "This is a test"> ]> <root> <sub>&test;</sub> </root>''') d1 = etree.parse(xml) print '%r' % d1.find('/sub').text parser = etree.XMLParser(resolve_entities=False) d2 =...

Contents of a node in Nokogiri

Is there a way to select all the contents of a node in Nokogiri? <root> <element>this is <hi>the content</hi> of my æøå element</element> </root> The result of getting the content of /root/element should be this is <hi>the content</hi> of my æøå element Edit: It seems like the solution is simply to use myElement.inner_html(). Th...

Ordering content from the YouTube API with PHP & XML

I've got a nice little web app working that brings down playlists and videos from YouTube using the API. However, YouTube seems to fire back the playlists in the wrong order. Any idea how I can do that? Here is my very simple PHP code that does everything I need it to do (apart from date ordering) <?php // set feed URL $feedURL = ...

xml schema and vb.net

I have a xml schema file that was supplied by a vendor. At the root, the file has three main elements: Customer, ShipDate, and Items. Once I have added the XSD file to my project, I am not able to access the ShipDate attribute. I am not sure how to handle this. I tried creating a new element for the ShipDate similar to the other elements...

Delete / Remove node from XPathNodeIterator, given an XPath

First of all, if someone has a different, perhaps shorter (or better), solution to the problem, it's welcome as well. I'm trying to "simply" remove (almost) duplicate elements in XSLT. There's some (metadata) nodes i don't want to include when comparing, and i couldn't figure out how do do that in XSLT so thought i'd extend it with a ...

XML parsing problem

I'm having this strange XML parsing problem. I have this XML string I'm trying to parse <?xml version="1.0"?> <response status="success"> <lot>32342</lot> </response> I'm using XPath with Java in order to do this. I'm using the Xpath expression "/response/@status" to find the text "success". However whenever I evaluate this expressi...

How can I insert a variable into an XML Literals comment section and have it evaluated?

How can I get the variable My.Application.Info.Version.ToString to populate in the comments section? Dim Customers As XDocument = <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!--Application Version: <%= My.Application.Info.Version.ToString %>--> <customers>...

How to configure a has_many association with non-ActiveRecord model

My Rails app has a normal ActiveRecord "Account" model stored in the database. The model will store the URL to a remote XML file which defines some other objects. For example, the Account has_many :galleries but the Gallery model is simply defined by nodes in the XML document. So how do I get /accounts/1/galleries to show the galleries...

Data Contract Serialization Not Working For All Elements

I have an XML file that I'm trying to serialize into an object. Some elements are being ignored. My XML File: <?xml version="1.0" encoding="utf-8" ?> <License xmlns="http://schemas.datacontract.org/2004/07/MyApp.Domain"&gt; <Guid>7FF07F74-CD5F-4369-8FC7-9BF50274A8E8</Guid> <Url>http://www.gmail.com&lt;/Url&gt; <ValidKey>true</Valid...

I need a simple command line program to transform XML using an XSL Stylesheet

I am on OSX Snow Leopard (10.6.2) I can install anything I need to. I would preferably like a Python or Java solution. I have searched on Google and found lots of information on writing my own program to do this, but this is a just a quick and dirty experiment so I don't want to invest a lot of time on writing a bunch of code to do this,...

Getting a set of elements using linq

I have the following piece of XML: <xml> <ObsCont xCampo="field1"> <xTexto>example1</xTexto> </ObsCont> <ObsCont xCampo="field2"> <xTexto>example2</xTexto> </ObsCont> <ObsCont xCampo="field3"> <xTexto>example3</xTexto> </ObsCont> </xml> How do I (using linq) get for example what is inside the xTexto...

xpath/xslt to determine index of context node relative to all nodes of same name?

Given the schema below - with a "query" node as the context, is it possible with xpath/xslt to determine the index of that "query" node relative to all "query" nodes in the document (not position() relative to its immediate siblings). TIA, Geoff <section> <name>About</name> <link>about</link> <questions> <questio...

Add new node to xml tree

Hello, I am generating a xml tree: var root = new XElement("Root"); for(int i =0;i<3;i++) { var sub0lvl = new XElement(String.Format("sub{0}",i)); root.Add(sub0lvl); for(int j=0;j<2;j++) { sub0lvl.Add(new XElement(String.Format("subsub{0}",i))); } } This code generate follow xml tree: <Root> <sub0> <subsub...