[XML-SIG] Transforming text data to XML

Martin v. Loewis martin@v.loewis.de
24 May 2002 09:45:35 +0200


"RATHNA PRABHU RAJENDRAN" <rathnaprabhu1@hotmail.com> writes:

> Is there any python library which does the following :
> Given a DTD and a text file, outputs well-formed valid XML data
> (atleast something close to this functionality ) ?

No, and I think it is pretty much impossible to implement such a
library (assuming you meant not just well-formed, but valid).

Actually, interpreting your question strictly, it is very easy to do
so, since you did not require that the text and the resulting XML file
bear any relationship.

So given the text of your question, and the XHTML DTD, a resulting
file could read

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<title></title>
<body></body>
</html>

It certainly is possible to implement such a library, but I doubt this
is what you want...

Regards,
Martin