Because you can not restrict a simple type to a complex type (in your case, "string" to "phone"), the complex type needs to be written like this:
<element name="phone">
<complexType>
<simpleContent>
<restriction base="xsd:anyType">
<simpleType>
<restriction base="xsd:string">
<xsd:pattern ..../>
</restriction>
</simpleType>
<attribute name="type" ..../>
</restriction>
.....
> Also what about defining the PCData for a mixed content complexType, is this
> definable?
I suppose you want to use simple type to describe textual data in mixed complex types. No, this is not supported by schema.
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
[EMAIL PROTECTED]
"Dave Brosius"
<[EMAIL PROTECTED]>
03/30/2005 11:37 PM
|
|
Thanks!
Does this mean that lets say phone number is a pattern based restriction,
you can't put the <restriction> here, say like
<element name="phone">
<complexType>
<simpleContent>
<restriction base="xsd:string">
<xsd:pattern ..../>
</restriction>
<attribute name="type" ..../>
.....
but instead need to define a separate type?
Also what about defining the PCData for a mixed content complexType, is this
definable?
----- Original Message -----
From: Sandy Gao
To: [EMAIL PROTECTED]
Sent: Wednesday, March 30, 2005 9:51 PM
Subject: Re: [OT] PCDATA Schema in complexTypes
Complex type with simple content is what you need. You can get one by
extending a simple type. For your example, assume you have a PhoneNumber
simple type for 555-1212, then you can
<element name="phone">
<complexType>
<simpleContent>
<extension base="my:PhoneNumber">
<attribute name="type" .../>
HTH,
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
[EMAIL PROTECTED]
"Dave Brosius" <[EMAIL PROTECTED]>
03/30/2005 09:42 PM Please respond to
xerces-j-user
To<[EMAIL PROTECTED]>
cc
Subject[OT] PCDATA Schema in complexTypes
Sorry for the off topic-ness, couldn't think where else to ask this.
With a schema definition for a complexType, can you define the simpleType
part of it?
It really seems silly when the content is mixed, but if a complexType is
only complex because it has attributes
i could see wanting to define the simpleContent part
<phone type="pulse">555-1212</phone>
how do you schema-ize the 555-1212 part?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]