dtd

Can the content of an XML element be bounded?

Hi I am trying to write a DTD, and I want to define an element BOOKTYPE, that can be either ONE, TWO or THREE. Is there a way I can ensure that only one of these values can be entered inside the element? Note: 1. I know how to do this in an attribute, but not sure how to accomplish with elements. 2. I want a way of doing this INSIDE the...

Firefox not reading DTD?

Hello, I have an XML file (diploma.xml) that looks like this: <?xml version="1.0" standalone="no" ?> <!DOCTYPE Diploma SYSTEM "diploma.dtd"> <Diploma> &students; &Registrations; &Courses; </Diploma> And the DTD looks like this: <!ENTITY students SYSTEM "students.xml"> <!ENTITY Registrations SYSTEM "registrations.xml"> <!ENTITY Cou...

Is DTD or XML schema better?

What are the pros / cons in DTD and XML Schemas (I'm not even sure what the official name of the latter is!)? Which is better? Why do we need two ways to do the same thing? Seems dumb, IMHO. :) Thanks, LES Edit: I found this in an article I was reading, which is what prompted me to ask the question: Why W3C XML Schema Language? ...

xmltask confused about dtd

I'm trying to use xmltask for ant to modify a file in a subdirectory: project/path/to/file.xml The file refers to a DTD like this: <!DOCTYPE data SYSTEM "mydtd.dtd"> I don't have the flexibility to change these documents. This DTD is stored in the same subdirectory, which has always worked fine: project/path/to/mydtd.dtd Unfort...

Reading RSS problem - Expected DTD markup was not found

I am opening XML file that refers to a DTD as follows: <?xml version="1.0" encoding="windows-1250"?> <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd"&gt; Here is the part of C# code: public static XmlDocument FromUri(string uri) { XmlDocument xmlDoc;...

Problem validation a XML file with a local DTD file in C#

I'm triying to validate a XML file. I'm using this code XmlReaderSettings settings = new XmlReaderSettings(); settings.ProhibitDtd = false; settings.ValidationType = ValidationType.DTD; settings.ValidationEventHandler += new ValidationEventHandler(validationError); XmlSchemaSet schemas = new XmlSchemaSet(); settings.Schemas = ...

Free DTD to XSD conversion utility?

I have a DTD that I need to convert to an XSD (XML schema) file. Is there a free utility or simple way to accomplish this? ...

Is there any way for DBUnit to automatically create tables?

I just realized that DBUnit doesn't create tables by itself (see How do I test with DBUnit with plain JDBC and HSQLDB without facing a NoSuchTableException?). Is there any way for DBUnit to automatically create tables from a dataset or dtd? EDIT: For simple testing of an in-memory database like HSQLDB, a crude approach can be used to ...

c# XML DTD validation. ENTITY is an unexpected token

Hi all, Im trying to validate an XML file using a .DTD but it gives me the following error. 'ENTITY' is an unexpected token. The expected token is 'DOCTYPE'. Line 538, position 3. public static void Validate(string xmlFilename, string schemaFilename) { XmlTextReader r = new XmlTextReader(xmlFilename); X...

What is difference between XML Schema and DTD ?

Hi, I have googled this question but I do not understand clearly what is schema and DTD and why Schema is more powerful compared to DTD. Any guidance would be highly appreciated. Thanks. ...

validate xml against dtd using python on google app engine

I've got validation working on client side using lxml, but I'm not quite sure how to get it work on google app engine, since it doesn't have the lxml package. I tried copying the whole lxml folder and place it in the root of my google application, but it seems like it cannot use it properly. I'm guessing it has to do with the compiled .s...

Why does the use of the Frameset DTD cause a validation failure?

The project I work on takes random HTML files, converts them to XHTML as best as it can, and wraps them with some XML metdata. The DOCTYPE is stripped out as the resulting XML file is not an XHTML document. However when retrieving the wrapped XHTML from the XML file the DOCTYPE should be reinserted. Because these are random HTML files ...

IE cannot find the W3C XHTML DTD (Error 2146697204)

I have a template that starts every page like this: <?xml version="1.0" encoding="utf-8"?> <!-- blah blah--> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > <html xmlns="http://www.w3.org/1999/xhtml"&gt; ... </html> that produces the error: The XML page can...

Is there a better Regex for parsing DTD

I've got the DTD for OFX 1.03 (their latest version despite having developed and released 1.60, but I digress...) I would like to use regex to have groups that split an entity, element, other tags into its parts for further processing such that I would take a tag like this: <!ENTITY % ACCTTOMACRO "(BANKACCTTO | CCACCTTO | INVACCTTO)"> ...

How to create XML file that uses two DTDs?

We're creating a REST service where the client will send XML containing a financial portfolio. The portfolio XML will use a published standard XML DTD. We would like to add a few bits of data to the portfolio XML. We would like to keep the ability to validate the XML against the published DTD. But if we add extra fields the DTD val...

Supply a different DTD location to SimpleXML / DOM for XML parsing

I have a problem with supplied XML files which don't have the right location in the XML. I'm trying to get correct XML files, but we might not succeed in getting those so I am looking at alternative solutions. As the DTD is available online, I could do a regex on the XML file and replace the DTD location, but this feels a bit hackish, an...

namespace error when using XMLStarlet

I have an xml configuration file which works fine in Java, and I'm trying to parse out some info from it using XMLStarlet inside a script. The error I'm getting is: xml sel -t -m "Config/Application" -v "@rmiPort" -n config.xml namespace error : Namespace prefix log4j on configuration is not defined <log4j:configura...

How to define elements in a DTD which share the declaration?

How can I define elements in a DTD which share the same declaration? I tried this which leads to a syntax error: <!ELEMENT (expression|condition) (code-text+)> Where expression and condition have the same declaration, that means the same sub-elements and attributes. ...

How to validate REST request?

Given this service: POST /hotel HTTP/1.1 <hotel> <a>aaa</a> <b>bbb</b> <c>ccc</c> </hotel> HTTP/1.1 201 CREATED Location: /hotel/123 When we process the request on the server we will validate the hotel XML in the request against a DTD. Question is, as a REST best practice should the client refer to the DTD in the request (a...

Forward Backward Rule Xml DTD

I want to model a simple (IF Then) rule using DTD. This is what I have come up with: <!ELEMENT forward ((rule | fact)*)> <!ELEMENT rule (if, then)> <!ELEMENT fact (#PCDATA)> <!ELEMENT if (#PCDATA)> <!ELEMENT then (#PCDATA)> This is a dtd for a forward rule ( p => c). I want to model the backward ru...