xml

Highlight parents in xml string

Say I have: <ul> <li id="x"> <a href="x">x</a> </li> <li id="y"> <a href="y">y</a> <ul> <li id="z"> <a href="z">z</a> </li> </ul> </li> </ul> I want to add a class value to all the list items that are the parents of z. So, I want to modify y but ...

Is it possible for SelectNodes on an XmlDocument to return null?

Is it possible for SelectNodes() called on an XmlDocument to return null? My predicament is that I am trying to reach 100% unit test code coverage; ReSharper tells me that I need to guard against a null return from the SelectNodes() method, but I can see no way that an XmlDocument can return null (and therefore, no way to test my guard ...

How to I merge XML from distinct DomDocuments.

What is the easiest way to merge Xml from two distinct Dom Documents? Is there a way other than using the Canonical DataReader approach and then messing with the outputted DOM. What I basically want is to AppendChild to XmlElements without getting: "The node to be inserted is from a different document context." Here is c# code that I ...

How to setup a RAILS integration test for XML mehtods

Given a controller method like: def show @model = Model.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => model } end end What's the best way to write an integration test that asserts that the return has the expected XML? ...

Best way to transfer an xml to SQL Server?

I have been hearing the podcast blog for a while, I hope I dont break this. The question is this: I have to insert an xml to a database. This will be for already defined tables and fields. So what is the best way to accomplish this? So far I am leaning toward programatic. I have been seeing varios options, one is Data Transfer Objects (...

How to load an xml string in the code behind to databound UI controls that bind to the XPath of the XML?

Every sample that I have seen uses static XML in the xmldataprovider source, which is then used to databind UI controls using XPath binding. Idea is to edit a dynamic XML (structure known to the developer during coding), using the WPF UI. Has anyone found a way to load a dynamic xml string (for example load it from a file during runtim...

XmlSerializer - There was an error reflecting type

Using C# .NET 2.0, I have a composite data class that does have the [Serializable] attribute on it. I am creating an XMLSerializer class and passing that into the constructor: XmlSerializer serializer = new XmlSerializer(typeof(DataClass)); I am getting an exception saying: There was an error reflecting type. Inside the data class t...

Empty namespace using Linq Xml

I'm trying to create a sitemap using Linq to Xml, but am getting an empty namespace attribute, which I would like to get rid of. e.g. XNamespace ns = "http://www.sitemaps.org/schemas/sitemap/0.9"; XDocument xdoc = new XDocument(new XDeclaration("1.0", "utf-8", "true"), new XElement(ns + "urlset", new XElement("url", ne...

The Best Way to shred XML data into SQL Server database columns

What is the best way to shred XML data into various database columns? So far I have mainly been using the nodes and value functions like so: INSERT INTO some_table (column1, column2, column3) SELECT Rows.n.value('(@column1)[1]', 'varchar(20)'), Rows.n.value('(@column2)[1]', 'nvarchar(100)'), Rows.n.value('(@column3)[1]', 'int'), FROM @x...

How to update large XML file

Rather than rewriting the entire contents of an xml file when a single element is updated, is there a better alternative to updating the file? ...

How can I get Axis 1.4 to not generate several prefixes for the same XML namespace?

I am receiving SOAP requests from a client that uses the Axis 1.4 libraries. The requests have the following form: <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"&gt; <soa...

What is the lowest-cost, cross-platform approach to parse XML using ksh?

Need to parse some basic XML (one root element, 3-4 subelements, 1-3 attributes each) from a ksh script (ideally stick to ksh, given the script already exists and it's just trying to read some extra configuration created in XML by another program). I know I can use sed and do pattern matching, but it's not foolproof given that the input...

Seaching for a good XML Diff Tool

A good XML diff tool: - Has a clear, node driven, GUI - Accepts Command line (For easy Version Control integration) - Can handle large files - Is low cost ...

Saving Java Object Graphs as XML file

What's the simplest-to-use techonlogy available to save an arbitrary Java object graph as an XML file (and to be able to rehydrate the objects later)? ...

How to Convert ISO 8601 Duration to TimeSpan in VB.Net?

Is there a standard library method that converts a string that has duration in the standard ISO 8601 Duration (also used in XSD for its duration type) format into the .NET TimeSpan object? For example, P0DT1H0M0S which represents a duration of one hour, is converted into New TimeSpan(0,1,0,0,0). A Reverse converter does exist which wor...

Importing XML file in Rails app, UTF-16 encoding problem

I'm trying to import an XML file via a web page in a Ruby on Rails application, the code ruby view code is as follows (I've removed HTML layout tags to make reading the code easier) <% form_for( :fmfile, :url => '/fmfiles', :html => { :method => :post, :name => 'Form_Import_DDR', :enctype => 'multipart/form-data' } ) do |f| %> <%= f.fil...

Is there a way to "diff" two XMLs element-wise?

I'm needing to check the differences between two XMLs but not "blindly", Given that both use the same DTD, I'm actually interested in verifying wether they have the same amount of elements or if there's differences. ...

What do I need to manage XML files?

I believe I need a DTD to define the schema and an XSLT if I want to display it in a browser and have it look "pretty". But I'm not sure what else I would need to have a well-defined XML document that can be queried using XQuery and displayed in a web browser. ...

Where can i find the XML schema (XSD-file) for the Glade markup language?

As stated in the title, i'm looking for an XML schema (XSD-file) for the Glade markup language? Wikipedia states that Glade is a schema based markup language (list of schemas at wikipedia). I tried to search the web, wikipedia and the glade website,but i couldn't find an XSD for Glade. Thx, Juve ...

Is it possible to pass a parameter to XSLT through a URL when using a browser to transform XML?

When using a browser to transform XML (Google Chrome or IE7) is it possible to pass a parameter to the XSLT stylesheet through the URL? example: data.xml <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="sample.xsl"?> <root> <document type="resume"> <author>John Doe</author> </document> ...