2011-10-13 88 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