xml

Problem deserializing xml file

I auto generated an xsd file from the below xml and used xsd2code to get a c# class. The problem is the entire xml doesn't deserialize. Here is how I'm attempting to deserialize: static void Main(string[] args) { using (TextReader textReader = new StreamReader("config.xml")) { // string temp = text...

How do I insert XML into another XML file with XSLT?

Hello, I looked at this thread to find out how to insert XML into XML with XSLT http://stackoverflow.com/questions/862954/insert-xml-node-at-a-specific-position-of-an-existing-document But I have a problem since I need to insert XML between two grand child nodes. For example I want to insert <s>...</s> between <r>...</r> and <t>...</t>...

How can I write an XSLT that will recursively include other files?

Let's say I have a series of xml files in this format: A.xml: <page> <header>Page A</header> <content>blAh blAh blAh</content> </page> B.xml: <page also-include="A.xml"> <header>Page B</header> <content>Blah Blah Blah</content> </page> Using this XSLT: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.o...

Sorting an XML file through XSL

I have an XML file that I want to sort by an attribute. The file is structured as shown below: <wb xmlns:cf="http://www.macromedia.com/2004/cfform"&gt; <a:form name="chart"> <a:input FIELDNUMBER="09" INDEX="2" LEFT="200" /> <a:input FIELDNUMBER="08" INDEX="3" LEFT="200" /> <a:fieldset FIELD="a" FIELDNAME...

XForms and multiple inputs for same model tag

Hi! I apologize ahead of time if I am not asking this properly.. it is hard to put into words what I am asking.. I have XForms model such as: <file> <criteria> <criterion></criterion> </criteria> </file> I want to have multiple input text boxes that create a new criterion tag. user interface such as: <xf:input ref=...

Recursive XSLT, part 2

Ok, following on from my question here. Lets say my pages are now like this: A.xml: <page> <header>Page A</header> <content-a>Random content for page A</content-a> <content-b>More of page A's content</content-b> <content-c>More of page A's content</content-c> <!-- This doesn't keep going: there are a predefined num...

How to modify XML on Objective-C?

Hi, I'm working on a project for the iPad, I need to read and write to an xml file, which is also used by the counter part of the application in windows. The problem that I have is that I've been looking around but I haven't found a way to modify an element or attribute in an xml, without having to build the whole xml again. I saw thi...

How do I parse an xml document as a stream using Scala?

How do I parse an xml document as a stream using Scala? I've used the Stax API in java to accomplish this, but I'd like to know if there is a "scala" way to do this. ...

jQuery won't parse xml with nodes called option

hi all, I'm using jQuery to parse some XML, like so: function enumOptions(xml) { $(xml).find("animal").each(function(){ alert($(this).text()); }); } enumOptions("<root><animal>cow</animal><animal>squirrel</animal></root>"); This works great. However if I try and look for nodes called "option" then it doesn't work: fu...

jquery append() method on empty XML element

This could just be a syntax error, but I'm trying to create a Document object from scratch, starting with document.implementation.createDocument() and then using jquery's append() method to add the elements. But it's not appending: var myDoc = document.implementation.createDocument("", 'stuff', null); $("stuff",myDoc).attr("test","test...

php foreach visible on page

In my PHP code I have this: $filename = 'data.xml'; $xml = file_get_contents($filename); $data = simplexml_load_string($xml); $variable = ""; foreach ($data->file_info as $record) { $id1 = $record['id1']; $id2 = $record['id2']; } And it works perfectly fine on the web server, but when trying to view it locally (using xampp) I ...

How to pass parameter value to XSL?

Suppose I have a XSL as follows: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" indent="yes"/> <xsl:param name="sortKey" select="'firstname'"/> </xsl:stylesheet> Then a XML as follows <?xml version="1.0" encoding="UTF-8"...

How to edit an XML file in JavaME using kXML?

kXML is an alternative XML parser I chose to use for JavaME apps. The XML file to be editted is inside the mobile app's own JAR. I'm using CLDC profile. Please help ...

Alternatives for DocumentBuilderFactory and TransformerFactory for Java ME

I have this code that works perfectly in Java SE. How can I make it work in JavaME? These classes are not available in Java ME, CLDC profile. DocumentBuilder, DocumentBuilderFactory, NodeList, DOMSource, StreamResult, TransformerFactory, Transformer. ` DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try{ ...

How do I serialize an object to xml but not have it be the root element of the xml document

I have the following object: public class MyClass { public int Id { get; set;} public string Name { get; set; } } I'm wanting to serialize this to the following xml string: <MyClass> <Id>1</Id> <Name>My Name</Name> </MyClass> Unfortunately, when I use the XMLSerializer I get a string which looks like: <?xml versi...

PowerShell: Retrieve a specific internal XML element

Hi, I have an XML document with this structure: <Fruits> <Fruit> <Code>1</Code> <Name>Apple</Name> </Fruit> </Fruits> What is the best way to get a <Fruit> element by its code (or any other field) in PowerShell 1 code? (Not XPath, as it is supported in PowerShell 2 only) Thanks! ...

Why doesn't XmlSerializer support Dictionary?

Just curious as to why Dictionary is not supported by XmlSerializer? You can get around it easily enough by using DataContractSerializer and writing the object to a XmlTextWriter, but what are the characteristics of a Dictionary that makes it difficult for a XmlSerializer to deal with considering it's really an array of KeyValuePairs. ...

Is there a GUI which will enable me to query an XML file?

hi, I have an XML file which I'd like to query (read/write) in the same way as I would a relational database. Performance is not a big issue, I just want to be able to load the file and start querying, preferably without having to define a schema. Does anyone know if such software exists? ...

XML fragment with multiple roots: suppressing VS error

In Visual Studio, I have an XML file (with .xml extension) which contains an XML fragment that I use in my program: <tag1> data ... </tag1> <tag2> data ... </tag2> Visual Studio shows me an error in the error list: "XML document cannot contain multiple root level elements". But this is not a complete document, just a fragment that ...

Is there a way to enforce/preserve order of XML elements in an XML Schema?

Let's consider the following XML Schema: <?xml version="1.0" encoding="UTF-8"?> <schema targetNamespace="http://www.example.org/library" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:lib="http://www.example.org/library"&gt; <element name="library" type="lib:libraryType"></element>...