You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Simon Laws <si...@googlemail.com> on 2006/06/28 16:04:35 UTC
[Java/SDO] is xsi:type on root element suported?
If I read the following doc:
<tns:RootElement xmlns:p="commonj.sdo"
xmlns:tns="http://www.apache.org/tuscany/interop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.apache.org/tuscany/interop interop01.xsd
">
<SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
</tns:RootElement>
With the following schema
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.apache.org/tuscany/interop"
xmlns:tns="http://www.apache.org/tuscany/interop">
<include schemaLocation="interop10.xsd"/>
<!-- top level test type -->
<complexType name="ComplexTypeRootType">
<sequence>
<!-- simple types -->
<element name="SimpleTypeWithName" type="tns:SimpleTypeWithNameType"/>
</sequence>
</complexType>
<element name="RootElement" type="tns:ComplexTypeRootType"/>
</schema>
The I get a valid document (doc) with some data objects in it out of the
following code:
FileInputStream inFileStream = new FileInputStream (inFileName);
XMLDocument doc = XMLHelper.INSTANCE.load(inFileStream);
If I try in read in (note I have added and xsi:type attribute):
<tns:RootElement xmlns:p="commonj.sdo"
xsi:type="tns:ComplexTypeRootType"
xmlns:tns="http://www.apache.org/tuscany/interop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.apache.org/tuscany/interop interop01.xsd
">
<SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
</tns:RootElement>
The XMLHelper silently makes an empty document, i.e. the root element is
null. Is this by design? I.e. is xsi:type unsupported?
Regards
Simon
Re: [Java/SDO] is xsi:type on root element suported?
Posted by Simon Laws <si...@googlemail.com>.
OK, thanks Frank, I tried that and the effect is the same regarless of
whether the xsi:type reference to an extension or not. xsi:type does work
with both extensions and base classes if it's used on an element that is not
the root element. I have opened a jira (505) and added this information.
Regards
Simon
On 6/28/06, Frank Budinsky <fr...@ca.ibm.com> wrote:
>
> Hi Simon,
>
> I think it should work. Your example is a little strange in that the
> xsi:type is the same as the actual element type. Usually the xsi:type is
> used to identify a subtype, so maybe the implementation has a bug that
> only turns up in this case.
>
> Is there someone with more XML expertise then me that knows if xsi:type
> equal to the actual type is valid XML?
>
> Could you please try changing your example to include a subtype:
>
> <complexType name="ExtendedComplexTypeRootType">
> <complexContent>
> <xsd:extension base="tns:ComplexTypeRootType"/>
> </complexContent>
> </complexType>
>
> and then use it as the xsi:type in your instance.
>
> I think that should definitely work.
>
> Also, could you please open a JIRA for this issue.
>
> Thanks,
> Frank.
>
> "Simon Laws" <si...@googlemail.com> wrote on 06/28/2006 10:04:35 AM:
>
> > If I read the following doc:
> >
> > <tns:RootElement xmlns:p="commonj.sdo"
> > xmlns:tns="http://www.apache.org/tuscany/interop"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:schemaLocation="http://www.apache.org/tuscany/interop
> interop01.xsd
> > ">
> > <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
> > </tns:RootElement>
> >
> > With the following schema
> >
> > <schema xmlns="http://www.w3.org/2001/XMLSchema"
> > targetNamespace="http://www.apache.org/tuscany/interop"
> > xmlns:tns="http://www.apache.org/tuscany/interop">
> >
> > <include schemaLocation="interop10.xsd"/>
> >
> > <!-- top level test type -->
> > <complexType name="ComplexTypeRootType">
> > <sequence>
> > <!-- simple types -->
> > <element name="SimpleTypeWithName"
> type="tns:SimpleTypeWithNameType"/>
> >
> > </sequence>
> > </complexType>
> >
> > <element name="RootElement" type="tns:ComplexTypeRootType"/>
> > </schema>
> >
> > The I get a valid document (doc) with some data objects in it out of the
> > following code:
> >
> > FileInputStream inFileStream = new FileInputStream (inFileName);
> > XMLDocument doc = XMLHelper.INSTANCE.load(inFileStream);
> >
> > If I try in read in (note I have added and xsi:type attribute):
> >
> > <tns:RootElement xmlns:p="commonj.sdo"
> > xsi:type="tns:ComplexTypeRootType"
> > xmlns:tns="http://www.apache.org/tuscany/interop"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xsi:schemaLocation="http://www.apache.org/tuscany/interop
> interop01.xsd
> > ">
> > <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
> > </tns:RootElement>
> >
> > The XMLHelper silently makes an empty document, i.e. the root element is
> > null. Is this by design? I.e. is xsi:type unsupported?
> >
> > Regards
> >
> > Simon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>
Re: [Java/SDO] is xsi:type on root element suported?
Posted by Frank Budinsky <fr...@ca.ibm.com>.
Hi Simon,
I think it should work. Your example is a little strange in that the
xsi:type is the same as the actual element type. Usually the xsi:type is
used to identify a subtype, so maybe the implementation has a bug that
only turns up in this case.
Is there someone with more XML expertise then me that knows if xsi:type
equal to the actual type is valid XML?
Could you please try changing your example to include a subtype:
<complexType name="ExtendedComplexTypeRootType">
<complexContent>
<xsd:extension base="tns:ComplexTypeRootType"/>
</complexContent>
</complexType>
and then use it as the xsi:type in your instance.
I think that should definitely work.
Also, could you please open a JIRA for this issue.
Thanks,
Frank.
"Simon Laws" <si...@googlemail.com> wrote on 06/28/2006 10:04:35 AM:
> If I read the following doc:
>
> <tns:RootElement xmlns:p="commonj.sdo"
> xmlns:tns="http://www.apache.org/tuscany/interop"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.apache.org/tuscany/interop
interop01.xsd
> ">
> <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
> </tns:RootElement>
>
> With the following schema
>
> <schema xmlns="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.apache.org/tuscany/interop"
> xmlns:tns="http://www.apache.org/tuscany/interop">
>
> <include schemaLocation="interop10.xsd"/>
>
> <!-- top level test type -->
> <complexType name="ComplexTypeRootType">
> <sequence>
> <!-- simple types -->
> <element name="SimpleTypeWithName"
type="tns:SimpleTypeWithNameType"/>
>
> </sequence>
> </complexType>
>
> <element name="RootElement" type="tns:ComplexTypeRootType"/>
> </schema>
>
> The I get a valid document (doc) with some data objects in it out of the
> following code:
>
> FileInputStream inFileStream = new FileInputStream (inFileName);
> XMLDocument doc = XMLHelper.INSTANCE.load(inFileStream);
>
> If I try in read in (note I have added and xsi:type attribute):
>
> <tns:RootElement xmlns:p="commonj.sdo"
> xsi:type="tns:ComplexTypeRootType"
> xmlns:tns="http://www.apache.org/tuscany/interop"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.apache.org/tuscany/interop
interop01.xsd
> ">
> <SimpleTypeWithName>SimpleTypeWithName</SimpleTypeWithName>
> </tns:RootElement>
>
> The XMLHelper silently makes an empty document, i.e. the root element is
> null. Is this by design? I.e. is xsi:type unsupported?
>
> Regards
>
> Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org