如何将 GUID simpleType 添加到 XML 模式中?
我正在尝试创建一个 XML 架构,该架构允许将属性值存储为本机格式的 GUID。 我可以将其设置为字符串,但最好将其存储为真正的 GUID。
有什么想法如何去做吗?
I'm trying to create an XML schema, which enables an attribute value to be stored as an GUID in native format. I could set it up as a string, but it would be nice to store it as a real GUID.
Any ideas how to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以通过使用正则表达式限制字符串来定义自己的自定义简单类型“GUID”,如下所示:
You can define your own custom simple type "GUID" by restricting a string using a regular expression like this:
XML 基本上只包含字符串,尽管 XSD 还定义了某些其他基本类型。 然而,GUID 并不在其中。
您可以为 GUID 类型定义自己的架构。 很多人都这样做过。 Microsoft OneNote 团队的做法如下: http://msdn .microsoft.com/en-us/library/aa203890(office.11).aspx。
XML basically contains only strings, although XSD also defines certain other primitive types. GUID, however, is not among them.
You can define your own schema for a GUID type. Lots of people have done this. Here's how the Microsoft OneNote team did it: http://msdn.microsoft.com/en-us/library/aa203890(office.11).aspx.
我已经弄清楚了。 有时阅读文档会有所帮助。 这就是它的工作方式。
I've sussed it out. Sometimes it helps to read the docs. This is how it will work.