xml

problem with XslCompiledTransform debugging in c#

i've tried and tried and tried but i cannot manage to step into the XslCompiledTransform without having to load the stylesheet from disk (by passing a URI into the XslCompiledTransform.Load() method). I am fully aware that you can only step into the XslCompiledTransform.Transform() method if you loaded the stylesheet from disk via URI (...

What's the best way to export UTF8 data into Excel?

So we have this web app where we support UTF8 data. Hooray UTF8. And we can export the user-supplied data into CSV no problem - it's still in UTF8 at that point. The problem is when you open a typical UTF8 CSV up in Excel, it reads it as ANSII encoded text, and accordingly tries to read two-byte chars like ø and ü as two separate charact...

Show XML file in WinForms app with IE-like coloring and collapsing nodes

I would like to show an XML file in my .NET 2.0 WinForms app just like IE does (where you can collapse the nodes, and everything is nicely colored). Is there a built-in way to do this? ...

Get the XPath to an XElement?

I've got an XElement deep within a document. Given the XElement (and XDocument?), is there an extension method to get its full (i.e. absolute, e.g. /root/item/element/child) XPath? E.g. myXElement.GetXPath()? EDIT: Okay, looks like I overlooked something very important. Whoops! The index of the element needs to be taken into account. S...

How to make DOMDocument write standalone=yes in PHP?

I'm using PHP5 to create XML files. I have code like this: $doc = new DOMDocument(); ... $xml_content = $doc->saveXML(); The problem is that created XML code starts with a root node like this one: <?xml version="1.0"?> But I want it to be like this: <?xml version="1.0" standalone="yes" ?> I guess I need to call some function on ...

Is there a good reason to configure hibernate with XML rather than via annotations?

I've been using Hibernate for a few years but have only used it with annotations, and by setting the connection parameters in my code. Am I "missing something" by not using the XML files? Are there important capabilities available only in XML? Are there situations or patterns where it makes sense to use the XML? ...

What is the practical difference between xml, json, rss and atom when interfacing with Twitter?

I'm new to web services and as an introduction I'm playing around with the Twitter API using the Twisted framework in python. I've read up on the different formats they offer, but it's still not clear to me which one I should use in my fairly simple project. Specifically the practical difference between using JSON or XML is something I'd...

Best pratice to save application settings in Windows application

What I want to achieve is very simple: I have a WinForms (.NET 3.5) application that uses a path for reading information. This path can be modified by the user, by using the Options form I provide. Now, I want to save the path value to a file for later use. This would be one of the many settings saved to this file. This file would sit d...

Select first instance only with XPath?

I am parsing some XML something like this: <root> <some_gunk/> <dupe_node> ... stuff I want ... </dupe_node> <bits_and_pieces/> <other_gunk/> <dupe_node> ... stuff I don't want ... </dupe_node> <more_gunk/> </root> An XPath of '//dupe_node' will give me tw...

C# Settings Management

I feel like I am always reinventing the wheel for each application when it needs to load/save general settings to an xml file. What is the best way to manage basic application settings that the user can adjust and need to be saved/restored? ...

C#: capture data, display to user, save to disk, upload to database: BEST approach

I have a program that captures live data from a piece of hardware on a set interval. The data is returned as XML. There are several things I would like to do with this data (in order): -display it to user -save it to disk -eventually, upload it to database My current approach is to take the XML, parse it into a hashtable so I can disp...

multiple resultsets in c# MVC

I am using Asp.NET MVC as a basic webservice for several searchengine type asp/ jquery sites. Database searching is straightforward: Model - Sql Server FullText Sproc returning XML View - N/a Controller - Authorise user/ Parse input return Content (Model.XML) The returned XML contains four resultsets - item list, category breakdown,...

xml to json roundtrip conversion

Has any work been done to provide round trip from xml to json and back again? If so, does anyone have some practical advice for doing this? I understand that you'd probably have to limit the complexity of the schema and json structure, but what's the cost on both sides? And is is too prohibitive. ...

Is there a way to create an Linq XElement iterator that is updated as the tree is modified?

I'm new to both C# and Linq. I'm attempting to use a Linq-generated element collection to iterate over and modify certain elements in a XDocument. My understanding is that the enumeration does not update when the tree is updated. For example, given the document <root xmlns:ns="http://dummy"&gt; <ns:a/> <ns:b/> <c/> <ns:a><ns:a/></ns:...

How do I remove a specific node using its attribute value in PHP XML Dom?

My question is best phrase as: http://stackoverflow.com/questions/262351/remove-a-child-with-a-specific-attribute-in-simplexml-for-php except I'm not using simpleXML. I'm new to XML for PHP so I may not be doing the best way I have a xml created using the $dom->save($xml) for each individual user. (not placing all in one xml due to un...

What are the advantages of having typed XML columns in SQL server?

From what I've read an XML column in SQL server can be typed (having a schema) or untyped. What are the advantages of using typed XML? Is it just that the XML is validated? ...

Keep HTML tags in XML using LINQ to XML

Hi, I have an xml file from which I am extracting html using LINQ to XML. This is a sample of the file: <?xml version="1.0" encoding="utf-8" ?> <tips> <tip id="0"> This is the first tip. </tip> <tip id="1"> Use <b>Windows Live Writer</b> or <b>Microsoft Word 2007</b> to create and publish content. </tip> <tip id="2"> Enter a <b...

Have XML results in plaintext, want to loop through them in PHP

So I am working with an API that returns results in XML. Let's just say for argument sake I am returned the following: <?xml version="1.0" encoding="UTF-8"?> <Properties> <Property> <Name>Joes Crab Shack</Name> <Address>111 Shack Street</Address> </Property> <Property> <Name>Johns Shoe Store</Name> ...

XmlDocument dropping encoded characters

My C# application loads XML documents using the following code: XmlDocument doc = new XmlDocument(); doc.Load(path); Some of these documents contain encoded characters, for example: <xsl:text>&#10;</xsl:text> I notice that when these documents are loaded, &#10; gets dropped. My question: How can I preserve <xsl:text>&#10;</xsl:tex...

How do I select the last N elements with XPath?

I support a web site which generates content XML that is then translated into web pages using XSLT. I have been asked to create a new stylesheet which will transform the output of the "archive" page into Atom for syndication. The problem I'm running into is that the archive page contains a rather large number of items — 142 and countin...