xml

Creating an XmlNode/XmlElement in C# without an XmlDocument?

I have a simple class that essentially just holds some values. I have overridden the ToString() method to return a nice string representation. Now, I want to create a ToXml() method, that will return something like this: <Song> <Artist>Bla</Artist> <Title>Foo</Title> </Song> Of course, I could just use a StringBuilder here, b...

Scala: how to create XML nodes from some collection

If you have something like: val myStuff = Array(Person("joe",40), Person("mary", 35)) How do you create an XML value with that data as nodes? I know how to use { braces } in an XML expression to put a value, but this is a collection of values. Do I need to iterate explicitly or is there something better? val myXml = <people>{ /* what...

Prevent DTD download when parsing XML

When using XmlDocument.Load , I am finding that if the document refers to a DTD, a connection is made to the provided URI. Is there any way to prevent this from happening? ...

In editor XML formatting.

Hi Anyone know of a simple system of getting xml formatted inside an editor. I mainly use textpad so that would be my main interest. What I'm really asking is that when I paste an xml string from a logfile or something into textpad that I can use a plugin or a third party tool to format the xml in textpad so it is readable. Edit: Than...

Repairing wrong encoding in XML files

One of our providers are sometimes sending XML feeds that are tagged as UTF-8 encoded documents but includes characters that are not included in the UTF-8 charset. This causes the parser to throw an exception and stop building the DOM object when these characters are encountered: DocumentBuilder.parse(ByteArrayInputStream bais) throws...

Is there a way in .Net to programatically generate a DTD from an existing XML file?

I've been looking around the System.Xml namespace, but don't see anything that would support this. Does anyone know if it's built into .Net, or would I have to obtain a third party library to do it? NOTE: I wish it were as simple as generating an xsd, but that won't do for my specific situation. ...

Concatenating xml files with xslt

I have several xml files, the names of which are stored in another xml file. I want to use xsl to produce a summary of the combination of the xml files. I remember there was a way to do this with the msxml extensions (I'm using msxml). I know I can get the content of each file using select="document(filename)" but I'm not sure how to ...

How do I get the contents of an XML element using a XmlSerializer?

I have an XML reader on this XML string: <?xml version="1.0" encoding="UTF-8" ?> <story id="1224488641nL21535800" date="20 Oct 2008" time="07:44"> <title>PRESS DIGEST - PORTUGAL - Oct 20</title> <text> <p> LISBON, Oct 20 (Reuters) - Following are some of the main stories in Portuguese newspapers on Monday. Reuters has not verified t...

Tools for debugging xslt

I have a Java servlet which generates xml, translates it with an xslt stylesheet, and then displays the resulting HTML. This is the first time I've worked with xslt. What's a good way to debug xslt? I have (or can get) some sample XML files to apply the transform too. But I'm not really even sure of the syntax so something that would giv...

new DOMDocument() in php 4

Hello, I've make an application in php that uses DOMDocument() in php 5. The problem is that my server uses php4 and DOM object is not recognized. What can I do? Can I download any kind of software and put it in my server and use include? wich one? Thanks a lot. ...

Am I destined to develop in XML?

Based on what I've seen on Oslo, declarative XML will have a key role. Can I expect to be mucking around a lot of designer generated XML to create real world applications? Just know I haven't researched this. I would just appreaciate your perspective if you have examined the subject. Some background... Whenever I dig just under the sk...

What xml/xslt library(ies) currently work well for java?

I need to apply some xml templates to various streams of xml data (and files, on occasion) and there seem to be a large number of xml libraries for java out there -- enough that it's difficult to quickly determine which libraries are still active, how they differ from the other options that are also active, and what criteria should be co...

How to deal with XML in C#

So what is the best way to deal with XML documents, XSD and all that stuff in C# 2.0? What classes to use etc. Like what are the best practices of parsing and making XML documents etc. EDIT: .Net 3.5 suggestions are also welcome. ...

How can I extract XML of a website and save in a file using Perl's LWP?

How can I extract information from a website (http://tv.yahoo.com/listings) and then create an XML file out of it? I want to save it so to parse later and display information using JavaScrit? I am quite new to Perl and I have no idea about how to do it. ...

JTidy Node.findBody() — How to use?

Hello, I'm trying to do XHTML DOM parsing with JTidy, and it seems to be rather counterintuitive task. In particular, there's a method to parse HTML: Node Tidy.parse(Reader, Writer) And to get the <body /> of that Node, I assume, I should use Node Node.findBody(TagTable) Where should I get an instance of that TagTable? (Constructor...

Easy way to flatten XML file with LINQ

Is there an easy way with LINQ to flatten an XML file? I can see a number of ways with XSLT but wondered what the best option with LINQ would be? I cant put the xml structure up exactly as stackoverflow seems to filter chevron chars. But its something like this nodeA --nodeA1 --nodeA2 NodeB I want to end up with nodeA nod...

Best way to remove an element at a known location from an XML String using DotNet?

I appreciate that there are now many mechanisms in dotnet to deal with XML in a myriad of ways... Suppose I have a string containing the XML.... <?xml version="1.0" encoding="utf-8" ?> <root> <Element1> <Element1_1> SomeData </Element1_1> </Element1> <Element2> Some More Data </Eleme...

Database Table or XML

Hi All, I'm in the process of designing a small website and was curious when an XML file can/should be substituted for a database table. There are some cases where I think using a database table may be overkill and was just wondering if anyone else has come across making this decision. Thanks! ...

Castor performance issues

We recently upgraded to Castor 1.2 from version 0.9.5.3 and we've noticed a dramatic drop in performance when calling unmarshal on XML. We're unmarshaling to java classes that were generated by castor in both cases. For comparison, using identical XML the time for the XML unmarshal call used to take about 10-20ms and now takes about 23...

Save attribute value of xml element with single quotes using linq to xml.

How do I make the XDocument object save an attribute value of a element with single quotes? ...