dtd

How do I validate xml against a DTD file in Python

I need to validate an XML string (and not a file) against a DTD description file. How can that be done in python? ...

How to generate sample XML documents from their DTD or XSD?

We are developing an application that involves a substantial amount of XML transformations. We do not have any proper input test data per se, only DTD or XSD files. We'd like to generate our test data ourselves from these files. Is there an easy/free way to do that? Edit There are apparently no free tools for this, and I agree that Oxy...

Generating an object model in Ruby from an XML DTD

I have an XML document with a DTD, and would love to be able to access the XML model, something like this: title = Thing.Items[0].Title Is there a way, in Ruby, to generate this kind of object model based on a DTD? Or am I stuck using REXML? Thanks! ...

The best way to validate XML in a unit test?

I have a class with a ToString method that produces XML. I want to unit test it to ensure it is producing valid xml. I have a DTD to validate the XML against. Should I include the DTD as a string within the unit test to avoid a dependency on it, or is there a smarter way to do this? ...

Is there a way to "diff" two XMLs element-wise?

I'm needing to check the differences between two XMLs but not "blindly", Given that both use the same DTD, I'm actually interested in verifying wether they have the same amount of elements or if there's differences. ...

Most common cause of "java.lang.NullPointerException" when dealing with XMLs?

My strongest lead is that the code who deals with the incoming XMLs is actually receiving an invalid/incomplete file hence failing the DOM parsing. Any suggestions? ...

Validate XML using a custom DTD in PHP

Is there a way (without installing any libraries) of validating XML using a custom DTD in PHP? ...

What is the best way to generate XML Binding Code from a DTD?

Most Java-XML binding frameworks and code generators need XML Schema Defintions. Can you suggest the best way to generate binding code from DTD. I know that the XJC in JAXB 2 supports DTD but it is considered experimental. In the spirit of Stack Overflow, one suggestion per answer please - to be voted up or down instead of duplicated ...

Is there a difference between 'valid xml' and 'well formed xml'?

I wasnt aware of a difference, but a coworker says there is, although he can't back it up. What's the difference if any? ...

Make DocumentBuilder.parse ignore DTD references

When I parse my xml file (variable f) in this method, I get an error C:\Documents and Settings\joe\Desktop\aicpcudev\OnlineModule\map.dtd (The system cannot find the path specified) I know I do not have the dtd, nor do I need it. How can I parse this File object into a Document object while ignoring DTD reference errors? private...

How do I change the "level" of validation that Ant's XMLValidate task provides?

I am attempting to use Ant's XMLValidate task to validate an XML document against a DTD. The problem is not that it doesn't work, but that it works too well. My DTD contains an xref element with an "@linkend" attribute of type IDREF. Most of these reference IDs outside of the current document. Because of this, my build fails, since t...

Special Characters in XML

I am creating a left navigation system utilizing xml and xsl. Everything was been going great until I tried to use a special character in my xml document. I am using and I get th error. reason: Reference to undefined entity 'raquo'. error code: -1072898046 How do I make this work? Thanks ...

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. ...

how to disable dtd at runtime in java's xpath ?

I got dtd in file and I cant remove it. When i try to parse it in Java I get "Caused by: java.net.SocketException: Network is unreachable: connect", because its remote dtd. can I disable somehow dtd checking? ...

How can I convert a DTD to a Schema as part of a Maven or ANT build?

How can I convert a DTD to a Schema as part of a Maven build? Specifically, I am looking for a Maven plugin to which I can give the URL to a DTD and it will generate an XML Schema Definition file. Failing a good Maven plugin, perhaps I can embed an ANT task into my Maven build ...

HTML DTDs - what's the point?

Being fairly inexperienced with certain aspects of web development (I've always concentrated more on the back-end than the front), can anyone give me their thoughts on whether I should worry about the DOCTYPE declaration made at the beginning of web pages? Is the most common HTML 4.01 and should I build my web apps to conform to this st...

Reference to undeclared entity exception while working with XML

I am trying to set the innerxml of a xmldoc but get the exception: Reference to undeclared entity XmlDocument xmldoc = new XmlDocument(); string text = "Hello, I am text &alpha; &nbsp; &ndash; &mdash;" xmldoc.InnerXml = "<p>" + text + "</p>"; This throws the exception: Reference to undeclared entity 'alpha'. Line 2, position 2.. How...

Java SAX Parser raises UnknownHostException

The XML file I want to parse starts with : <!DOCTYPE plist PUBLIC "-//...//DTD PLIST 1.0//EN" "http://www.....dtd"&gt; So when I start the SAX praser, it tries to access this DTD online, and I get a java.net.UnknownHostException. I cannot modify the XML file before feeding it to the SAX parser I have to run even with no internet co...

Where can I find good documentation on how to write XML DTDs?

The description of DTDs in the XML 1.1 specification is very terse, and it is difficult to gain an appreciation of what features are available. For example, from looking at the unflattened XHTML+MathML+SVG DTD, I know it is possible to import and partially redefine external DTDs, but I would never have guessed that was possible from read...

How can I prevent XML::XPath from fetching a DTD while processing an XML file?

My XML starts like this $ cat a.xhtml <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; ... My code starts like this use XML::XPath; use XML::XPath::XMLParser; my $xp = XML::XPath->new(filename => "a.xhtml"); my $nodeset = $xp->find('/html/body//table');...