我对XML完全陌生,我正试图把基本知识弄清楚。这是ComplexType的模型。我不明白,我怎么能读到内容部分。问题列表,wich元素可以包含ComplexType )。
<complexType
abstract = Boolean : false
block = (#all | List of (extension | restriction))
final = (#all | List of (extension | restriction))
id = ID
mixed = Boolean : false
name = NCName
{any attributes with non-schema Namespace...}>
Content: (annotation?, (simpleContent | complexContent | ((group | all |
choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?))))
</complexType>complexType中模型语法中的下列符号或运算符ar
? = ( one or no of this element)
* = ( several or no of this element)
no operator = ( does mean one of this element)
| = ( is this e OR ? )我尝试了以下组合,这是可能的:
annotation, simpleContent
simpleContent
annotation, complexContent
complexContent在下面的组合中,我们是否可以放置代替序列,还有这个精灵,群,所有,选择(我忽略了anyAttribut元素)
annotation,sequence,attributeA,attributeB,attributeGroupeA
sequence,attributeA,attributeB,attributeGroupeA
attributeA,attributeB,attributeGroupeA
attributeA
attributeGroupeA正如我们所看到的,有可能有这样的组合,attributeA,attributeB,attributeGroupeA,这就是我在wiche的概念中的要点--我在“模型语法”中不理解。
((attribute | attributeGroup)*, anyAttribute?))由于使用了\x符号,因此不可能有以下组合
attributeA,attributeB,attributeGroupeA我读错什么了?
(attribute | attributeGroup)*这个语法对我来说意味着。我有以下可能的组合
attributeA,attributeB
attribute
attributeGroupeA,attriubteGroupeB
attributeGroupeA发布于 2013-09-29 14:35:42
将(attribute | attributeGroup)理解为允许attribute或attributeGroup。
将(attribute | attributeGroup)*理解为允许零或多个attribute或attributeGroup。每次您返回到另一个可能出现的attribute或attributeGroup时,您可以再次选择其中之一。因此,该构造允许在任何attribute中任意序列为零或多个或。
因此,以完整的XML术语来说,BNFforcomplexType支持以下Type定义
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.0">
<xs:attributeGroup name="AttributeGroupXY1">
<xs:attribute name="attributeX1"/>
<xs:attribute name="attributeY1"/>
</xs:attributeGroup>
<xs:attributeGroup name="AttributeGroupXY2">
<xs:attribute name="attributeX2"/>
<xs:attribute name="attributeY2"/>
</xs:attributeGroup>
<xs:complexType name="Type">
<xs:attribute name="attributeA"/>
<xs:attribute name="attributeB"/>
<xs:attributeGroup ref="AttributeGroupXY1"/>
<xs:attribute name="attributeC"/>
<xs:attributeGroup ref="AttributeGroupXY2"/>
</xs:complexType>
</xs:schema>https://stackoverflow.com/questions/19077903
复制相似问题