473,326 Members | 2,438 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

DTDs and xsl transforming

Jon
I am getting the following message when I try to transform an xml file that
specifies a DTD. I know how to allow DTDs when using an xmlreader, but not
when using the xsl transform. Can someone enlighten me, please.

System.Xml.XmlException was unhandled
Message="For security reasons DTD is prohibited in this XML document. To
enable DTD processing set the ProhibitDtd property on XmlReaderSettings to
false and pass the settings into XmlReader.Create method."

'Now transform it with xsl
'Load the style sheet.
Dim xslt As New XslCompiledTransform()
xslt.Load("vendor.xslt")

' Execute the transform and output the results to a file.
xslt.Transform("vendor.xml", "vendor.html")

Thanks
Jon
Feb 3 '06 #1
2 13653
Jon
Nevermind, I see it now. Temporary brain meltdown.
"Jon" <ru******@msn.com> wrote in message
news:ew**************@TK2MSFTNGP09.phx.gbl...
I am getting the following message when I try to transform an xml file that
specifies a DTD. I know how to allow DTDs when using an xmlreader, but not
when using the xsl transform. Can someone enlighten me, please.

System.Xml.XmlException was unhandled
Message="For security reasons DTD is prohibited in this XML document. To
enable DTD processing set the ProhibitDtd property on XmlReaderSettings to
false and pass the settings into XmlReader.Create method."

'Now transform it with xsl
'Load the style sheet.
Dim xslt As New XslCompiledTransform()
xslt.Load("vendor.xslt")

' Execute the transform and output the results to a file.
xslt.Transform("vendor.xml", "vendor.html")

Thanks
Jon

Feb 3 '06 #2
Nic
1
Hi

I have a strange problem with the class XslCompiledTransform.

I am getting an error when loading the XSLT file saying that DTD is prohibited. But there is no DTD in my XSLT file.

CODE:
string stylesheetUri = "http://server:port/URL/Transformation.xslt";
XslCompiledTransform transform = new XslCompiledTransform();
transform.Load(stylesheetUri);//EXCEPTION HERE

EXCEPTION:
System.Xml.XmlException: For security reasons DTD is prohibited in this XML document. To enable DTD processing set the ProhibitDtd property on XmlReaderSettings to false and pass the settings into XmlReader.Create method.

XSLT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="RootNode">
<html>
<head>
<title>Title</title>
</head>
<body>Body</body>
</html>
</xsl:template>
</xsl:stylesheet>

I have also tried this code, but I still get an error.

Now it tries to read the *non-existant* DTD.

CODE:
string stylesheetUri = "http://server:port/URL/Transformation.xslt";
XmlReaderSettings settings = new XmlReaderSettings();
settings.ProhibitDtd = false;
XmlReader reader = XmlReader.Create(stylesheetUri, settings);

EXCEPTION:
System.Xml.XmlException: Expected DTD markup was not found. Line 2, position 3.

Anyone have a solution?

Thanks a lot

Nic
Feb 14 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: chris | last post by:
Hi, Does anyone know where you can get a copy of html and xhtml dtds? Saxon wants to grab them off the net each time, but by using a catalog and NWalshs' resolver you can get it to look for...
4
by: nobody | last post by:
hello! do you know of any (free) preprocessor able to deal with DTDs? I'dlike to do things as #define with_b ... <!ELEMENT a (#PCDATA)> <!ELEMENT c (#PCDATA)>
4
by: Clifford W. Racz | last post by:
I am an XML author and I am needing to do some SGML work as well. I am using James Clark's SP (SX) to transform my SGML source into an XML source for use with XSLTs. I am needing to write XSLTs...
1
by: David Tucker | last post by:
i have an xml document that needs to use multiple dtds. each dtd may have the same element names in general but some will differe slightly. I want to use namspaces but every time I do so it...
81
by: Michael Rozdoba | last post by:
I've been wandering around the results of numerous googles for several hours without reaching a conclusive solution, so I'm dipping a tentative toe back in ciwah... I've been persuaded here in...
5
by: Daniel Crespo | last post by:
Is there a built-in method for transforming (1,None,"Hello!") to 1,None,"Hello!"? Thanks
4
by: Showjumper | last post by:
I am using the NITF DTD for my xml files and i need to use 2 xsl files to do the transform: one for the <body.head> and the second for the <body.content>. I've got this so far for transforming...
9
by: wardy1975 | last post by:
Hi All, Looking for a little expert advice on a few web standards issues. I am currently trying to understand the impact of web standards for a web application I work with. I have been doing a...
2
by: =?ISO-8859-1?Q?J=2E_Pablo_Fern=E1ndez?= | last post by:
Hello, Is ElementTree supposed to load DTDs? I have some xmls heavy on entities and it fails this way: Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) on linux2 Type "help", "copyright",...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.