Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries [Thread Prev] >Thread Next - RE: Xml validation fails if connected to the internet Xml validation fails if connected to the internetTo: NULL Date: 10/4/2006 12:49:00 AM
Hello,
I have manageg to create a validator, to validate an xml file with multiple
schemas(17 xsd files). I have 4 xsd files that are simple. One other xsd file
imports another xsd file directly from the file. for example,
<xsd:import namespace="http://www.xbrl.org/2003/instance"
schemaLocation="http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd"/>
<xsd:import
namespace="http://www.c-ebs.org/eu/fr/esrs/corep/2006-07-01/p-me-2006-07-01"
schemaLocation="p-me-2006-07-01.xsd"/>
The "p-me" schema file imports another xsd file and so on. So i have like a
tree of xsd files. The problem is, when i try to run my program without being
on the internet, it runs perfectly. However, when i try to run it when being
on the internet, it fails , saying duplicate declarations.
In my program, (visual studio 2005 vb) , i am using a xmlschemaset in which
i load all of the files that are declared in the xmlns:___... part of the
instance. ie
sc.Add("http://www.xbrl.org/2003/instance",
"C:\xbrl\COREPTaxonomy1.2\xbrl-instance-2003-12-31.xsd")
I then use the following code , before i start reading the xml.
Dim settings As XmlReaderSettings = New XmlReaderSettings()
settings.IgnoreWhitespace = True
settings.IgnoreComments = True
settings.Schemas = sc
settings.ProhibitDtd = False
settings.ValidationFlags =
XmlSchemaValidationFlags.ReportValidationWarnings
settings.ValidationFlags =
XmlSchemaValidationFlags.ProcessSchemaLocation
settings.ValidationFlags = XmlSchemaValidationFlags.AllowXmlAttributes
settings.ValidationType = ValidationType.Schema
'MKR_SA_EQU_instance.xml
AddHandler settings.ValidationEventHandler, AddressOf
SchemaValidationEventHandler
Dim reader As XmlReader =
XmlReader.Create("C:\xbrl\COREPTaxonomy1.2\MKR_SA_EQU_instance.xml", settings)
Dim manager As XmlNamespaceManager = New XmlNamespaceManager(reader.NameTable)
manager.AddNamespace("d-mr",
"http://www.c-ebs.org/eu/fr/esrs/corep/2006-07-01/d-mr-2006-07-01")
manager.AddNamespace("d-ty",
"http://www.c-ebs.org/eu/fr/esrs/corep/2006-07-01/d-mr-2006-07-01")
manager.AddNamespace("iso4217", "http://www.xbrl.org/2003/iso4217")
Dim validator As XmlSchemaValidator = New
XmlSchemaValidator(reader.NameTable, sc, manager, settings.ValidationFlags)
(SchemaValidationEventHandler)
validator.Initialize()
AddHandler validator.ValidationEventHandler, AddressOf
SchemaValidationEventHandler
I then use , while reader.read
'do validations
end while
Can anybody help ?
Thank you
George
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
