XML string to html

S

Spondishy

Hi,

I was wondering if someone could help me out with some sample code. I
am trying to convert and validate some xml text passed in as string.
The methods are as follows:

public string transform(string xml, string xsl)
{

}

public bool validate(string xml, string xsd)
{


}

All samples I have found load the xml and xsl using the load command,
but I'm passing it as a string. If anyone could help fill the blanks
I'd be appreciative.

Thanks.
 
M

Martin Honnen

Spondishy wrote:

public bool validate(string xml, string xsd)
{


}

All samples I have found load the xml and xsl using the load command,
but I'm passing it as a string.

Are you using .NET 1.x or .NET 2.0? With .NET 1.x you need to use
XmlValidatingReader e.g.
XmlValidatingReader reader = new XmlValidatingReader(new
XmlTextReader(new StringReader(xml));
reader.Schemas.Add("targetNamespaceURN", new XmlTextReader(new
StringReader(xsd));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top