Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xml validation using inline reference

Status
Not open for further replies.

ttdobj

Technical User
Sep 30, 2002
63
GB
We have an xml file with a reference to the xsd.

In the VB code we ask for the xml file, which we want to load into a dataset at a later stage. But to validate the xml file against the xsd, it seems that I need to specify the location of the xsd in the VB code.

Why can't the xml methods pick up the location from the reference in the xml file?

Here is the code:

Dim MyXmlDataDocument As XmlDataDocument
Dim MyValidationEventHandler As New ValidationEventHandler(AddressOf MyValidator)

MyXmlDataDocument = New XmlDataDocument
MyXmlDataDocument.Load(ImportedFileNameAndPath)
MyXmlDataDocument.Validate(MyValidationEventHandler)
MyDataSet = MyXmlDataDocument.DataSet
...

End Sub
Private Sub MyValidator( ...
...
End Sub

What am I doing wrong?

Any help would be appreciated

John


 
Could you show a basic outline of your XML, especially how you are setting up the inline schema?



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
This is an example of the xml:

<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSPY v5 rel. 2 U (<REPORT_LOCATION xmlns:xsi=" xsi:noNamespaceSchemaLocation="Location.xsd">
<CITY ID_CITY="Strin">
<LOCATION ID_LOCATION="Strin">
<SHORT_NAME_LOC>String</SHORT_NAME_LOC>
<DESC_LOCATION>String</DESC_LOCATION>
</LOCATION>
</CITY>
</REPORT_LOCATION>

Ta

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top