Click here to Skip to main content
15,899,679 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: OOXML parsing problem Pin
don_Pardon21-Oct-08 1:37
don_Pardon21-Oct-08 1:37 
QuestionRe: OOXML parsing problem Pin
led mike21-Oct-08 4:52
led mike21-Oct-08 4:52 
QuestionHandling singleclick and doubleclick events on same line Pin
johnalek18-Oct-08 3:46
johnalek18-Oct-08 3:46 
AnswerRe: Handling singleclick and doubleclick events on same line Pin
Ashfield20-Oct-08 9:32
Ashfield20-Oct-08 9:32 
QuestionGenerate missing XML Pin
Lea Hayes17-Oct-08 2:14
Lea Hayes17-Oct-08 2:14 
AnswerRe: Generate missing XML Pin
Frank Horn17-Oct-08 8:14
Frank Horn17-Oct-08 8:14 
GeneralRe: Generate missing XML Pin
Lea Hayes21-Oct-08 9:43
Lea Hayes21-Oct-08 9:43 
QuestionXmlReaderSettings does not resolve an xs:import with http://... location Pin
giangilpredo16-Oct-08 11:31
giangilpredo16-Oct-08 11:31 
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?
QuestionXML + XSL in a Client Browser Pin
Lea Hayes15-Oct-08 11:21
Lea Hayes15-Oct-08 11:21 
AnswerRe: XML + XSL in a Client Browser Pin
led mike15-Oct-08 11:35
led mike15-Oct-08 11:35 
AnswerRe: XML + XSL in a Client Browser Pin
Steve Marsh21-Oct-08 8:45
Steve Marsh21-Oct-08 8:45 
GeneralRe: XML + XSL in a Client Browser Pin
Lea Hayes21-Oct-08 9:07
Lea Hayes21-Oct-08 9:07 
Questionrelated search Pin
rose19615-Oct-08 2:18
rose19615-Oct-08 2:18 
QuestionRe: related search Pin
led mike15-Oct-08 4:53
led mike15-Oct-08 4:53 
AnswerRe: related search Pin
rose19615-Oct-08 19:24
rose19615-Oct-08 19:24 
GeneralRe: related search Pin
led mike16-Oct-08 4:50
led mike16-Oct-08 4:50 
GeneralXML load in C# fails Pin
hairy_hats15-Oct-08 1:18
hairy_hats15-Oct-08 1:18 
GeneralRe: XML load in C# fails Pin
led mike15-Oct-08 4:52
led mike15-Oct-08 4:52 
GeneralRe: XML load in C# fails Pin
hairy_hats15-Oct-08 5:01
hairy_hats15-Oct-08 5:01 
QuestionXSD.exe XML question Pin
Planker14-Oct-08 5:21
Planker14-Oct-08 5:21 
QuestionXML and performance Pin
pedefetoll7-Oct-08 22:49
pedefetoll7-Oct-08 22:49 
AnswerRe: XML and performance [modified] Pin
led mike8-Oct-08 5:17
led mike8-Oct-08 5:17 
GeneralRe: XML and performance Pin
pedefetoll9-Oct-08 0:00
pedefetoll9-Oct-08 0:00 
QuestionRe: XML and performance Pin
led mike9-Oct-08 4:36
led mike9-Oct-08 4:36 
GeneralRe: XML and performance Pin
Gerald Schwab15-Oct-08 16:57
Gerald Schwab15-Oct-08 16: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.