xml

How can I iterate through a collection with Foreach to build an XDocument?

The following code gives me the error: The best overloaded method match for 'System.Xml.Linq.XElement.XElement(System.Xml.Linq.XName, object)' has some invalid arguments. What do I have to change so I can iterate through my List<Customer> collection with Foreach building the XDocument? using System; using System.Collections.Ge...

Writing XML in C# - 'Token StartElement in state Epilog would result in an invalid XML document' error

I'm trying to write to an XML document, taking data from an ArrayList of lists for (int i = 0; i < 15; i++) { string headname = (headers[0] as List<string>)[i]; headname.Replace("&", "&amp;"); headname.Replace("<", "&lt;"); headname.Replace(">", "&gt;"); ...

Sax Parser: processingInstruction() not called

Hi, maybe this is a n00b-question. I try to parse an xml-file like that: <?xml version="1.0" encoding="UTF-8" ?> <test> <a></a> </test> with the following code: public static void parse(File f) { final DefaultHandler handler = new DefaultHandler() { @Override public void processingInstruction(String target, Str...

JAXP Processing XML with NameSpace

Hi Iam trying to process an XML file with a namespace using JAXP/XPATH - but there is no output - any help would be great. I'm struggling with the namespace syntax... Basically I would like to process the currency and rates below in the XML file. XML FILE <gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns="http...

what is the most efficient way to count xml nodes in Java

I have a huge XML files up to 1-2gb, and obviously I can't parse the whole file at once, I'd have to split it into parts then parse the parts and do whatever with them. How can I count number of a certain node? So I can keep track on how many parts do I need to split the file. Is there a maybe better way to do this? I'm open to all sug...

Ruby libxml parsing and inserting to database

Hello, I am currently trying to read from an xml file which records the jobs on a PBS. I have succesfullly managed to parse the code, but am unable to insert the objtects into my database, i receive this error: "You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred...

Getting exact datapath of a treeview node

I am binding a Treeview to an XMLDataSource, The databindings are being generated automaticaly, The XML looks like this:- < Passengers> <Passenger type="normal" ethnic="asian"> <PassengerName>Name1</PassengerName> </Passenger> <Passenger type="normal"> <PassengerName>Name2</PassengerName> </Passenger> <Passenger> ...

XML Schema to be modified in excel (VSTO)

Hi, I am new to VSTO. I have mapped an excel document with XMl Schema.Now I need to create a functionality to change the xml schema in excel(On click a button it should show me the column of XML in tress view cntrol or in the list box) under which i should be able to delete some column and change the order of column . Any help will be...

Define Spring JAXB namespaces without using NamespacePrefixMapper

[Heavily edited as understanding progresses] Is it possible to get Spring Jaxb2Marshaller to use a custom set of namespace prefixes (or at least respect the ones given in the schema file/annotations) without having to use an extension of a NamespacePrefixMapper? The idea is to have a class with a "has a" relationship to another class t...

XmlBeans vs Digester which is good at handling huge xml files ?

I am creating a webservice which is going to parse huge xml files from different requests. I was exploring different xml parsers from which I read about XmlBeans and Digester would be easy to use and are very efficient. I felt Digester easier than that of XmlBeans but from documentation of XmlBeans I came to know that it uses Saxon 8.6.1...

Render escaped XML on browser

Hi, For the below xml i want to render the unescaped text parts on browser from xslt e.g.: <one> &lt;text&gt; </one> I want the markup rendered on browser to be: &lt;text&gt; But when I use the apply templates which looks like below <xsl:template match="text()" mode="literalHTML"> <xsl:copy-of select="."> </xsl:copy-of> </...

Merging XML documents with PHP

I have these two xml documents: XML 1: <outer> <foo> <foo-child name="fA" special="true"> content of fA </foo-child> <foo-child name="fB"> content of fB </foo-child> </foo> <bar> <bar-child name="bA"> content of bA </bar-child> <bar-...

Getting error while using Javascript in XSL

Hi, I've an XML document and I am creating another XML using XSL. I need to check some specific conditions and for that I want to use Javascript in my XSL. I tried it, however, couldn't get the desired result. As I could not change the XSL variables frequiently so i am trying to use Javascript. XSL- <?xml version="1.0" encoding="UTF-8...

How to convert flat list to the tree

I have the following xml: <root> <Element1> <Hierarchy attr="value"/> <Hierarchy attr="value"/> <Hierarchy attr="value"/> <Hierarchy attr="value"/> </Element1> <AnotherElement> <YetAnotherElement> <Hierarchy attr="value"/> <Hierarchy attr="value"/> <Hie...

flashbuilder 4 won't copy an xml file in release build

Hi! I have my own conf.xml file (src/conf/conf.xml) consists some properties (alphas, colors, etc). When i try to export release build, I see list of files which not includes that file. Why? When i run my application at debug it file places in "bin-debug" folder. ...

Help Conceptualizing XML HTTP POST Automation through Application Layer

Hey everyone, For this post, I'm looking for more conceptual help than a specific technical solution (although anything helps). Basically, I've been asked to automate an XML HTTP POST through an application layer. I've never done anything like this before, so I'm a bit confused where to even start on a high level. It would be great...

How can I move XML elements with PHP's SimpleXML?

How can I move an xml element elsewhere in a document? So I have this: <outer> <foo> <child name="a"/> <child name="b"/> <child name="c"/> </foo> <bar /> </outer> and want to end up with: <outer> <foo /> <bar> <child name="a"/> <child name="b"/> <child name="c"/> ...

Is Order of items read from a XDocument, by LINQ, Guaranteed?

So what I'm doing is using an xml document to determine the order in which certain SQL scripts need to be ran by a database update. The XML follows this format <ScriptRules> <Database databaseName = “string”> <Folder folderPath = “string” executeAllFiles = boolean> <file order=”first or last”>“Filename”</file> ...

Bulk Upload XML data to Google App Engine Using the YAML config method

Hi, I would like to bulk load the wurfl database (http://wurfl.sourceforge.net/) and I am not quite sure how to structure my data entities as well as how to write the transforms for the bulkloader config file. Here is a sample of a node from the wurfl file: <device id="generic" user_agent="" fall_back="root"> <group id="product...

how can get attributes of root element?

<?xml version="1.0" encoding="UTF-8"?> <data columns="12" rows="0"/> how can get attributes (rows) of root (data) element in jquery? i can with var records = $(xml).find(":first").parent().attr("rows"); but not works :-/ thanks Rob ...