You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Dave Brosius <db...@qis.net> on 2005/03/31 04:42:43 UTC

[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?


Re: [OT] PCDATA Schema in complexTypes

Posted by Sandy Gao <sa...@ca.ibm.com>.
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
sandygao@ca.ibm.com




"Dave Brosius" <db...@qis.net> 
03/30/2005 11:37 PM
Please respond to
xerces-j-user


To
<xe...@xml.apache.org>
cc

Subject
Re: [OT] PCDATA Schema in complexTypes






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: xerces-j-user@xml.apache.org
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
sandygao@ca.ibm.com



"Dave Brosius" <db...@qis.net>
03/30/2005 09:42 PM Please respond to
xerces-j-user

To<xe...@xml.apache.org>
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: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org



Re: [OT] PCDATA Schema in complexTypes

Posted by Dave Brosius <db...@qis.net>.
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: xerces-j-user@xml.apache.org
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
sandygao@ca.ibm.com



"Dave Brosius" <db...@qis.net>
03/30/2005 09:42 PM Please respond to
xerces-j-user

To<xe...@xml.apache.org>
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: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: [OT] PCDATA Schema in complexTypes

Posted by Sandy Gao <sa...@ca.ibm.com>.
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
sandygao@ca.ibm.com




"Dave Brosius" <db...@qis.net> 
03/30/2005 09:42 PM
Please respond to
xerces-j-user


To
<xe...@xml.apache.org>
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?