xml

What is an efficient way to create a W3C DOM programatically in Java?

Although I know how to build a DOM the long, arduous way using the DOM API, I'd like to do something a bit better than that. Is there a nice, tidy way to build hierarchical documents with, say, an API that works something like Hibernate's Criteria API? So that I can chain calls together like this, for example: Document doc = createDoc...

Castle Windsor: How do I wire up events in my configuration?

I have something like this: public interface IDeviceMonitor { int DeviceId { get; } event DeviceUpdatedHandler NewValueRecieved; void Start(); void Stop(); } public class DeviceInactivityDetector { ... public virtual void DeviceUpdated(IDeviceMonitor device, DeviceUpdatedArgs args) { .... } } curren...

Flex - databinding from a Tree to a Repeater

Hi, I'm trying to make an XML questions editor in flash. Basically I load in the XML into a Tree component - XML like so: <questions> <question id="1" type="radio" text="This is question 1" isBranch="true"> <option id="1.1" correct="false" text="This is option 1" /> <option id="1.2" correct="false" text="This is option 2" /> <opti...

Convert XML datatype in SQL 2005 into a relational resultset

I have a table in a SQL 2005 database that contains a column defined as a xml datatype. I'm trying to write stored proc that queries the xml and returns a resultset from a select statement. I've seen examples of returning scalar values or xml but not how to return a resultset. Am I going to have to use openxml or is there another solu...

XML schema contruct for a type with both enumerations and attributes

I'm trying to create a type in an XML schema to enforce an element with both: A single attribute; and Simple content matching an enumeration. In an XML document, the element might look like: <Operator Permutation="true"> Equals </Operator> Where "Equals" would be one of the enumerations. Is this possible? If so, how? I've trie...

Merging config files (or XML) in C#

What would be the fastest way, to merge 2 XML files, so I would locate a node in first one, empty it, take all children from the same tag (same node) in second XML and put it in the first one. ...

Using the Rome Java API to access metadata fields

I've been using the Rome API to parse data from an XML feed pretty successfully so for, but have run in to a bit of a snag. Given the following snippet of XML: <entry> <id>uniqueId</id> <updated>2008-11-05T01:32:35Z</updated> <mm:status xmlns:mm="http://contentprovider.com&amp;quot; available="true"/> <title>Title</title> ...

Refactoring a massive function into many files.

I've been trying to refactor a "bit" of code that I'd previously developed. Basically, the project was my response to not knowing how to use XSLT effectively, so I developed an XML transformation system in PHP. The program reads through the tags of an XML file and does something along these lines to convert it to HTML: private function ...

Unable to parse XML file using DocumentBuilder

I have this code: if (file.exists()) { Document doc = builder.parse(file); NodeList list = doc.getElementsByTagName("property"); System.out.println("XML Elements: "); for (int ii = 0; ii < list.getLength(); ii++) { line 2 gives following exception E:\workspace\test\testDomain\src\com\test\ins\nxg\maps\Right.hbm.xml ...***jav...

Efficient algorithm for comparing XML nodes

Hi, I want to determine whether to different child nodes within an XML document are equal or not. Two nodes should be considered equal if they have the same set of attributes and child notes and all child notes are equal, too (i.e. the whole sub tree should be equal). The input document might be very large (up to 60MB, more than a 1000...

XML to DOC to PDF

what is the easiest(and fastest) way to perform this kind of transformation: "Data in XML" to "Some MS Word 2003 Supported format" to PDF using Java? My first guess was to fill the template with XML data (using Placeholders for example) and then save it and convert it to PDF. But I can't just put placeholders to DOC files, and I can't c...

What is the most efficient way of extracting information from a large number of xml files in python?

Hi, I have a directory full (~103, 104) of XML files from which I need to extract the contents of several fields. I've tested different xml parsers, and since I don't need to validate the contents (expensive) I was thinking of simply using xml.parsers.expat (the fastest one) to go through the files, one by one to extract the data. I...

Sorting XML nodes based on DateTime attribute C#, XPath

I have a XML Structure that looks like this. <sales> <item name="Games" sku="MIC28306200" iCat="28" sTime="11/26/2008 8:41:12 AM" price="1.00" desc="Item Name" /> <item name="Games" sku="MIC28307100" iCat="28" sTime="11/26/2008 8:42:12 AM" price="1.00" desc="Item Name" /> ... </sales> I am trying to find a ...

How do I Create an Expression Tree by Parsing Xml in C#?

Hi, I am looking to create an expression tree by parsing xml using C#. The xml would be like the following: <Expression> <If> <Condition> <GreaterThan> <X> <Y> </GreaterThan> </Condition> <Expression /> <If> <Else> <Expression /> </Else> <Expression> or another example... <Expression> <Add> <X> ...

Easily using Excel data in SQL Server

I am regularly required to compare data sent to me in Excel spreadsheets with data that lives in SQL Server. I know that you can connect SQL Server to spreadsheets but it always seemed clunky This is really a post to show off my solution but I would love to hear other peoples ideas. ...

Select unique XElements (by attribute) with a filter using LinqToXml

I have an XML document looking similar to this: <items> <item cat="1" owner="14">bla</item> <item cat="1" owner="9">bla</item> <item cat="1" owner="14">bla</item> <item cat="2" owner="12">bla</item> <item cat="2" owner="12">bla</item> </items> Now I'd like to get all unique owners (I actually only need the attribute value of the ...

How to to create a boolean value in XSLT?

I am totally new to XSLT and can't work out where I am going wrong with the following code. <xsl:variable name="var" select="boolean('false')"/> <xsl:if test="$var'">variable is true</xsl:if> It is always returning true when it is meant to be false. Can anyone help? ...

Want to return the entire contents of an XElement as a string

I'm a newbie to LINQ in C# and am using it to read in and work with XML files. I'm able to navigate up and down my elements, but what I want for some elements is to return the entire contents as a string. Meaning, I have an element like this: <element1> <subel1> some text here </subel1> </element1> When I get the value of elemen...

How to write out the contents of a string to XML without the codes...?

I have a string that has angle brackets in it like this: <element1>my text here</element1> The string literally looks like this when I write it to console or my dataGridView or anywhere else. However, I'm trying to write this as part of an XML document. Everything is fine except that in the xml file that is written, the above show...

Parsing large XML files in Adobe Flex

I am working on an Adobe Flex app, which needs to parse a relativley large XML file. ATM it is only 35MB, but in an ideal world would get much larger in the future. **Edit: I have no control over the XML file I am essentially dropping it's contents right into an SQLITE database, so I could use the SimpleXML class to turn it into an obj...