xml

How do you convert a string to a node in XQuery?

I would like to convert a string into a node. I have a method that is defined to take a node, but the value I have is a string (it is hard coded). How do I turn that string into a node? So, given an XQuery method: define function foo($bar as node()*) as node() { (: unimportant details :) } I have a string that I want to pass to the...

Best StAX Implementation

My quick search reveals the reference implementation (http://stax.codehaus.org), the Woodstox implementation (http://woodstox.codehaus.org), and Sun's SJSXP implementation (https://sjsxp.dev.java.net/). Please comment on the relative merits of these, and fill me in on any other implementations I should consider. ...

Reading XML with an "&" into C# XMLDocument Object

I have inherited a poorly written web application that seems to have errors when it tries to read in an xml document stored in the database that has an "&" in it. For example there will be a tag with the contents: "Prepaid & Charge". Is there some secret simple thing to do to have it not get an error parsing that character, or am I mis...

Regular expression to remove XML tags and their content

I have the following string and I would like to remove <bpt *>*</bpt> and <ept *>*</ept> (notice the additional tag content inside them that also needs to be removed) without using a XML parser (overhead too large for tiny strings). The big <bpt i="1" x="1" type="bold"><b></bpt>black<ept i="1"></b></ept> <bpt i="2" x="2" type="ulined">...

What webservices do you use regularly and which do you wish were available?

I know that the USPS provides an handy XML over HTTP webservice for address information. What other webservices do you know of and use? What webservices do you wish you could access but can't find? ...

RSS/ATOM feed reader for windows (or cross-platform)

Looking for a good rss/feed reader for windows or if there are any good cross platforms one i would be really amazed, or good web services (dont like the google one). I want something simplistic and minimalistic. ...

xsd to rnc (or rng) conversion (unix command line)

A brief search shows that all available (unix command line) tools that convert from xsd (XML Schema) to rng (RelaxNG) or rnc (compact RelaxNG) have problems of some sort. First, if I use rngconv: $ wget https://msv.dev.java.net/files/documents/61/31333/rngconv.20060319.zip $ unzip rngconv.20060319.zip $ cd rngconv-20060319/ $ java -jar...

Can the Java File method "canWrite()" support locking?

I have a Java application that monitors a folder for incoming XML files. When a new file is detected I need to test the file that it is not currently being updated and is closed. My thought is to use File.canWrite() to test this. Is there any issue with doing this? Is this a good way to test that a file has been completely written? ...

How to retrieve namespaces in XML files using Xpath

Hello, I have an XML file that starts like this: <Elements name="Entities" xmlns="XS-GenerationToolElements"> I'll have to open a lot of these files. Each of these have a different namespace but will only have one namespace at a time (I'll never find two namespaces defined in one xml file). Using XPath I'd like to have an automatic ...

What is the recommended toolchain for formatting XML DocBook?

I've seen Best tools for working with DocBook XML documents, but my question is slightly different. Which is the currently recommended formatting toolchain - as opposed to editing tool - for XML DocBook? In Eric Raymond's 'The Art of Unix Programming' from 2003 (an excellent book!), the suggestion is XML-FO (XML Formatting Objects), bu...

How do I use XPathNodeIterator to iterate through a list of items in an XML file?

This is a sample (edited slightly, but you get the idea) of my XML file: <HostCollection> <ApplicationInfo /> <Hosts> <Host> <Name>Test</Name> <IP>192.168.1.1</IP> </Host> <Host> <Name>Test</Name> <IP>192.168.1.2</IP> </Host> </Hosts> </HostCollection> When my application (VB.NET app) load...

Moving the child nodes of an XML node upwards

Imagine I have the folling XML file: <a>before<b>middle</b>after</a> I want to convert it into something like this: <a>beforemiddleafter</a> In other words I want to get all the child nodes of a certain node, and move them to the parent node in order. This is like doing this command: "mv ./directory/* .", but for xml nodes. I'd like...

XML Schema (XSD) validation tool?

At the office we are currently writing an application that will generate XML files against a schema that we were given. We have the schema in an .XSD file. Are there tool or libraries that we can use for automated testing to check that the generated XML matches the schema? We would prefer free tools that are appropriate for commercial...

XMLDocument.Load(url) through a proxy

I have a bit of code that basically reads an XML document using the XMLDocument.Load(uri) method which works fine, but doesn't work so well if the call is made through a proxy. I was wondering if anyone knew of a way to make this call (or achieve the same effect) through a proxy? ...

C# Array XML Serialization

Hi, I found a problem with the XML Serialization of C#. The output of the serializer is inconsistent between normal Win32 and WinCE (but surprisingly WinCE has the IMO correcter output). Win32 simply ignores the Class2 XmlRoot("c2") Attribute. Does anyone know a way how to get the WinCE like output on Win32 (because i don't want the XM...

Which Ruby XML library would you recommend for a 2.4MB XML file?

I have a 2.4 MB XML file, an export from Microsoft Project (hey I'm the victim here!) from which I am requested to extract certain details for re-presentation. Ignoring the intelligence or otherwise of the request, which library should I try first from a Ruby perspective? I'm aware of the following (in no particular order): REXML Chil...

XML vs Text for Non-web development applications

I do alot of systems programming where my apps have no chance of being used to communicate over the web or viewed through a browser. But, there has been some push by management to use XML. For example, if I want to keep a time log I could use a text file like this: command date time project in 2008/09/23 08:00:00 PROJ1 change 2008/09/...

Editing XML as a dictionary in python?

I'm trying to generate customized xml files from a template xml file in python. Conceptually, I want to read in the template xml, remove some elements, change some text attributes, and write the new xml out to a file. I wanted it to work something like this: conf_base = ConvertXmlToDict('config-template.xml') conf_base_dict = conf_ba...

SAX vs XmlTextReader - SAX in C#

I am attempting to read a large XML document and I wanted to do it in chunks vs XmlDocument's way of reading the entire file into memory. I know I can use XmlTextReader to do this but I was wondering if anyone has used SAX for .NET? I know Java developers swear by it and I was wondering if it is worth giving it a try and if so what are t...

What are XML namespaces for?

This is something that I always find a bit hard to explain to others: Why do XML namespaces exist? When should we use them and when should we not? What are the common pitfalls when working with namespaces in XML? Also, how do they relate to XML schemas? Should XSD schemas always be associated with a namespace? ...