Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XmlValidatingReader schemas folder

From: "Andres Felipe Arguello" <felipe.arguello@-----.--->
To: NULL
Date: 8/3/2004 11:40:00 AM
OK, the problem is the next,
I have a receive function with a filewatcher class in c#, this service
receives 15 differents XML based on a standards deffinitions XSD, of the UCC
Council.
When i validate this using the normal validator is OK, using http...... in
the schema URI in the header of each document.
But in production i need to validate against a local path, because i dont
have net access. Then i implement the schema collection to load all the
schemas in the cache, another problem is that XSDs imports internally others
XSD in subfolders, and that around 50 XSDs.
this is my code
o_DirInfo = new DirectoryInfo (pathSch);

arr_FileInfo = o_DirInfo.GetFiles ();

foreach (FileInfo fi in arr_FileInfo)

{

xsc.Add(null, fi.FullName); //XSD schema

}

XmlTextReader sr=new XmlTextReader(fileName);

XmlValidatingReader xr=new XmlValidatingReader(sr);

xr.ValidationType=ValidationType.Schema;

xr.ValidationEventHandler +=new ValidationEventHandler(errorHandler);

xr.Schemas.Add(xsc);

try

{

m_isValid=true;

while(xr.Read() && m_isValid) {}

}

catch

{

m_isValid=false;

}

xr.Close();

return m_isValid;

but in this case i found an error, the components.xsd is a xsd that are
called via the import in the xsd load in the schemacollection

Error Validando Schemas en la salida

Error: Type 'DocumentStatusListType' is not declared or not a simple type.
An error occurred at file:///C:/IACCabasnet/Schemas132/Components.xsd(126,
4).

I will appreciate any suggestions to this problem, already my only solution
is take the production server outside the firewall to give net access. but
this is not the best solution for this.

"Zafar Abbas [MSFT]" <zafara@m...> wrote in message
news:edGhhyPeEHA.3732@T......
> I do not understand what you mean by the Schemas folder path.
>
> If you mean the property XmlValidatingReader.Schemas, then that property
is
> not a Path but a reference to the XmlSchemaCollection object associated
with
> the reader.
>
> What you could do it, in case the internet connection is down, load the
> Schemas property of the reader by the schemas in the local folder and
assign
> it to the reader like:
>
> XmlSchemaCollection collection = new XmlSchemaCollection();
> collection.Add(...);
> collection.Add(...);
>
> XmlValidatingReader.Schemas.Add(collection);
>
> This WILL validate your document even though you have schemaLocation
> pointing to internet location. but you still will see the validation
> warnings telling you that the file on the internet locations are not
found.
> You can choose to ignore these warnings. Validation will still be
performed
> using the attached schema collection
>
>
>
> "Andres Felipe Arguello" <felipe.arguello@c...> wrote in message
> news:%23a7cy6NeEHA.3864@T......
> > Hello, i have a file watcher service who receives around 15 different
xml
> > documents, the documents point to an internet schemas uri in the header,
> it
> > works ok,  but in this case my production server doesnt have internet
> > connection and i need to validate this files with the schemas saved in a
> > local folder,(around 60 schemas), then i need to change the schemas
folder
> > path to that folder path, without inlcuding one by one all the schemas
in
> > the schemacollection.
> > Can i do that? if not what is best solution for this problem?
> >
> >
> >
>
>




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