xml

Writing a System.Xml.XmlElement to a file on disk

Hey there, I'm having trouble with writing a System.Xml.XmlElement to disk using C# .NET. This is what I'm trying to do at the moment and failing: XmlWriterSettings oSettings = new XmlWriterSettings(); oSettings.Indent = true; oSettings.OmitXmlDeclaration = false; oSettings.Encoding = Encoding.ASCII; XmlWriter writer = XmlWriter.Crea...

How to delete specific nodes from an XML file using LINQ in C#

I've an xml file (Sample.xml) which has the following structure <RootElement> <Child Name="FirstChild" Start="1" End="2"/> <Child Name="SecondChild" Start="0" End="2"/> <Child Name="ThirdChild" Start="1" End="2"/> <Child Name="FourthChild" Start="0" End="2"/> ...

Unknown problem with PHP's XML parsing functions

I'm using a PHP4 implementation of SimpleXML, which uses the built-in xml_* functions from PHP 4. I have an odd problem that I'm unable to diagnose due to no error reporting on the server and not being able to turn on error_reporting. I've modified the Parse() function to include this: [stuff here to initialise the parser] echo '<texta...

Xerces - XmlString to Dom object

I am trying to convert an Xml String to XML DOM object using Xerces (xercesImpl-2.8.1.jar). But it seems that it provides only following methods, it does not offer a method that would take an XML string and convert it to an Object. parse(File f) parse(InputSource is) parse(InputStream is) parse(String uri) Any pointers would be g...

How to translate a XML file with a specific syntax to another XML file respecting another syntax?

Hello everybody, I have an XML file, let's call it file A, and another XML file, B. I need to make an import tool which will permit me to take the content of the file A, and put it in the file B. The two syntaxes are totally different. The file A is used in a web app, that will integrate an other tool which describe the same thing with...

How do you create components.xml for debug/development in Seam

Hi. Has anyone created two versions of components.xml like the components-dev.properties or the other dev or prod versions? How did you do this? We have some custom components that we are using for Development that is created in components.xml that I would like to move to its own components-dev.xml but I don't how to do this. Any idea...

Getting a foreach to run once

So the question is this, I have a for each loop that I am currently using to retrieve data from a query of an XML file which then gets put into a string; like so: foreach (var value in dateQuery) date = value.Element("HistoryCreation").Value; I know for a fact (Based on the way the xml file stores values and the query ...

Finding CSS class in jQuery object that has been populated from XML.

Hi all, I have populated an asynchronous ajax function which grabs data from an xml: $.ajax({ type: "GET", url: "/content/en_GB/banner-data.xml", dataType: "xml", success: function(xml) { $(xml).find('item').each(function(){ var section = $(this).attr('section'); var title = $(this).attr('title'...

Converting an XML String into Code in C#

I have a reporting module in an ASP.NET webforms app (C#) that uses dynamic controls for the parameters for each report. These dynamic controls are built from an XML column in a SQL Server 2008 DB. XML structure: <Report Parameters> <Parameter> <Name>CustomerId</Name> <Control /> </Parameter> <Parameter> ...

DataTable to XML and ViceVersa in C# .Net

I am having problems to write DataTable to XML document and read back the same XML document to the DataTable. The Following is the Code, please help. Thanks in advance. //TO READ A FILE if (openFileDialog1.ShowDialog() == DialogResult.OK) { myDT_For_DGV.ReadXml(@openFileDialog1.FileName); ...

simple XSL sorting issue

I am trying to sort an xml using xsl. Got some sample from xml.com. Its seems logical and intuitive. I tried, some how its not sorting. Its hard getting my head around this. Here is the Xsl I am using for sorting <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-c...

Storing and associating data between both XML and an RDBMS

I'm constantly running into issues with having hierarchical data stored in an RDBMS. To me, it seems like an indicator that it's the wrong tool for the job. The "job" is to store a hierarchical survey and the results from multiple respondents for a given date range. The survey questions may slightly vary from one date range to the next. ...

Filtering your LINQ to XML query

I have the following: XDocument xdoc = XDocument.Load("C:\\myfile.xml"); List<Tag> list = new List<Tag>(); foreach (var tag in xdoc.Descendants("META")) { string name = tag.Attribute("name").Value; string value = tag.Element("value").Value; list.Add(new Tag { Name = name, Value = value, Score = score, Key = key }); } but I need...

XMLEventWriter: how can I tell it to write empty elements?

I do not see an option within javax.xml.stream.XMLEventWriter or javax.xml.stream.XMLOutputFactory to set either up in a way so that empty elements are written (instead of explicit start and end element pairs). I see that Woodstox has a property to do this, but it is not standardized. Am I missing any obvious way to do this? ...

XSLT finding links inside tags in XML documents

Is there a way to have an xsl stylesheet recognize when a link appears inside a tag in an xml document and turn it into a working link? Example: <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="guys.xsl"?> <people> <person> <name>Guy 1</name> <bio>Guy 1 is a guy.</bio> </person> ...

php output xml produces parse error "&rsquo;"

Hi, Is there any function that I can use to parse any string to ensure it won't cause xml parsing problems? I have a php script outputting a xml file with content obtained from forms. The thing is, apart from the usual string checks from a php form, some of the user text causes xml parsing errors. I'm facing this "&rsquo;" in particula...

Android ImageButton selector - one xml per button?

When using the "selector" to specify different images for buttons for different states, such as pressed, focused etc, do I have to write an xml file for each button? I have about 15-20 buttons in my app, so was wondering if there is a way to write just one xml and refer to parts of it? Thanks Chris ...

Serializing Java objects to XML with XStream

The problem is that every time I execute the main method, the old content of a.xml is lost and is substituted with a new one. How to append content to the a.xml file without losing the previous information? import java.io.FileNotFoundException; import java.io.PrintWriter; import com.thoughtworks.xstream.XStream; import com.thoughtworks...

Parsing XML in an Oracle function

I have a very simple XML document that is stored as a VARCHAR2 in an Oracle 10g table. Below is an example of the XML. I want to take the XML and insert it into a global temp table as a single record. I've seen a couple other questions related to this topic but they were a little mor complex than I need. Anyone show me how to grab th...

Organising complex webs of complex articles in large websites

My question relates to how large websites, edited by several hundred people who work in a large organisation (such as a News website) organise their web pages. What form of mechanism works in the background? Does each article represent a row in a table on a database. If so, how are images and embedded videos incorporated. Or is each p...