Anita Fohrenkamm wrote:
> Hello,
> 
> Using XXE I can convert several elements into each other if they are
> defined with the same type (e.g. imageObject and imageObjectPw, tab and
> tabPw, numberedList and orderedList).
> 
> But I can not convert the elements xmp and xmpPw into each other, even
> though  they are defind by the same type xmpType. The program in this
> case offers as target element for conversion only the element 'para'.
> Why this conversion is not allowed?
> 
> I use a schema which contains the following code pieces:
> ...
>      <xs:choice minOccurs="0" maxOccurs="unbounded">
>         <xs:element name="para" type="paraType"/>
>         <xs:element name="cePara" type="ceParaType"/>
>         <xs:element name="subTitle" type="subTitleType"/>
>         <xs:element name="imageObject" type="imageObjectType"/>
>         <xs:element name="imageObjectPw" type="imageObjectType"/>
>         <xs:element name="numberedList" type="listType"/>
>         <xs:element name="orderedList" type="listType"/>
>         <xs:element name="tab" type="tabType"/>
>         <xs:element name="tabPw" type="tabType"/>
>         <xs:element name="note" type="noteType"/>
>         <xs:element name="defList" type="defListType"/>
>         <xs:element name="xmp" type="xmpType"/>
>         <xs:element name="xmpPw" type="xmpType"/>
>     </xs:choice>
> ...
>    <xs:complexType name="listType">
>        <xs:sequence>
>            <xs:element name="item" type="itemType"/>
>            <xs:choice minOccurs="0" maxOccurs="unbounded">
>                <xs:element name="item" type="itemType" minOccurs="0"
> maxOccurs="unbounded"/>
>                <xs:element name="subitem" type="subitemType"
> minOccurs="0" maxOccurs="unbounded"/>
>            </xs:choice>
>        </xs:sequence>
>        <xs:attribute name="onlyProject" type="onlyProjectType"
> use="optional"/>
>        <xs:attributeGroup ref="noProjectsAttr"/>
>    </xs:complexType>
> ...
>    <xs:complexType name="xmpType">
>        <xs:simpleContent>
>            <xs:extension base="xs:string">
>                <xs:attribute name="onlyProject" type="onlyProjectType"
> use="optional"/>
>                <xs:attributeGroup ref="noProjectsAttr"/>
>            </xs:extension>
>        </xs:simpleContent>
>    </xs:complexType>
> ...
>    <xs:complexType name="paraType" mixed="true">
>        <xs:sequence minOccurs="0" maxOccurs="unbounded">
>            <xs:choice>
>                <xs:element name="b" type="xs:string"/>
>                <xs:element name="i" type="xs:string"/>
>                <xs:element name="phrase" type="phraseType"/>
>            </xs:choice>
>        </xs:sequence>
>        <xs:attribute name="onlyProject" type="onlyProjectType"
> use="optional"/>
>        <xs:attributeGroup ref="noProjectsAttr"/>
>    </xs:complexType>
> 

This is caused by <xs:extension base="xs:string">. This makes elements
xmp and xmpPw have a content model of type *data* (like a number, a
date, etc). These elements are not eligible as the target of the
conversion.

In your case, the behavior of XXE is pretty stupid, but in the general
case, it makes sense.

If you rewrite xmpType as a mixed, you'll have no such conversion problems:
---
<xs:complexType name="xmpType" mixed="true">
  <xs:attribute name="onlyProject" type="onlyProjectType"
                use="optional"/>
  <xs:attributeGroup ref="noProjectsAttr"/>
</xs:complexType>
---



Reply via email to