Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Re: XmlValidatingReader schemas folder >Thread Next - Re: XmlValidatingReader schemas folder Re: XmlValidatingReader schemas folderTo: 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?
> >
> >
> >
>
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
