473,385 Members | 1,821 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,385 software developers and data experts.

How to prevent DTD validation during transform

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.
Sep 1 '06 #1
0 1125

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

Similar topics

1
by: Ghee | last post by:
Hello, I have a (java) DOM object that adheres to an XML schema. I want to manipulate it in code, but to ensure that the object still sticks to the schema (ie, validation during the life-cycle...
0
by: William Gill | last post by:
I am creating several tkinter widgets. In my classes they each have a change() method that is a callback to various IntVar, and StringVar objects. Everything works fine, but don't really want to...
1
by: jorgen.wahlund | last post by:
Hi I have problems with transforming a xml document with Xalan and javax.xml.Transformer. Following xsl is used: <xsl:stylesheet version='1.0'...
2
by: Shone | last post by:
I would like to perform a 2-pass XML reading from a stream. Once using the Validating reader, just to confirm the validity against the schema, and next time to do a reading to extract the data....
1
by: Tim | last post by:
We have a site under development that uses validation web controls to validate the data entered in text boxes. But when the user changes his mind and presses cancel, or navigates using a hyperlink to...
1
by: Joe.Dattilo | last post by:
Hello, Does anyone know how I can stop the RequiredFieldValidator from validation OnBlur and OnChange. I only want it to validate when the user submits the form (but still want it to run client...
4
by: vandanasridhar | last post by:
Hi, its Vandana. I m a begginer of VB, Trying to create a form Having three command buttons Add, Modify, Exit. I made coding & it is running well, but technically not very sound. I use lost focus...
1
by: brandonjack007 | last post by:
I have a webcontrol that extends from System.Web.UI.WebControls. WebControl. It has 3 drop downlists for day, month, year. The day, month, year then form the property called SelectedDate. The...
1
by: Winston Jones | last post by:
whenever i click the clear button, to clear the forms inputs, the validation message boxes always appear and dont let the user do anything until they are filled. how do i make it so that when i clear...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.