validating if a file is a true valid xml file that fits a certain schema

A

Andy B

I need to make sure that a file saved in a particular place is a valid xml
file that fits a certain schema. Where would I get started doing this? The
original file would have been created and saved with a dataset.
 
C

Cor Ligthert[MVP]

SuturZ,

Can you explain what it does more then my simple line of code in a Try and
Catch?

Cor
 
S

SurturZ

My code tests against a supplied XML Schema.

I don't know if Dataset.ReadXML does that. I've never used Dataset.ReadXML
though, perhaps it is a better approach.

BTW I think in my original post I missed a module level String variable
declaration:

Private mstrValidateXmlFileErrorMessage As String 'used by ValidateXmlFile()

--
David Streeter
Synchrotech Software
Sydney Australia
 
S

SurturZ

I just had a play around with the Dataset XML functions. They are VERY good,
and are the better solution for the OP.

However, they seem to work only for XML/XSDs that have been generated from a
Dataset. If you are sourcing your XML/XSD from a different source, then my
code might be necessary (it can validate any XML file against any schema).

--
David Streeter
Synchrotech Software
Sydney Australia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top