从VBA访问XSD注释 [英] Access to XSD annotations from VBA

查看:115
本文介绍了从VBA访问XSD注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我目前正在使用VBA中的MSXML6(Excel 2007),而我找不到访问"注释"的方法。节点也不是"appinfo"或"文件"例如:

I'm currently using MSXML6 from VBA (Excel 2007), and I can't find a way to access the "annotation" nodes nor "appinfo" or "documentation" of an element for example:

< xs:annotation>

<xs:annotation>

  < xs:appInfo> W3Schools Note< / xs:appInfo>

  < xs:documentation xml:lang =" en">

  此架构定义了W3Sc hools note!

  < / xs:documentation>

< / xs:annotation>

使用调试器,我可以浏览我的ISchemaElement,但找不到任何包含我错过了什么?如何读取这些注释?

Using the debugger, I can browse my ISchemaElement, but can't find any object which contains the annotations. Am I missing something? How to read those annotations?

提前致谢。

Nicolas

推荐答案

我认为你需要使用
http://msdn.microsoft。 com / en-us / library / windows / desktop / ms766478%28v = vs.85%29.aspx
例如

  Dim myAnnotationDoc As New MSXML2.DOMDocument60

  Dim myAnnotationDoc As New MSXML2.DOMDocument60

  yourSchemaElement.writeAnnotation(myAnnotationsDoc)

  yourSchemaElement.writeAnnotation(myAnnotationsDoc)

然后你可以使用MSXML的普通DOM方法访问注释(例如DOM Level 1 Core和MSXML XPath 1.0(selectNodes,selectSingleNode))在填充的myAnnotationsDoc中。

Then you can access the annotation using the normal DOM methods of MSXML (e.g. DOM Level 1 Core and MSXML XPath 1.0 (selectNodes, selectSingleNode)) in the populated myAnnotationsDoc.

所以基本上创建一个MSXML 6 DOM文档或节点使用注释填充,然后在架构项上调用writeAnnotation方法以填充DOM节点。

So basically create an MSXML 6 DOM document or node to be populated with the annotation, then call the writeAnnotation method on your schema item to populate the DOM node.


这篇关于从VBA访问XSD注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