name space issue

aakbar

Member
Joined
Mar 7, 2007
Messages
6
Programming Experience
Beginner
I am trying to validate a xml using the validate method. I got this code from MSDN and it works fine.

VB.NET:
[SIZE=2]Dim settings As XmlReaderSettings = New XmlReaderSettings()[/SIZE]
[SIZE=2]       settings.Schemas.Add("http://www.contoso.com/books", "contosoBooks.xsd")[/SIZE]
[SIZE=2]       settings.ValidationType = ValidationType.Schema[/SIZE]
 
[SIZE=2]       Dim reader As XmlReader = XmlReader.Create("contosoBooks.xml", settings)[/SIZE]
[SIZE=2]       Dim document As XmlDocument = New XmlDocument()[/SIZE]
[SIZE=2]       document.Load(reader)[/SIZE]
 
[SIZE=2]       Dim eventHandler As ValidationEventHandler = New ValidationEventHandler(AddressOf ValidationEventHandler)[/SIZE]
[SIZE=2]       document.Validate(eventHandler)[/SIZE]

problem is that i am not building a web application. so i dont have a namespace path to provide in settings.Schemas.Add() method.
I just have an xsd file in my project folder.
Any body could help me what should i pass as namespace. passing "Nothing" also does not work.

Thanks
 
targetNamespace: The schema targetNamespace property, or a null reference (Nothing in Visual Basic) to use the targetNamespace specified in the schema.
Did you try 'Nothing' value?
 
Back
Top