Re: Simple question on elements constraints

"Henry S. Thompson" wrote:

> <snip>
>
> There is no difference between absent and empty.  The infoset for that
> element has no children.  So following clauses [1] [2] will apply,
> _provided_ the element has a simple type definition, e.g. you need to
> modify your example slightly to
>
>  <xs:element name="weather" type="xs:token" fixed="wet"/>
>
>   If the declaration has a {value constraint}, then provided clause
>   1.2.2 has not obtained . . .
>    3.2
>      If the {value constraint} is fixed, the element information item
>      must have no element information item [children], and the
>      normalized value must be either empty or match the string of the
>      {value constraint};
>
>    If an element information item is valid with respect to an element
>    declaration as per Element Locally Valid (Element) (§3.3) and the
>    {value constraint} is present, but clause 1.2.2 of Element Locally
>    Valid (Element) (§3.3) above does not obtain and the element
>    information item has no element or character information item
>    [children], the post-schema-validation infoset has the {value
>    constraint}'s string as the item's [schema normalized value]
>    property and its [specified] is set to schema. Otherwise, the
>    item's [specified] is set to instance.
>
> ht
>
> [1] http://www.w3.org/TR/xmlschema-1/#cvc-elt
> [2] http://www.w3.org/TR/xmlschema-1/#sic-eltDefault

sigh, one day i'll get my terminology correct.  I realize there is no difference
between absence, empty content and empty.  But is there a difference between
absence and an _empty_string_?  In this thread is appears that <weather></weather>
represents absence, but in another post [
http://lists.w3.org/Archives/Public/xmlschema-dev/2001Jan/0145.html ], it implies
<weather></weather> has actual content, ie is _not_ absent, and the child
character information item is an empty string.

So if I change the example to:
<xs:element name="weather" type="condition" default="wet"/>
<xs:simpleType name = "condition">
  <xs:restriction base="xs:string">
    <xs:enumeration value = "wet"/>
    <xs:enumeration value = ""/>
    <xs:enumeration value = "dry"/>
  </xs:restriction>
</xs:simpleType>

And the instance is <weather></weather>.  What is the value of the weather? is is
"wet" or ""?

thanks for your patience,
mick.

Received on Tuesday, 30 January 2001 02:07:04 UTC