xml

Using strings in XML Literals

Hi, I'm a C# developer who's fumbling in the first VB code he's written since VB6, so if I am asking a rather obvious question, please forgive me. I decided to experiment with XML Literals to generate some XML code for me, instead of using XMLDocument I have 2 questions, the second regarding a workaround due to my inability to figure ...

How do I get a value from an XML web service in C#?

In C#, if I need to open an HTTP connection, download XML and get one value from the result, how would I do that? For consistency, imagine the webservice is at www.webservice.com and that if you pass it the POST argument fXML=1 it gives you back <xml><somekey>somevalue</somekey></xml> I'd like it to spit out "somevalue". ...

What usable alternatives to XML syntax do you know?

For me usable means that: it's being used in real-wold it has tools support. (at least some simple editor) it has human readable syntax (no angle brackets please) Also I want it to be as close to XML as possible, i.e. there must be support for attributes as well as for properties. So, no YAML please. Currently, only one matching lan...

Issue reading Xml file into C# DataSet

I was given an .xml file that I needed to read into my code as a DataSet (as background, the file was created by creating a DataSet in C# and calling dataSet.WriteXml(file, XmlWriteMode.IgnoreSchema), but this was done by someone else). The .xml file was shaped like this: <?xml version="1.0" standalone="yes"?> <NewDataSet> <Foo> ...

The best way to validate XML in a unit test?

I have a class with a ToString method that produces XML. I want to unit test it to ensure it is producing valid xml. I have a DTD to validate the XML against. Should I include the DTD as a string within the unit test to avoid a dependency on it, or is there a smarter way to do this? ...

Querying XML columns in SQLServer 2005

There is a field in my company's "Contacts" table. In that table, there is an XML type column. The column holds misc data about a particular contact. EG. <contact> <refno>123456</refno> <special>a piece of custom data</special> </contact> The tags below contact can be different for each contact, and I must query these fragments along...

How to validate an XML file against a schema using Visual Studio 2005

Is it possible to validate an xml file against it's associated schema using Visual Studio 2005 IDE? I could only see options to create a schema based on the current file, or show the XSLT output ...

Best way to search data stored as XML in Sql Server?

Say I have data structures stored as XML (XML data type) within Sql Server. A user wishes to pull out a record if, within the data, a certain string is found. What are my options for implementing this, and which is the best way to do it? Note that each record can have different XML data structures ...

How to easily edit SQL XML column in SQL Management Studio

I have a table with an XML column. This column is storing some values I keep for configuring my application. I created it to have a more flexible schema. I can't find a way to update this column directly from the table view in SQL Management Studio. Other (INT or Varchar for example) columns are editable. I know I can write an UPDATE sta...

How to write java.util.Properties to XML with sorted keys?

I'd like to store a properties file as XML. Is there a way to sort the keys when doing this so that the generated XML file will be in alphabetical order? String propFile = "/path/to/file"; Properties props = new Properties(); /*set some properties here*/ try { FileOutputStream xmlStream = new FileOutputStream(propFile); /*thi...

How do I get an XML file as XML (and not a string) with Ajax in Prototype.js?

This code is from Prototype.js. I've looked at probably 20 different tutorials, and I can't figure out why this is not working. The response I get is null. new Ajax.Request( /path/to/xml/file.xml, { method: "get", contentType: "application/xml", onSuccess: function( transport ) { alert( transport.responseXML ); } })...

Using XSLT, How Do You Insert XML Into an existing XML node

I'm not even sure if it's possible but say I have some XML: <source> <list> <element id="1"/> </list> </source> And I would like to insert into list: <element id="2"/> Can I write an XSLT to do this? ...

Count Xpaths in XmlSpy

I am using XmlSpy to analyze an xml file, and I want to get a quick count of the number of nodes that match a given xpath. I know how to enter the xpath and get the list of nodes, but I am really just interested in the count. Is it possible to get this? I'm using XmlSpy Professional Edition version 2007 sp2, if it matters. ...

How do I convert a .docx to html using asp.net?

Word 2007 saves its documents in .docx format which is really a zip file with a bunch of stuff in it including an xml file with the document. I want to be able to take a .docx file and drop it into a folder in my asp.net web app and have the code open the .docx file and render the (xml part of the) document as a web page. I've been sea...

Best tool(s) for working with DocBook XML documents?

I experimented with DocBook XML a while back, and also used it professionally for documenting a few software projects, but since the tool support at the time was not very good, I soon abandoned it in favor of hand-written LaTeX, and later LyX. Now I'm considering taking another look at DocBook, and I was wondering, what are the best to...

Best practices to parse xml files?

The default methods for dealing with xml in c# seem incredibly crude to me, leading me to suspect that I must be missing something in my searches. What is considered the standard best practices to parse xml files in c#? ...

Best XML writing tool for Python

I'm currently trying ElementTree and it looks fine, it escapes HTML entities and so on and so forth. Am I missing something truly wonderful I haven't heard of? This is similar to what I'm actually doing: import xml.etree.ElementTree as ET root = ET.Element('html') head = ET.SubElement(root,'head') script = ET.SubElement(head,'script') ...

Aligning text in SVG

I am trying to SVG XML documents with a mixture of lines and brief text snippets (two or three words typically). The major problem I'm having is getting the text aligning with line segments. For horizontal alignment I can use text-anchor with left, middle or right. I can't find a equivalent for vertical alignment; alignment-baseline do...

How to escape XML content with XSL to safely output it as JSON?

How to escape XML content with XSL to safely output it as JSON? ...

How can I make an exact copy of a xml node's children with XSLT?

My problem is that my XML document contains snippets of XHTML within it and while passing it through an XSLT I would like it to render those snippets without mangling them. I've tried wrapping the snippet in a CDATA but it doesn't work since less than and greater than are translated to < and > as opposed to being echoed directly. What'...