Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Xml validation fails if connected to the internet

From: George@-----------.---------.---
To: 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


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent