Re: Adding restriction to a complexType

"Kopnicky, Lyle" <[email protected]> Tue, 20 Aug 2013 13:18:11 -0700
Newsgroups gmane.text.xml.schema.devel
Message-ID <CAJTZ5z4APZmRKHiFzg9MP_FVZCgEZgGUS7bLsF0sJkZZtqJKyg@mail.gmail.com>
--001a11c2a58cbf5d9604e466c2ca
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

Could you give an example of what you're trying to allow, and what you mean
by "length" in the presence of mixed content?

I'm imagining you want something like this:

<productName>My Favorite Widget<entityRef ref=3D"trademark"/></productName>

In that case, should the entityRef count as 1 toward the length? Or zero?
Or should it be expanded into some text that is then measured?


On Tue, Aug 20, 2013 at 9:26 AM, Hintz, David <[email protected]>wrot=
e:

>  Hello,****
>
> ** **
>
> Using XML Schema 1.0, I=92m having a problem trying to add a restriction =
to
> a complexType.  I=92ve got this element definition:****
>
> ** **
>
>   <xs:element name=3D"productName">****
>
>     <xs:simpleType>****
>
>       <xs:restriction base=3D"xs:string">****
>
>         <xs:minLength value=3D"1"/>****
>
>         <xs:maxLength value=3D"255"/>****
>
>       </xs:restriction>****
>
>     </xs:simpleType>****
>
>   </xs:element>****
>
> ** **
>
> Obviously, I want =93productName=94 to be a character string of 1 to 255
> characters.  Now, I=92d like to add an element to =93productName=94 =96 f=
or example
> =93entityRef=94 (0 to unbounded occurrences).  So, I=92d need to change
> =93productName=94 to <complexType mixed=3D=94true=94>, but I can=92t figu=
re out how to
> add the element and maintain the restriction for the overall length of
> =93productName=94.  This gets me close, but I lose the restriction:****
>
> ** **
>
>   <xs:element name=3D"productName">****
>
>     <xs:complexType mixed=3D"true">****
>
>       <xs:choice minOccurs=3D"0" maxOccurs=3D"unbounded">****
>
>         <xs:element ref=3D"entityRef"/>****
>
>       </xs:choice>****
>
>     </xs:complexType>****
>
>   </xs:element>****
>
> ** **
>
> Anyone have a simple solution for maintaining the restriction of 1-255
> characters in length?  Or, is this even possible?****
>
> ** **
>
> Thanks,****
>
> ** **
>
> Dave Hintz****
>
> Siemens****
>



--=20
*Lyle Kopnicky*, *Software Engineer*, Janrain, Inc. <http://bit.ly/cKKudR>
E: [email protected] | W: 503-488-6754
Follow Janrain: Facebook <http://bit.ly/9CGHdf> | Twitter<http://bit.ly/9um=
xlK>
 | YouTube <http://bit.ly/N0OiBT> | LinkedIn <http://bit.ly/a7WZMC> |
Blog<http://bit.ly/OI2uOR>
---------------------------------------------------------------------------=
----------
*Acquire, understand, and engage your users. **Watch our
video*<http://bit.ly/janrain-overview>
* or **sign up for a live demo* <http://bit.ly/janraindemo>* to see what
it's all about.*

--001a11c2a58cbf5d9604e466c2ca
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Could you give an example of what you&#39;re trying to all=
ow, and what you mean by &quot;length&quot; in the presence of mixed conten=
t?<div><br></div><div>I&#39;m imagining you want something like this:</div>

<div><br></div><div>&lt;productName&gt;My Favorite Widget&lt;entityRef ref=
=3D&quot;trademark&quot;/&gt;&lt;/productName&gt;</div><div><br></div><div>=
In that case, should the entityRef count as 1 toward the length? Or zero? O=
r should it be expanded into some text that is then measured?</div>

</div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On Tue,=
 Aug 20, 2013 at 9:26 AM, Hintz, David <span dir=3D"ltr">&lt;<a href=3D"mai=
lto:[email protected]" target=3D"_blank">[email protected]</a>&=
gt;</span> wrote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">





<div lang=3D"EN-US" link=3D"blue" vlink=3D"purple">
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">Hello,<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;"><u></u>=A0<u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">Using XML Schema 1.0, I=92m having a prob=
lem trying to add a restriction to a complexType. =A0I=92ve got this elemen=
t definition:<u></u><u></u></span></p>


<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;"><u></u>=A0<u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">=A0 &lt;xs:element name=3D&quot;productNa=
me&quot;&gt;<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">=A0=A0=A0 &lt;xs:simpleType&gt;<u></u><u>=
</u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">=A0=A0=A0=A0=A0 &lt;xs:restriction base=
=3D&quot;xs:string&quot;&gt;<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">=A0=A0=A0=A0=A0=A0=A0 &lt;xs:minLength va=
lue=3D&quot;1&quot;/&gt;<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">=A0=A0=A0=A0=A0=A0=A0 &lt;xs:maxLength va=
lue=3D&quot;255&quot;/&gt;<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">=A0=A0=A0=A0=A0 &lt;/xs:restriction&gt;<u=
></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">=A0=A0=A0 &lt;/xs:simpleType&gt;<u></u><u=
></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">=A0 &lt;/xs:element&gt;<u></u><u></u></sp=
an></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;"><u></u>=A0<u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">Obviously, I want =93productName=94 to be=
 a character string of 1 to 255 characters.=A0 Now, I=92d like to add an el=
