xml

invalid XML file?

Hello everyone, I wrote the following file in Visual Studio 2008 as a new XML file, and it reports the following error. What is the error message about and why it is treated as a wrong format XML file? Here is the XML file and related error message. <?xml version="1.0" encoding="utf-8"?> <Foo>&#x2;</Foo> Error 1 Character ' ', hexa...

Removing <div>'s from text file?

Hey, Ive made a small program in C#.net which doesnt really serve much of a purpose, its tells you the chance of your DOOM based on todays news lol. It takes an RSS on load from the BBC website and will then look for key words which either increment of decrease the percentage chance of DOOM. Crazy little project which maybe one day th...

How to read an XML file on localhost from Silverlight application?

I have Vista with IIS7. I want to create a simple Silverlight application that reads an xml file from localhost. I created this file (which I had to copy and click "allow" as administrator): C:\inetpub\wwwroot\data\customers.xml and can see it when I go here in a browser: http://localhost/data/customers.xml But when I run...

Setting XML Namepaces

I want create an xml document with the namepace attributes along the lines of this: <MyXmlDoC xmlns="http://abc" xmlns:brk="http://123"&gt; Using the System.Xml.Linq xml library, iv done this: public static XAttribute XmlNamepace() { return new XAttribute(XName.Get("xmlns"), "http://abc"); } ...

Search XML Column in SQL

İ have an XML document to store against records in an Oracle Database. The table CourseXML will contain: Record_Number int XML_Type int XMLDoc clob ...etc İ would like to make a search in XMLDoc column by XML tags. The XML document has an XML Schema like this: <root> <UnitID="2" Name="Jerry" SName="Potter"/> <Unit...

Parsing IIS configuration xml doc with linq to xml

Hi Guys, I am writing a small app that finds all the folders IIS is referencing. To do this I take the IIS config file and parse the xml looking for elements called IIsWebVirtualDir and look for the Path attribute. Here is my code XDocument doc = XDocument.Load(xmlPath); IEnumerable<XElement> elements = doc.Elements(...

How can I transform an element attribute to an element name in XSLT?

I'd link to transform XML with attributes like the 'name' attribute in the following: <books> <book name="TheBumperBookOfXMLProgramming"/> <book name="XsltForDummies"/> </books> into elements called what was in the name attribute: <books> <TheBumperBookOfXMLProgramming/> <XsltForDummies/> </books> using XSLT. Any ideas? ...

Processing XML into MySQL in good form

I need to process XML documents of varying formats into records in a MySQL database on a daily basis. The data I need from each XML document is interspersed with a good deal of data I don't need, and each document's node names are different. For example: source #1: <object id="1"> <title>URL 1</title> <url>http://www.one.com&...

Gracefully handle validation errors in a XML file in C#

The description is bit on the longer side please bear with me. I would like to process and validate a huge XML file and log the node which triggered the validation error and continue with processing the next node. A simplified version of the XML file is shown below. What I would like to perform is on encountering any validation error...

Basics of XmlNode.SelectNodes?

I'm not sure why this isn't working. I have an XmlNode in a known-format. It is: <[setting-name]> <dictionary> <[block-of-xml-to-process]/> <[block-of-xml-to-process]/> <[block-of-xml-to-process]/> </dictionary> </[setting-name]> I have a reference to the node in a variable called pattern. I want an itera...

LINQ XML column does not update on submitchanges()

Hello, I'm having an issue with LINQ-SQL not updating an XML column. I've run in debug and all values are correct, and when checking the table data I find out that the XML has not been updated. Also any suggested reading on DataClassesDataContext vs DataContext? Code: ///TEST LINQ MIHAI NEW XML protected void testLINQ() { using...

insert records in database from an xml

Am writing a .net windows service using which i need to parse an xml (having about 5000 nodes). I need to parse these nodes and insert data (ie. 5000 rows)into a sql database. Shall I insert all these records with batch insert or shall i insert them one by one? can someone help me with the design/algorithm for optimum performance? ...

PHP: Check if XML node exists with attribute

I can't seem to figure this one out. I have the following XML file: <?xml version="1.0" encoding="UTF-8"?> <targets> <showcases> <building name="Big Blue" /> <building name="Shiny Red" /> <building name="Mellow Yellow" /> </showcases> </targets> I need to be able to test whether or not a <building> node exists with a ...

Xstream object serialization

Given a class like this: public class Person { private String firstname; private String lastname; private PhoneNumber phone; private PhoneNumber fax; // ... constructors and methods private void calculate() { } } And an Xstream object like this: XStream xstream = new XStream(new DomDriver()); Person joe = new Person...

How can I handle Java object serialization with JavaScript?

public class Person { private String firstname; private String lastname; private PhoneNumber phone; private PhoneNumber fax; // ... constructors and methods private void calculate() { } } I have serialized the Java object located on the server side and sent it to the client XStream xstream = new XStream(new DomDriver()...

XML Split of a Large file

Hi, I have a 15 GB XML file which I would want to split it .It has approximately 300 Million lines in it . It doesn't have any top nodes which are interdependent .Is there any tool available which readily does this for me ? ...

An error occurred while parsing EntityName

Hello, I'm trying to load a xml document into an object XPathDocument in C#. My xml documents include this line: trés dégagée + rade and when the parser arrives there it gives me this error: "An error occurred while parsing EntityName" I know that's normal cause of the character "é". Does anybody know how can I avoid this error... My ide...

How efficient is XPath compared to using DOM in Dom4J?

For example consider the following xml <root> <childNode attribute1="value1"> <grandChildNode attrib1="val1" attrib2="val2">some content1 </grandChildNode> <grandChildNode attrib1="val1" attrib2="val2">some content2 </grandChildNode> <grandChildNode attrib1="val1" attrib2="val2">some content3 </grandChild...

Can you provide some examples of why it is hard to parse XML and HTML with a regex?

One mistake I see people making over and over again is trying to parse XML or HTML with a regex. Here are a few of the reasons parsing XML and HTML is hard: People want to treat a file as a sequence of lines, but this is valid: <tag attr="5" /> People want to treat < or <tag as the start of a tag, but stuff like this exists in the w...

When to include sub-items in RESTful resource representation?

RESTful design seems to advocate flat or shallow structured representations (at least when resources are represented as XML). A resource representation should contain just the resource, which the URI identifies. I'm wondering when it is sensible to present resource's sub-resources within the parent resource? To elaborate, consider this...