|
上网搜了好久,好像还是不太明白怎么回事。附件为我自己编辑的xml和下载的xsd,我用的代码如下,请高手指点一二。
customUI.rar
(9.18 KB, 下载次数: 66)
Function Validate(ByVal xmlFile As String, ByVal xsdFile As String) As Boolean
Dim xDom As DOMDocument, xSchema As XMLSchemaCache
Set xDom = New DOMDocument
xDom.async = False
xDom.Load xmlFile
Set xSchema = New XMLSchemaCache
xSchema.Add xDom.DocumentElement.NamespaceURI, xsdFile
Set xDom.Schemas = xSchema
Validate = xDom.parseError.ErrorCode <> 0
End Function
结果老是在xschema.add xdom.documentelement.namespaceuri,xsdfile这一句的时候提示“架构中根元素的错误定义”
|
|