Click here to Skip to main content
15,898,222 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# Excel Chart Series Option (Change Second Plot value) Pin
fjlv200516-Oct-08 17:29
fjlv200516-Oct-08 17:29 
QuestionSend MMS in C# Pin
nageshwaran16-Oct-08 16:37
nageshwaran16-Oct-08 16:37 
AnswerRe: Send MMS in C# Pin
Simon P Stevens16-Oct-08 22:09
Simon P Stevens16-Oct-08 22:09 
QuestionCrystal Report - treeview Pin
nelsonpaixao16-Oct-08 14:22
nelsonpaixao16-Oct-08 14:22 
QuestionHow to Clear WebBrowser control 'Cache'? Pin
Trapper-Hell16-Oct-08 12:57
Trapper-Hell16-Oct-08 12:57 
AnswerRe: How to Clear WebBrowser control 'Cache'? Pin
aj.esler17-Oct-08 3:11
aj.esler17-Oct-08 3:11 
QuestionRe: How to Clear WebBrowser control 'Cache'? Pin
dialaya13-Oct-09 4:06
dialaya13-Oct-09 4:06 
QuestionXmlReaderSettings does not resolve an xs:import with http://... location Pin
giangilpredo16-Oct-08 11:33
giangilpredo16-Oct-08 11:33 
Hi,

I'm trying to validate an Xml document using an XmlReader. Here is my code:



private void Validate(TextReader source, string xsd)

{

XmlReaderSettings settings = new XmlReaderSettings();

XmlUrlResolver resolver = new XmlUrlResolver();

settings.ProhibitDtd = false;

resolver.Credentials = CredentialCache.DefaultCredentials;

settings.XmlResolver = resolver;

settings.ValidationFlags = XmlSchemaValidationFlags.ProcessSchemaLocation;

settings.ValidationFlags |= XmlSchemaValidationFlags.ReportValidationWarnings;

settings.Schemas.XmlResolver = resolver;

settings.Schemas.Add(null, xsd);

settings.Schemas.Compile();

//settings.Schemas.Add(null, http://www.w3.org/2001/xml.xsd);

settings.ValidationType = ValidationType.Schema;

settings.ValidationEventHandler += ValidationHandler;

XmlReader reader = XmlReader.Create(source, settings);

while (reader.Read())

{

}



}



The xsd of the xml document I want to validate contains an xs:import that points to local xsd (the schemaLocation is, as example "./dc.xsd"). This xsd imports serveral other xsd, one of which is the following:



<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.w3.org/2001/03/xml.xsd">
</xs:import>



When settings.Schemas.Add(null,xsd) is executed, all nested LOCAL xsd are correctly resolved by the XmlUrlResolver I created. If i inspect during debug my XmlReaderSetting instance i can see tha all the required xsd are correctly loaded, EXCEPT http://www.w3.org/2001/03/xml.xsd. Then settings.Schemas.Compile() is executed, an exception is raised telling me that the attribute xml:lang is not defined (it's defined in the missing xsd).

This exception is not raised, and validaion is performed correctly, if i manually add the namespace (see the commented line of my code), or if i change the scema location in the xsd file to point to a local copy of xml.xsd (schemaLocation="./xml.xsd").



I would like to know how can I make this work, because i don't want to add manually anything related to this specific scenario (i.e. i would like to reuse the code). In other words, why this remote location is not resolved?
QuestionUrgent help req.How to close an Oracle connection when network gets disconnected Pin
ravindradonkada16-Oct-08 11:10
ravindradonkada16-Oct-08 11:10 
AnswerRe: Urgent help req.How to close an Oracle connection when network gets disconnected Pin
Richard Wray18-Feb-10 14:46
Richard Wray18-Feb-10 14:46 
Question.NET Windows Service Installer Pin
TigerNinja_16-Oct-08 10:46
TigerNinja_16-Oct-08 10:46 
AnswerRe: .NET Windows Service Installer Pin
Dave Kreskowiak16-Oct-08 10:56
mveDave Kreskowiak16-Oct-08 10:56 
GeneralRe: .NET Windows Service Installer Pin
TigerNinja_17-Oct-08 3:09
TigerNinja_17-Oct-08 3:09 
JokeRe: .NET Windows Service Installer Pin
PIEBALDconsult16-Oct-08 16:57
mvePIEBALDconsult16-Oct-08 16:57 
GeneralRe: .NET Windows Service Installer Pin
TigerNinja_17-Oct-08 3:11
TigerNinja_17-Oct-08 3:11 
Questioncapture output from windows program Pin
Axell16-Oct-08 10:40
Axell16-Oct-08 10:40 
AnswerRe: capture output from windows program Pin
Dave Kreskowiak16-Oct-08 10:52
mveDave Kreskowiak16-Oct-08 10:52 
AnswerRe: capture output from windows program Pin
PIEBALDconsult16-Oct-08 16:58
mvePIEBALDconsult16-Oct-08 16:58 
GeneralRe: capture output from windows program Pin
Simon P Stevens16-Oct-08 22:06
Simon P Stevens16-Oct-08 22:06 
QuestionHow can I change these VB.net to C# codes? Pin
ATC16-Oct-08 10:05
ATC16-Oct-08 10:05 
AnswerRe: How can I change these VB.net to C# codes? Pin
Pete O'Hanlon16-Oct-08 10:09
mvePete O'Hanlon16-Oct-08 10:09 
GeneralRe: How can I change these VB.net to C# codes? Pin
ATC16-Oct-08 10:21
ATC16-Oct-08 10:21 
GeneralRe: How can I change these VB.net to C# codes? Pin
DaveyM6916-Oct-08 10:26
professionalDaveyM6916-Oct-08 10:26 
GeneralRe: How can I change these VB.net to C# codes? Pin
ATC16-Oct-08 10:38
ATC16-Oct-08 10:38 
GeneralRe: How can I change these VB.net to C# codes? Pin
Pete O'Hanlon16-Oct-08 21:57
mvePete O'Hanlon16-Oct-08 21:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.