Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Thu, 2 Jul 2009 05:29:01 -0700,    group: microsoft.public.dotnet.xml        back       


XmlReader.Read produce an exception   
Hi

We have the following problem:
We get at the validation of an XML file against the corresponding schema
an internal exception in the XML reader. (Validation of an XML file 
according to
MSDN Help)
The exception occurs also in the Visual Studio designer, this exception 
appears in the
Error list when the XML file is loaded with the schema.
The XML and the schema should be valid.

It occurs with the following XML file and schema: open Trans 2.1fd
-> Http://www.opentrans.org/
-> \ Documents and files \ files openTRANS 2.1 \ openTRANS 2.1 (final draft 
- draft) \ openTRANS 2.1fd english all-in-one package

These are the schema and a sample file, which we want to validate.

Can someone confirm this error?

How can I fix this error in Visual Studio or in my code?

Bye
knoxi
date: Thu, 2 Jul 2009 05:29:01 -0700   author:   knoxi

Re: XmlReader.Read produce an exception   
knoxi wrote:

> We have the following problem:
> We get at the validation of an XML file against the corresponding schema
> an internal exception in the XML reader. (Validation of an XML file 
> according to
> MSDN Help)
> The exception occurs also in the Visual Studio designer, this exception 
> appears in the
> Error list when the XML file is loaded with the schema.

Which exception exactly do you get?
Which code exactly do you use to try to validate?



-- 

	Martin Honnen --- MVP XML
	http://msmvps.com/blogs/martin_honnen/
date: Thu, 02 Jul 2009 14:56:05 +0200   author:   Martin Honnen

Re: XmlReader.Read produce an exception   
"Martin Honnen" wrote:
 
> Which exception exactly do you get?

Object reference not set to an instance of an object

> Which code exactly do you use to try to validate?

I used following code:
	
	Dim XMLDoc As IO.TextReader = New IO.TextReader(pathXMLfile)
	Dim schemaSet As New Xml.Schema.XmlSchemaSet()
        schemaSet.Add(Nothing, New XmlTextReader(New IO.StringReader(strXSD)))
        schemaSet.Compile()

        'define settings for load xml
        Dim settings As New Xml.XmlReaderSettings
        AddHandler settings.ValidationEventHandler, AddressOf 
ValidationCallBack
        settings.ValidationType = Xml.ValidationType.Schema
        settings.ValidationFlags = 
Xml.Schema.XmlSchemaValidationFlags.ReportValidationWarnings
        settings.Schemas = schemaSet

        'load xml
        m_xmlReader = New Xml.XmlTextReader(XMLDoc)
        Using xmlReader As Xml.XmlReader = Xml.XmlReader.Create(m_xmlReader, 
settings)
            'read xml with validation
            Do While xmlReader.Read() '-> here the exception occures when 
the reader steps over xml-line 32 (element: PHONE)
                ' step over xml file
            Loop
        End Using

Bye 
knoxi
date: Thu, 2 Jul 2009 07:01:09 -0700   author:   knoxi

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us