ironfelix717
Registered User.
- Local time
- Today, 08:02
- Joined
- Sep 20, 2019
- Messages
- 193
Hi all,
I am attempting validation of a XML (KML) via MSXML2 against a cached copy of the official XSD
Here is validation code. The runtime error I receive complains about an 'undeclared XSD element' and then the atom namespace in the schema/file.
The KML validates against the XSD with web based 3rd party tools. Perhaps MSXML2's validation proc is just another 'great work' of MS
Either way, I am inquiring about how to resolve this issue, so I can check the validation of this file.
Heres the sub, a sample KML file can be downloaded on google for testing...
Thanks in advance for looking
Related links:
I am attempting validation of a XML (KML) via MSXML2 against a cached copy of the official XSD
Here is validation code. The runtime error I receive complains about an 'undeclared XSD element' and then the atom namespace in the schema/file.
The KML validates against the XSD with web based 3rd party tools. Perhaps MSXML2's validation proc is just another 'great work' of MS
Either way, I am inquiring about how to resolve this issue, so I can check the validation of this file.
Heres the sub, a sample KML file can be downloaded on google for testing...
Thanks in advance for looking
Code:
Sub validateXMLDoc()
'Schema
Dim SCHEMA_LOCATION As String
Dim SCHEMA_NAMESPACE As String
Dim XML_LOCATION As String
'enter inputs here:
XML_LOCATION = "\\Mac\home\desktop\KML_samples.kml"
SCHEMA_LOCATION = "\\Mac\Home\Desktop\Schema.xsd"
SCHEMA_NAMESPACE = "http://www.opengis.net/kml/2.2"
Dim objSchemaCache As Object
Set objSchemaCache = New XMLSchemaCache60
objSchemaCache.Add SCHEMA_NAMESPACE, SCHEMA_LOCATION
Dim objerr As MSXML2.IXMLDOMParseError2
'XML Document
Dim xmlDoc As MSXML2.DOMDocument60
Set xmlDoc = New MSXML2.DOMDocument60
Set xmlDoc.schemas = objSchemaCache
xmlDoc.async = False ': xmlDoc.validateOnParse = False
xmlDoc.Load (XML_LOCATION)
With xmlDoc
.SetProperty "MultipleErrorMessages", True
Set objerr = .Validate()
End With
Dim oErr As Object
'Error code : Reason along with Line Number
For Each oErr In objerr.allErrors
MsgBox "Error parser: " & " " & oErr.line & oErr.errorCode & "; " & oErr.reason
Next oErr
Set xmlDoc = Nothing
End Sub
Related links:
Using Open GIS’s KML Schema Definition (ogckml22.xsd), Microsoft.Net XML Schema Definition Tool Fails
In brief, on one hand, I expect Open GIS’s KML Schema Definition, i.e. ogckml22.xsd, to be rock solid; fully debugged. Likewise, Microsoft.Net’s XSD XML Schema Definition tool (https://docs.micro...
gis.stackexchange.com