XSD中IDREF和IDREFS有什么区别?

时间:2022-07-10 22:26:31

What is the difference between IDREF and IDREFS in XSD?
I know they both reference the ID attribute, but what is the difference? When each one of them is used?

XSD中IDREF和IDREFS有什么区别?我知道他们都引用了ID属性,但有什么区别?当他们每个人使用?

1 个解决方案

#1


12  

An attribute of type IDREF is a reference to some other element with an attribute of type ID.

IDREF类型的属性是对具有ID类型属性的其他元素的引用。

An attribute of type IDREFS is a list of references to elements with ID attributes, separate by spaces.

IDREFS类型的属性是具有ID属性的元素的引用列表,由空格分隔。

An example:

一个例子:

You're creating a family tree. Each person has 2 parents, a mother and a father. This would be denoted by IDREFS like so:

你正在创建一个家谱。每个人有2个父母,一个母亲和一个父亲。这将由IDREFS表示如下:

<person person_id="e10001" parent_id="e10002 e10003">

with

  <!ATTLIST person
person_id ID #REQUIRED
parent_id IDREFS #IMPLIED>

#1


12  

An attribute of type IDREF is a reference to some other element with an attribute of type ID.

IDREF类型的属性是对具有ID类型属性的其他元素的引用。

An attribute of type IDREFS is a list of references to elements with ID attributes, separate by spaces.

IDREFS类型的属性是具有ID属性的元素的引用列表,由空格分隔。

An example:

一个例子:

You're creating a family tree. Each person has 2 parents, a mother and a father. This would be denoted by IDREFS like so:

你正在创建一个家谱。每个人有2个父母,一个母亲和一个父亲。这将由IDREFS表示如下:

<person person_id="e10001" parent_id="e10002 e10003">

with

  <!ATTLIST person
person_id ID #REQUIRED
parent_id IDREFS #IMPLIED>