2011-10-13 87 views
2

我正在阅读BPMN 2.0的规格。在本规范中,BPMN各部分的定义以XML模式给出。XSD:“name”属性对“anyAttribute”元素意味着什么?

在这些模式之一(表8.3,第54页),我偶然发现了一条线,没有意义对我说:

<xsd:element name="definitions" type="tDefinitions"/> 
    <xsd:complexType name="tDefinitions"> 
    ... 
    <xsd:anyAttribute name="exporter" type="xsd:ID"/> 
    ... 

令我百思不解的是使用“名”属性结合“xsd:anyAttribute”元素。如果我正确理解元素的definition,则其目的是允许使用模式未指定的“未知”属性。那么,将“xsd:anyAttribute”限制为具体名称“exporter”的目的是什么,而不是直接指定具有该名称的(可选)属性?

+0

仔细检查实际的模式文件。这可能是文档中的错误。 –

回答

1

这可能只是文档中的一个错误,他们缩进使用xsd:attribute来声明属性。

xsd:anyAttribute没有@name

<anyAttribute 
    id = ID 
    namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local))) : ##any 
    processContents = (lax | skip | strict) : strict 
    {any attributes with non-schema namespace . . .}> 
    Content: (annotation?) 
</anyAttribute> 
+0

感谢您的确认!这也是我的印象,但我不确定这是否仅仅是XSD理解不足的问题。 ;-) – elsvene

+0

刚刚发现OMG网站上给出的[XML Schemas](http://www.omg.org/spec/BPMN/20100501/BPMN20.xsd)实际上使用'xsd:attribute'而不是'xsd: anyAttribute'!所以@Mads,你是完全正确的,这是规范文件中的错误。 – elsvene

+0

很酷。您应该向发布商发送一条便笺,以提醒他们这一错误,以便他们修复该错误并发布更正的文档。 –

0

anyAttribute元素使作者能够使用未由模式指定的属性来扩展XML文档。

来源:http://www.w3schools.com/schema/el_anyattribute.asp

这里将是你需要知道的一切!你必须看到这个anyAttribute像通配符。

+0

正如我的问题所写,我读了“anyAttribute”的这个定义,并且我很困惑,因为它没有为元素指定一个“name”属性。 – elsvene

+0

是的,它给你的XML空间有任何属性,就像我告诉过你,你可以用它作为通配符。所以属性X或Y并不重要! – Wesley

+0

但它不工作,请参阅http://stackoverflow.com/q/14872678/306488 – lisak