xml

printing meaningful errors with apache commons configuration

I'm using HierarchicalConfiguration for use with XML configuration files. Works great. But now I need to report meaningful information as an error. I would like to print the offending fragment of XML (or at least report line #), but I can't seem to get hold of an XML object or string from a HierarchicalConfiguration object. Help! What ...

Simple Java Web Service client over HTTPS

Hi all, I am connecting to a simple XML over HTTPS web service and getting a security exception. My question is whether you think the cause of this is the cert on the web server, so I should talk to the server admin or if my client code should be handling this. I would love to hear if anyone has encountered and solved this issue. Is the...

Preventing BeautifulSoup from converting my XML tags to lowercase

I am using BeautifulStoneSoup to parse an XML document and change some attributes. I noticed that it automatically converts all XML tags to lowercase. For example, my source file has <DocData> elements, which BeautifulSoup converts to <docdata>. This appears to be causing problems since the program I am feeding my modified XML document t...

Xpath expression with multiple predicates

Hi, I am trying to build a complex xpath expression which will answer the following condition. From the XML data below, returns the User entity which: His loginname is "user1" His name is "User 1" He has 2 different profiles values which are "operator" and "admin" (I don't know the exact order ahead) <user> <login>user1</lo...

C++ MSXML2 - Remove Namespace from XML

Hi, I need a nice way to be able to remove all namespace from an XML document in C++. Currently the doc is loaded into a MSXML2::IXMLDOMDocument2Ptr class. Can't currently see any methods that can do this Thanks ...

Linq2XML, Why isn't Element(), Elements() working?

I am trying to traverse through a simple sitemap (adding and deleting elements on the fly.) This is the sample layout <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schem...

Good 'XML with .Net' reference or Book

Greetings! This is quite a newbie question but forgive me. Can anyone recommend a good place, either site or book, to get up to speed on the XML Frameworks with .Net. I think I have the basics down but I have the feeling it's not as elegant as it could be. For example: When to use XMLDocument or XMLReader for finding elements How c...

How to calculate distance from a GPX file?

I have a GPX file with a GPS track. Now I want to calculate the distance I covered with this track. What's the best way to calculate this? ...

Convert static files into MySQL entries

I am converting about 4000 text files that contain HTML into MySQL database entries. Seems like an easy way to do this would be to add a couple lines to the HTML to make them appear as XML files, then XSLT the XML into MySQL INSERT statements. (Building a CSV would also work, but less optimal IMHO). I've tried doing this but am having li...

ASP.NET 2.0 & Web.config: Is this correct <appSettings/>?

I'm looking in Web.Config to add a simple (from a book) amendment - <configuration> <appSettings> <add key="SupportEmail" value="[email protected]" />. </appSettings> </configuration> However in the web.config I see there is only the following sign/bracket/block(?): <appSettings/> I can't find the opening . And isn't that an i...

Is it possible to get the current line number when parsing an XML document with Xerces ?

I have a java program that parses an XML document using xerces API. My parsing class extends org.apache.xerces.parsers.XMLDocumentParser, overloading the startElement, endElement, characters methods. Since it's a complicated XML document that is written by hand (mainly some kind of configuration elements), classic validation by xsd or ...

Export object collection to XML file

Using C#...I have a small app that creates objects from a class, and adds them to an object collection and it does some UI stuff along the way to display certain values from the currently selected object in the collection (Using WPF UI). So I want to add the ability to let the user save his object collection to a file, so they can load i...

Why is XmlDocument.Load(url) returning a stale file?

I have an application written in .NET 1.1 that calls XmlDocument.Load on a URL. Just recently the xml file was updated. Now whenever I call XmlDocument.Load, the old file is returned. When I hit the same URL from a browser, I see the new file. I deleted all temporary files from IE and I still see the same issue. Any thoughts on why ...

Managing RSS feeds

I am developing for a website that has an event "listing" service. It uses an rss feed (located at the web root under the name 'rss.xml') to give an RSS feed of the events to users who are interested in the service. I've been tasked with developing a blog for the website. I have the blog piece done, but I'm not sure the best way to inte...

How to sort a subelement of XML with XSLT

I have an input XML file which I need to copy 1:1 to the output, except for one subelement which contains subitems that need to be sorted. <?xml version="1.0"?> <top> <elementA /> <elementB /> <contents> <contentitem> <id>3</id> <moretags1 /> <moretags2 /> </contentitem> <contentitem...

Transferring files with metadata

I am writing a client windows app which will allow files and respective metadata to be uploaded to a server. For example gear.stl (original file) and gear.stl.xml (metadata). I am trying to figure out the correct protcol to use to transfer the files. I was thinking about using ftp since it is widely used and a proven method to transf...

Linq to Xml: selecting elements if an attribute value equals a node value in an IEnumerable<XElement>

I create an IEnumerable object that just contains the nodes I want from an xml file: IEnumerable<XElement> rosters = XDocument.Load("roster.xml") .Elements("rosterlist") .Elements("roster") .Where(w => w.Element("di...

REXML preserve attributes order

I try to generate such XML using REXML <root> <add key='foo' value='bar'/> </root> But what I get is (notice that key/value order) <root> <add value='bar' key='foo'/> </root> Code: require 'rexml/document' include REXML doc = Document.new doc.add_element('root') el = doc.root.add_element('add') el.add_attribute('key', 'foo') ...

C#/SQL - What's wrong with SqlDbType.Xml in procedures ?

Hi, I've asked few people why using xml as a parameter in stored procedure doesn't work and everyone said , that's just the way it is. I can't belive that. command.Parameters.Add("@xmldoc", SqlDbType.Xml); That's where compiler returns error and I can't use NVarChar beacouse it's limiteed to 4k sings. XML would be perfect as it can b...

adding attributes to an xml document

I have an XML schema and an instance document I get from a customer. For example the document can be: <doc>    <carId>12</carId> </doc> And it is valid according to the schema. I would like to annotate this with my attributes: <doc>    <carId myns:valid="true">12</carId> </doc> I would like the annotated document to be va...