ement to =93productName=94 =96 for example =93entityRef=94 (0 to unbounded
 occurrences).=A0 So, I=92d need to change =93productName=94 to &lt;complex=
Type mixed=3D=94true=94&gt;, but I can=92t figure out how to add the elemen=
t and maintain the restriction for the overall length of =93productName=94.=
=A0 This gets me close, but I lose the restriction:<u></u><u></u></span></p=
>


<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;"><u></u>=A0<u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">=A0 &lt;xs:element name=3D&quot;productNa=
me&quot;&gt;<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">=A0=A0=A0 &lt;xs:complexType mixed=3D&quo=
t;true&quot;&gt;<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">=A0=A0=A0=A0=A0 &lt;xs:choice minOccurs=
=3D&quot;0&quot; maxOccurs=3D&quot;unbounded&quot;&gt;<u></u><u></u></span>=
</p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">=A0=A0=A0=A0=A0=A0=A0 &lt;xs:element ref=
=3D&quot;entityRef&quot;/&gt;<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">=A0=A0=A0=A0=A0 &lt;/xs:choice&gt;<u></u>=
<u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">=A0=A0=A0 &lt;/xs:complexType&gt;<u></u><=
u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">=A0 &lt;/xs:element&gt;<u></u><u></u></sp=
an></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;"><u></u>=A0<u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">Anyone have a simple solution for maintai=
ning the restriction of 1-255 characters in length?=A0 Or, is this even pos=
sible?<u></u><u></u></span></p>


<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;"><u></u>=A0<u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">Thanks,<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;"><u></u>=A0<u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">Dave Hintz<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:10.0pt;font-family:&quot;Ar=
ial&quot;,&quot;sans-serif&quot;">Siemens<u></u><u></u></span></p>
</div>
</div>

</blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><strong styl=
e=3D"font-family:Helvetica;font-size:12px">Lyle Kopnicky</strong><span styl=
e=3D"font-family:Helvetica;font-size:12px">,=A0</span><em style=3D"font-fam=
ily:Helvetica;font-size:12px">Software Engineer</em><span style=3D"font-fam=
ily:Helvetica;font-size:12px">,=A0</span><a href=3D"http://bit.ly/cKKudR" s=
tyle=3D"font-family:Helvetica;font-size:12px" target=3D"_blank">Janrain, In=
c.</a><br style=3D"font-family:Helvetica;font-size:12px">

<span style=3D"font-family:Helvetica;font-size:12px">E:=A0</span><a href=3D=
"mailto:[email protected]" style=3D"font-family:Helvetica;font-size:12px" ta=
rget=3D"_blank">[email protected]</a><span style=3D"font-family:Helvetica;fo=
nt-size:12px">=A0| W: 503-488-6754</span><br style=3D"font-family:Helvetica=
;font-size:12px">

<span style=3D"font-family:Helvetica;font-size:12px">Follow Janrain:=A0</sp=
an><a href=3D"http://bit.ly/9CGHdf" style=3D"font-family:Helvetica;font-siz=
e:12px" target=3D"_blank">Facebook</a><span style=3D"font-family:Helvetica;=
font-size:12px">=A0|=A0</span><a href=3D"http://bit.ly/9umxlK" style=3D"fon=
t-family:Helvetica;font-size:12px" target=3D"_blank">Twitter</a><span style=
=3D"font-family:Helvetica;font-size:12px">=A0|=A0</span><a href=3D"http://b=
it.ly/N0OiBT" style=3D"font-family:Helvetica;font-size:12px" target=3D"_bla=
nk">YouTube</a><span style=3D"font-family:Helvetica;font-size:12px">=A0|=A0=
</span><a href=3D"http://bit.ly/a7WZMC" style=3D"font-family:Helvetica;font=
-size:12px" target=3D"_blank">LinkedIn</a><span style=3D"font-family:Helvet=
ica;font-size:12px">=A0|=A0</span><a href=3D"http://bit.ly/OI2uOR" style=3D=
"font-family:Helvetica;font-size:12px" target=3D"_blank">Blog</a><br style=
=3D"font-family:Helvetica;font-size:12px">

<span style=3D"font-family:Helvetica;font-size:12px">----------------------=
---------------------------------------------------------------</span><div>=
<i>Acquire, understand, and engage your users. </i><a href=3D"http://bit.ly=
/janrain-overview" target=3D"_blank"><i>Watch our video</i></a><i> or </i><=
a href=3D"http://bit.ly/janraindemo" target=3D"_blank"><i>sign up for a liv=
e demo</i></a><i> to see what it&#39;s all about.</i></div>


</div>

--001a11c2a58cbf5d9604e466c2ca--