Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to prevent DTD validation during transform

Reply
Thread Tools

How to prevent DTD validation during transform

 
 
=?Utf-8?B?Sy4gV2lsZGVy?=
Guest
Posts: n/a
 
      09-01-2006
I'm having a problem getting this to work in ASP.NET 2.0. I'm trying to
prevent the validation of a DTD in the incoming XML.

I have this XML that I receive via xml web service from an external source.
In other words, I cannot modify anything about it prior to receiving it.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE UserResponse SYSTEM "UserResponse.dtd"[]>
<UserResponse>
<ResponseHeader>
<VERSION_4_3></VERSION_4_3>
<ReferenceNumber>85604579</ReferenceNumber>
<Timestamp>2006-08-31T12:13:46EDT</Timestamp>
</ResponseHeader>
<Body>
<Status>
<StatusCode>-245</StatusCode>
<Description>Data Validation Error</Description>
<ValidationError>
<PathName>/UserRequest/Body/CreateIndividual/LoginName</PathName>
<StatusCode>-2319</StatusCode>
<Description>Invalid value</Description>
</ValidationError>
<ValidationError>
<PathName>/UserRequest/Body/CreateIndividual/Password</PathName>
<StatusCode>-2319</StatusCode>
<Description>Invalid value</Description>
</ValidationError>
</Status>
</Body>
</UserResponse>

I need to transform it to a string using an XSL stylesheet. I get the
following error when I run this:

Error message:

Date: 9/1/06 11:25:14 AM - Error: CommonFuncs.TransformXsl: Illegal
characters in path.



This is the function I'm using to transform the XML:

Public Shared Function TransformXsl(ByVal xmlFragment As String, ByVal
xslPath As String) As String

Try
' Execute the transformation.
Dim settings As New XmlReaderSettings()
settings.IgnoreProcessingInstructions = True
settings.ValidationType = ValidationType.None
settings.XmlResolver = Nothing
settings.ProhibitDtd = True

Dim xslt As New XslCompiledTransform()
xslt.Load(xslPath)
Dim ms As MemoryStream = New MemoryStream()
xslt.Transform(New XPathDocument(xmlFragment), Nothing, ms)

' Load the results into an XPathDocument object.
ms.Seek(0, SeekOrigin.Begin)
Dim sr As StreamReader = New StreamReader(ms)
'Dim doc As XPathDocument = New XPathDocument(ms)

Dim xread As XmlReader = XmlReader.Create(sr, settings)
Return xread.ToString

Catch ex As Exception
AppException.LogError("CommonFuncs.TransformXsl: " & ex.Message)
Return Nothing
End Try
End Function


How do I receiving the incoming XML stream and transform it without
validating against the DTD?

Thanks.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
blocking I/O with javax.xml.parsers.DocumentBuilder.parse() and javax.xml.transform.Transformer.transform() jazzdman@gmail.com Java 1 03-27-2005 06:56 AM
How to specify DTD to DTD.getDTD for DocumentParser? Ronald Fischer Java 4 03-17-2005 09:37 AM
Removing the dtd name when using print(...) on the dtd generated class Joseph Tilian Java 0 12-21-2004 02:58 PM
Ignore DTD pi in xsl transform? KatB ASP .Net 1 10-29-2003 02:11 AM



Advertisments