Home » Archived » XML Schema Definition (XSD) » Element Declaration does not reference complex type
Element Declaration does not reference complex type [message #5199] |
Thu, 14 November 2002 20:20 |
Eclipse User |
|
|
|
Originally posted by: dsingh.altoweb.com
Hi all,
I'm having a slight problem with the XSD parser. I noticed that while
parsing the schema listed below. The "XSDElementDeclaration" object for
"MyElement" does not refer to a "XSDComplexTypeDeclaration" for its type.
Instead it refers to a "XSDSimpleTypeDefinition" this seems to be a very
elementary problem or maybe I'm doing something wrong or have misunderstood
something.
I would appreciate any help with this issue. I'm using the 1.0.1 October
23rd version of the API.
Thanks
Dharminder Singh
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://myNamespace/">
<xsd:element name="MyElement" type="MyDataType"/>
<xsd:complexType name="MyDataType">
<xsd:sequence>
<xsd:element name="element1" type="xsd:string" minOccurs="0"
maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="attr1" type="xsd:string" use="required"/>
</xsd:complexType>
</schema>
|
|
|
Re: Element Declaration does not reference complex type [message #5267 is a reply to message #5199] |
Thu, 14 November 2002 23:08 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
--------------8DB45D7C2D1DE51E95429A7C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi,
It's good to try to open the file in the Sample XSD Editor so that it can find
problems for you. There are two problems in red:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://myNamespace/"
xmlns="http://myNamespace/">
<xsd:element name="MyElement" type="MyDataType"/>
<xsd:complexType name="MyDataType">
<xsd:sequence>
<xsd:element name="element1" type="xsd:string"
minOccurs="0"
maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="attr1" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:schema>
You need to define an xmlns prefix for qualifying references to things in the
schema's namespace and you need the end tag to match.
Dharminder Singh wrote:
> Hi all,
>
> I'm having a slight problem with the XSD parser. I noticed that while
> parsing the schema listed below. The "XSDElementDeclaration" object for
> "MyElement" does not refer to a "XSDComplexTypeDeclaration" for its type.
> Instead it refers to a "XSDSimpleTypeDefinition" this seems to be a very
> elementary problem or maybe I'm doing something wrong or have misunderstood
> something.
>
> I would appreciate any help with this issue. I'm using the 1.0.1 October
> 23rd version of the API.
>
> Thanks
>
> Dharminder Singh
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://myNamespace/">
>
> <xsd:element name="MyElement" type="MyDataType"/>
>
> <xsd:complexType name="MyDataType">
> <xsd:sequence>
> <xsd:element name="element1" type="xsd:string" minOccurs="0"
> maxOccurs="1" />
> </xsd:sequence>
> <xsd:attribute name="attr1" type="xsd:string" use="required"/>
> </xsd:complexType>
> </schema>
--
Ed Merks
--------------8DB45D7C2D1DE51E95429A7C
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi,
<p>It's good to try to open the file in the Sample XSD Editor so that it
can find problems for you. There are two problems in <font color="#CC0000">red:</font>
<blockquote><?xml version="1.0" encoding="UTF-8"?>
<br><xsd:schema xmlns:xsd="<A HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"
<br>
targetNamespace="<A HREF="http://myNamespace/">http://myNamespace/</A>" <b><font color="#CC0000">xmlns="<A HREF="http://myNamespace/">http://myNamespace/</A>"</font></b>>
<p> <xsd:element name="MyElement" type="MyDataType"/>
<p> <xsd:complexType name="MyDataType">
<br> <xsd:sequence>
<br> <xsd:element name="element1"
type="xsd:string" minOccurs="0"
<br>maxOccurs="1" />
<br> </xsd:sequence>
<br> <xsd:attribute name="attr1" type="xsd:string"
use="required"/>
<br> </xsd:complexType>
<br><<b><font color="#000000">/</font><font color="#CC0000">xsd</font></b>:schema></blockquote>
You need to define an xmlns prefix for qualifying references to things
in the schema's namespace and you need the end tag to match.
<br>
<p>Dharminder Singh wrote:
<blockquote TYPE=CITE>Hi all,
<p>I'm having a slight problem with the XSD parser. I noticed that while
<br>parsing the schema listed below. The "XSDElementDeclaration" object
for
<br>"MyElement" does not refer to a "XSDComplexTypeDeclaration" for its
type.
<br>Instead it refers to a "XSDSimpleTypeDefinition" this seems to be a
very
<br>elementary problem or maybe I'm doing something wrong or have misunderstood
<br>something.
<p>I would appreciate any help with this issue. I'm using the 1.0.1 October
<br>23rd version of the API.
<p>Thanks
<p>Dharminder Singh
<p><?xml version="1.0" encoding="UTF-8"?>
<br><xsd:schema xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"
<br>
targetNamespace="<a href="http://myNamespace/">http://myNamespace/</a>">
<p> <xsd:element name="MyElement" type="MyDataType"/>
<p> <xsd:complexType name="MyDataType">
<br> <xsd:sequence>
<br> <xsd:element name="element1"
type="xsd:string" minOccurs="0"
<br>maxOccurs="1" />
<br> </xsd:sequence>
<br> <xsd:attribute name="attr1" type="xsd:string"
use="required"/>
<br> </xsd:complexType>
<br></schema></blockquote>
<p>--
<br>Ed Merks
<br> </html>
--------------8DB45D7C2D1DE51E95429A7C--
|
|
|
Re: Element Declaration does not reference complex type [message #5334 is a reply to message #5267] |
Fri, 15 November 2002 00:15 |
Eclipse User |
|
|
|
Originally posted by: dsingh.altoweb.com
This is a multi-part message in MIME format.
------=_NextPart_000_0090_01C28BF9.1242F210
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi Ed,=20
Thanks for the reply, There still seems to be a problem as far as I can =
see. Even with your suggestions I saw the same problem, however when I =
move the element definition below the complex type definition in the =
file the elements type was correctly set. If you move the element =
definition above the complex type definition then the elements type is =
set to an unresolved simple type.
The Schema I tried that worked was as follows.
Thanks
Dharminder Singh
<?xml version=3D"1.0" encoding=3D"UTF-8"?>
<xsd:schema targetNamespace=3D"http://myNamespace/"
xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"
xmlns=3D"http://myNamespace/">
<xsd:complexType name=3D"MyDataType">
<xsd:sequence>
<xsd:element name=3D"element1" type=3D"xsd:string" =
minOccurs=3D"0" maxOccurs=3D"1" />
<xsd:element ref=3D"MyElement"/>
</xsd:sequence>
<xsd:attribute name=3D"attr1" type=3D"xsd:string" =
use=3D"required"/>
</xsd:complexType>
<xsd:element name=3D"MyElement" type=3D"MyDataType"/>
</xsd:schema>
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:3DD42CE7.889629AD@ca.ibm.com...
Hi,=20
It's good to try to open the file in the Sample XSD Editor so that it =
can find problems for you. There are two problems in red:=20
<?xml version=3D"1.0" encoding=3D"UTF-8"?>=20
<xsd:schema xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"=20
targetNamespace=3D"http://myNamespace/" =
xmlns=3D"http://myNamespace/">=20
<xsd:element name=3D"MyElement" type=3D"MyDataType"/>=20
<xsd:complexType name=3D"MyDataType">=20
<xsd:sequence>=20
<xsd:element name=3D"element1" type=3D"xsd:string" =
minOccurs=3D"0"=20
maxOccurs=3D"1" />=20
</xsd:sequence>=20
<xsd:attribute name=3D"attr1" type=3D"xsd:string" =
use=3D"required"/>=20
</xsd:complexType>=20
</xsd:schema>
You need to define an xmlns prefix for qualifying references to things =
in the schema's namespace and you need the end tag to match.=20
=20
Dharminder Singh wrote:=20
Hi all,=20
I'm having a slight problem with the XSD parser. I noticed that =
while=20
parsing the schema listed below. The "XSDElementDeclaration" object =
for=20
"MyElement" does not refer to a "XSDComplexTypeDeclaration" for its =
type.=20
Instead it refers to a "XSDSimpleTypeDefinition" this seems to be a =
very=20
elementary problem or maybe I'm doing something wrong or have =
misunderstood=20
something.=20
I would appreciate any help with this issue. I'm using the 1.0.1 =
October=20
23rd version of the API.=20
Thanks=20
Dharminder Singh=20
<?xml version=3D"1.0" encoding=3D"UTF-8"?>=20
<xsd:schema xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"=20
targetNamespace=3D"http://myNamespace/">=20
<xsd:element name=3D"MyElement" type=3D"MyDataType"/>=20
<xsd:complexType name=3D"MyDataType">=20
<xsd:sequence>=20
<xsd:element name=3D"element1" type=3D"xsd:string" =
minOccurs=3D"0"=20
maxOccurs=3D"1" />=20
</xsd:sequence>=20
<xsd:attribute name=3D"attr1" type=3D"xsd:string" =
use=3D"required"/>=20
</xsd:complexType>=20
</schema>
--=20
Ed Merks=20
=20
------=_NextPart_000_0090_01C28BF9.1242F210
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2716.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Ed, </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks for the reply, There still seems =
to be a=20
problem as far as I can see. Even with your suggestions I saw the same =
problem,=20
however when I move the element definition below the complex type =
definition in=20
the file the </FONT><FONT face=3DArial size=3D2>elements type was =
correctly set. If=20
you move the element definition above the complex type definition then=20
</FONT><FONT face=3DArial size=3D2>the elements type is set to an =
unresolved simple=20
type.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The Schema I tried that worked was as=20
follows.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Dharminder Singh</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2><?xml version=3D"1.0"=20
encoding=3D"UTF-8"?><BR><xsd:schema targetNamespace=3D"</FONT><A=20
href=3D"http://myNamespace/"><FONT face=3D"Courier New"=20
size=3D2>http://myNamespace/</FONT></A><FONT face=3D"Courier New"=20
size=3D2>"<BR>  =
; =20
xmlns:xsd=3D"</FONT><A href=3D"http://www.w3.org/2001/XMLSchema"><FONT=20
face=3D"Courier New" =
size=3D2>http://www.w3.org/2001/XMLSchema</FONT></A><FONT=20
face=3D"Courier New"=20
size=3D2>"<BR>  =
; =20
xmlns=3D"</FONT><A href=3D"http://myNamespace/"><FONT face=3D"Courier =
New"=20
size=3D2>http://myNamespace/</FONT></A><FONT face=3D"Courier New"=20
size=3D2>"></FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2> <xsd:complexType=20
name=3D"MyDataType"><BR> =20
<xsd:sequence><BR> =20
<xsd:element name=3D"element1" type=3D"xsd:string" minOccurs=3D"0" =
maxOccurs=3D"1"=20
/><BR> <xsd:element=20
ref=3D"MyElement"/><BR> =20
</xsd:sequence><BR> =
<xsd:attribute=20
name=3D"attr1" type=3D"xsd:string" use=3D"required"/><BR> =20
</xsd:complexType></FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2> <xsd:element =
name=3D"MyElement"=20
type=3D"MyDataType"/></FONT></DIV>
<DIV><FONT face=3D"Courier New" =
size=3D2></xsd:schema></FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" <<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>>=20
wrote in message <A=20
=
href=3D"news:3DD42CE7.889629AD@ca.ibm.com">news:3DD42CE7.889629AD@ca.ibm.=
com</A>...</DIV>Hi,=20
<P>It's good to try to open the file in the Sample XSD Editor so that =
it can=20
find problems for you. There are two problems in <FONT=20
color=3D#cc0000>red:</FONT>=20
<BLOCKQUOTE><?xml version=3D"1.0" encoding=3D"UTF-8"?> =
<BR><xsd:schema=20
xmlns:xsd=3D"<A=20
=
href=3D"http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchem=
a</A>"=20
=
<BR> =20
targetNamespace=3D"<A =
href=3D"http://myNamespace/">http://myNamespace/</A>"=20
<B><FONT color=3D#cc0000>xmlns=3D"<A=20
href=3D"http://myNamespace/">http://myNamespace/</A>"</FONT></B>> =
<P> <xsd:element name=3D"MyElement" =
type=3D"MyDataType"/>=20
<P> <xsd:complexType name=3D"MyDataType">=20
<BR> <xsd:sequence>=20
<BR> <xsd:element=20
name=3D"element1" type=3D"xsd:string" minOccurs=3D"0"=20
<BR>maxOccurs=3D"1" /> <BR> =20
</xsd:sequence> <BR> =
<xsd:attribute=20
name=3D"attr1" type=3D"xsd:string" use=3D"required"/> <BR> =20
</xsd:complexType> <BR><<B><FONT =
color=3D#000000>/</FONT><FONT=20
color=3D#cc0000>xsd</FONT></B>:schema></P></BLOCKQUOTE >You need =
to define an=20
xmlns prefix for qualifying references to things in the schema's =
namespace and=20
you need the end tag to match. <BR> =20
<P>Dharminder Singh wrote:=20
<BLOCKQUOTE TYPE=3D"CITE">Hi all,=20
<P>I'm having a slight problem with the XSD parser. I noticed that =
while=20
<BR>parsing the schema listed below. The "XSDElementDeclaration" =
object for=20
<BR>"MyElement" does not refer to a "XSDComplexTypeDeclaration" for =
its=20
type. <BR>Instead it refers to a "XSDSimpleTypeDefinition" this =
seems to be=20
a very <BR>elementary problem or maybe I'm doing something wrong or =
have=20
misunderstood <BR>something.=20
<P>I would appreciate any help with this issue. I'm using the 1.0.1 =
October=20
<BR>23rd version of the API.=20
<P>Thanks=20
<P>Dharminder Singh=20
<P><?xml version=3D"1.0" encoding=3D"UTF-8"?> =
<BR><xsd:schema=20
xmlns:xsd=3D"<A=20
=
href=3D"http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchem=
a</A>"=20
=
<BR> =20
targetNamespace=3D"<A =
href=3D"http://myNamespace/">http://myNamespace/</A>">=20
<P> <xsd:element name=3D"MyElement" =
type=3D"MyDataType"/>=20
<P> <xsd:complexType name=3D"MyDataType">=20
<BR> <xsd:sequence>=20
<BR> <xsd:element=20
name=3D"element1" type=3D"xsd:string" minOccurs=3D"0"=20
<BR>maxOccurs=3D"1" /> <BR> =20
</xsd:sequence> <BR> =
<xsd:attribute=20
name=3D"attr1" type=3D"xsd:string" use=3D"required"/> <BR> =20
</xsd:complexType> <BR></schema></P></BLOCKQUOTE>
<P>-- <BR>Ed Merks <BR> </P></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0090_01C28BF9.1242F210--
|
|
|
Re: Element Declaration does not reference complex type [message #5389 is a reply to message #5334] |
Fri, 15 November 2002 00:50 |
Eclipse User |
|
|
|
Originally posted by: merks.ca.ibm.com
--------------2F64084994EE3410825F0FB9
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Dharminder,
I see, you're right. There's a bug that causes forward references in
schemas with a target namespace to fail to resolve on first attempt.
It's fixed in the latest version with this additional method in
XSDNamedComponentImpl.java:
protected void adoptBy(XSDSchema xsdSchema)
{
String newTargetNamespace = xsdSchema.getTargetNamespace();
if (newTargetNamespace == null ? getTargetNamespace() != null :
!newTargetNamespace.equals(getTargetNamespace()))
{
setTargetNamespace(newTargetNamespace);
}
}
That's why I didn't notice it when looking at your example. I'm hoping
to get a new version out next week, but some folks that are helping have
some other commitments...
I think you can call
xsdSchema.setTargetNamespace(xsdSchema.setTargetNamespace()) to force a
resolve to happen in the driver you have.
Dharminder Singh wrote:
> Hi Ed, Thanks for the reply, There still seems to be a problem as far
> as I can see. Even with your suggestions I saw the same problem,
> however when I move the element definition below the complex type
> definition in the file the elements type was correctly set. If you
> move the element definition above the complex type definition then the
> elements type is set to an unresolved simple type. The Schema I tried
> that worked was as follows. Thanks Dharminder Singh <?xml
> version="1.0" encoding="UTF-8"?>
> <xsd:schema targetNamespace="http://myNamespace/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns="http://myNamespace/"> <xsd:complexType
> name="MyDataType">
> <xsd:sequence>
> <xsd:element name="element1" type="xsd:string" minOccurs="0"
> maxOccurs="1" />
> <xsd:element ref="MyElement"/>
> </xsd:sequence>
> <xsd:attribute name="attr1" type="xsd:string" use="required"/>
> </xsd:complexType> <xsd:element name="MyElement"
> type="MyDataType"/></xsd:schema>
>
> "Ed Merks" <merks@ca.ibm.com> wrote in message
> news:3DD42CE7.889629AD@ca.ibm.com...Hi,
>
> It's good to try to open the file in the Sample XSD Editor
> so that it can find problems for you. There are two
> problems in red:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://myNamespace/"
> xmlns="http://myNamespace/">
>
> <xsd:element name="MyElement"
> type="MyDataType"/>
>
> <xsd:complexType name="MyDataType">
> <xsd:sequence>
> <xsd:element name="element1"
> type="xsd:string" minOccurs="0"
> maxOccurs="1" />
> </xsd:sequence>
> <xsd:attribute name="attr1"
> type="xsd:string" use="required"/>
> </xsd:complexType>
> </xsd:schema>
>
> You need to define an xmlns prefix for qualifying references
> to things in the schema's namespace and you need the end tag
> to match.
>
>
> Dharminder Singh wrote:
>
> > Hi all,
> >
> > I'm having a slight problem with the XSD parser. I noticed
> > that while
> > parsing the schema listed below. The
> > "XSDElementDeclaration" object for
> > "MyElement" does not refer to a
> > "XSDComplexTypeDeclaration" for its type.
> > Instead it refers to a "XSDSimpleTypeDefinition" this
> > seems to be a very
> > elementary problem or maybe I'm doing something wrong or
> > have misunderstood
> > something.
> >
> > I would appreciate any help with this issue. I'm using the
> > 1.0.1 October
> > 23rd version of the API.
> >
> > Thanks
> >
> > Dharminder Singh
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > targetNamespace="http://myNamespace/">
> >
> > <xsd:element name="MyElement" type="MyDataType"/>
> >
> > <xsd:complexType name="MyDataType">
> > <xsd:sequence>
> > <xsd:element name="element1" type="xsd:string"
> > minOccurs="0"
> > maxOccurs="1" />
> > </xsd:sequence>
> > <xsd:attribute name="attr1" type="xsd:string"
> > use="required"/>
> > </xsd:complexType>
> > </schema>
>
> --
> Ed Merks
>
>
--
Ed Merks
--------------2F64084994EE3410825F0FB9
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<body bgcolor="#FFFFFF">
Dharminder,
<p>I see, you're right. There's a bug that causes forward references
in schemas with a target namespace to fail to resolve on first attempt.
It's fixed in the latest version with this additional method in XSDNamedComponentImpl.java:
<p> protected void adoptBy(XSDSchema xsdSchema)
<br> {
<br> String newTargetNamespace = xsdSchema.getTargetNamespace();
<br> if (newTargetNamespace == null ? getTargetNamespace()
!= null : !newTargetNamespace.equals(getTargetNamespace()))
<br> {
<br> setTargetNamespace(newTargetNamespace);
<br> }
<br> }
<p>That's why I didn't notice it when looking at your example. I'm
hoping to get a new version out next week, but some folks that are helping
have some other commitments...
<p>I think you can call xsdSchema.setTargetNamespace(xsdSchema.setTargetNamespace())
to force a resolve to happen in the driver you have.
<br>
<p>Dharminder Singh wrote:
<blockquote TYPE=CITE><style></style>
<font face="Arial"><font size=-1>Hi
Ed,</font></font> <font face="Arial"><font size=-1>Thanks for the
reply, There still seems to be a problem as far as I can see. Even with
your suggestions I saw the same problem, however when I move the element
definition below the complex type definition in the file the elements type
was correctly set. If you move the element definition above the complex
type definition then the elements type is set to an unresolved simple type.</font></font> <font face="Arial"><font size=-1>The
Schema I tried that worked was as follows.</font></font> <font face="Arial"><font size=-1>Thanks</font></font> <font face="Arial"><font size=-1>Dharminder
Singh</font></font> <font face="Courier New"><font size=-1><?xml
version="1.0" encoding="UTF-8"?></font></font>
<br><font face="Courier New"><font size=-1><xsd:schema targetNamespace="<a href="http://myNamespace/">http://myNamespace/</a>"</font></font>
<br><font face="Courier New"><font size=-1>
xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"</font></font>
<br><font face="Courier New"><font size=-1>
xmlns="<a href="http://myNamespace/">http://myNamespace/</a>"></font></font><font face="Courier New"><font size=-1>
<xsd:complexType name="MyDataType"></font></font>
<br><font face="Courier New"><font size=-1>
<xsd:sequence></font></font>
<br><font face="Courier New"><font size=-1>
<xsd:element name="element1" type="xsd:string" minOccurs="0" maxOccurs="1"
/></font></font>
<br><font face="Courier New"><font size=-1>
<xsd:element ref="MyElement"/></font></font>
<br><font face="Courier New"><font size=-1>
</xsd:sequence></font></font>
<br><font face="Courier New"><font size=-1>
<xsd:attribute name="attr1" type="xsd:string" use="required"/></font></font>
<br><font face="Courier New"><font size=-1> </xsd:complexType></font></font> <font face="Courier New"><font size=-1> <xsd:element
name="MyElement" type="MyDataType"/></font></font><font face="Courier New"><font size=-1></xsd:schema></font></font>
<blockquote dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">"Ed
Merks" <<a href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>> wrote
in message <a href="news:3DD42CE7.889629AD@ca.ibm.com">news:3DD42CE7.889629AD@ca.ibm.com</a>...Hi,
<p>It's good to try to open the file in the Sample XSD Editor so that it
can find problems for you. There are two problems in <font color="#CC0000">red:</font>
<blockquote><?xml version="1.0" encoding="UTF-8"?>
<br><xsd:schema xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"
<br>
targetNamespace="<a href="http://myNamespace/">http://myNamespace/</a>"
<b><font color="#CC0000">xmlns="<a href="http://myNamespace/">http://myNamespace/</a>"</font></b>>
<p> <xsd:element name="MyElement" type="MyDataType"/>
<p> <xsd:complexType name="MyDataType">
<br> <xsd:sequence>
<br> <xsd:element name="element1"
type="xsd:string" minOccurs="0"
<br>maxOccurs="1" />
<br> </xsd:sequence>
<br> <xsd:attribute name="attr1" type="xsd:string"
use="required"/>
<br> </xsd:complexType>
<br><<b><font color="#000000">/</font><font color="#CC0000">xsd</font></b>:schema></blockquote>
You need to define an xmlns prefix for qualifying references to things
in the schema's namespace and you need the end tag to match.
<br>
<p>Dharminder Singh wrote:
<blockquote TYPE="CITE">Hi all,
<p>I'm having a slight problem with the XSD parser. I noticed that while
<br>parsing the schema listed below. The "XSDElementDeclaration" object
for
<br>"MyElement" does not refer to a "XSDComplexTypeDeclaration" for its
type.
<br>Instead it refers to a "XSDSimpleTypeDefinition" this seems to be a
very
<br>elementary problem or maybe I'm doing something wrong or have misunderstood
<br>something.
<p>I would appreciate any help with this issue. I'm using the 1.0.1 October
<br>23rd version of the API.
<p>Thanks
<p>Dharminder Singh
<p><?xml version="1.0" encoding="UTF-8"?>
<br><xsd:schema xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"
<br>
targetNamespace="<a href="http://myNamespace/">http://myNamespace/</a>">
<p> <xsd:element name="MyElement" type="MyDataType"/>
<p> <xsd:complexType name="MyDataType">
<br> <xsd:sequence>
<br> <xsd:element name="element1"
type="xsd:string" minOccurs="0"
<br>maxOccurs="1" />
<br> </xsd:sequence>
<br> <xsd:attribute name="attr1" type="xsd:string"
use="required"/>
<br> </xsd:complexType>
<br></schema></blockquote>
--
<br>Ed Merks
<br> </blockquote>
</blockquote>
<p>--
<br>Ed Merks
<br>
</body>
</html>
--------------2F64084994EE3410825F0FB9--
|
|
|
Re: Element Declaration does not reference complex type [message #563770 is a reply to message #5199] |
Thu, 14 November 2002 23:08 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
--------------8DB45D7C2D1DE51E95429A7C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi,
It's good to try to open the file in the Sample XSD Editor so that it can find
problems for you. There are two problems in red:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://myNamespace/"
xmlns="http://myNamespace/">
<xsd:element name="MyElement" type="MyDataType"/>
<xsd:complexType name="MyDataType">
<xsd:sequence>
<xsd:element name="element1" type="xsd:string"
minOccurs="0"
maxOccurs="1" />
</xsd:sequence>
<xsd:attribute name="attr1" type="xsd:string" use="required"/>
</xsd:complexType>
</xsd:schema>
You need to define an xmlns prefix for qualifying references to things in the
schema's namespace and you need the end tag to match.
Dharminder Singh wrote:
> Hi all,
>
> I'm having a slight problem with the XSD parser. I noticed that while
> parsing the schema listed below. The "XSDElementDeclaration" object for
> "MyElement" does not refer to a "XSDComplexTypeDeclaration" for its type.
> Instead it refers to a "XSDSimpleTypeDefinition" this seems to be a very
> elementary problem or maybe I'm doing something wrong or have misunderstood
> something.
>
> I would appreciate any help with this issue. I'm using the 1.0.1 October
> 23rd version of the API.
>
> Thanks
>
> Dharminder Singh
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://myNamespace/">
>
> <xsd:element name="MyElement" type="MyDataType"/>
>
> <xsd:complexType name="MyDataType">
> <xsd:sequence>
> <xsd:element name="element1" type="xsd:string" minOccurs="0"
> maxOccurs="1" />
> </xsd:sequence>
> <xsd:attribute name="attr1" type="xsd:string" use="required"/>
> </xsd:complexType>
> </schema>
--
Ed Merks
--------------8DB45D7C2D1DE51E95429A7C
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi,
<p>It's good to try to open the file in the Sample XSD Editor so that it
can find problems for you. There are two problems in <font color="#CC0000">red:</font>
<blockquote><?xml version="1.0" encoding="UTF-8"?>
<br><xsd:schema xmlns:xsd="<A HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"
<br>
targetNamespace="<A HREF="http://myNamespace/">http://myNamespace/</A>" <b><font color="#CC0000">xmlns="<A HREF="http://myNamespace/">http://myNamespace/</A>"</font></b>>
<p> <xsd:element name="MyElement" type="MyDataType"/>
<p> <xsd:complexType name="MyDataType">
<br> <xsd:sequence>
<br> <xsd:element name="element1"
type="xsd:string" minOccurs="0"
<br>maxOccurs="1" />
<br> </xsd:sequence>
<br> <xsd:attribute name="attr1" type="xsd:string"
use="required"/>
<br> </xsd:complexType>
<br><<b><font color="#000000">/</font><font color="#CC0000">xsd</font></b>:schema></blockquote>
You need to define an xmlns prefix for qualifying references to things
in the schema's namespace and you need the end tag to match.
<br>
<p>Dharminder Singh wrote:
<blockquote TYPE=CITE>Hi all,
<p>I'm having a slight problem with the XSD parser. I noticed that while
<br>parsing the schema listed below. The "XSDElementDeclaration" object
for
<br>"MyElement" does not refer to a "XSDComplexTypeDeclaration" for its
type.
<br>Instead it refers to a "XSDSimpleTypeDefinition" this seems to be a
very
<br>elementary problem or maybe I'm doing something wrong or have misunderstood
<br>something.
<p>I would appreciate any help with this issue. I'm using the 1.0.1 October
<br>23rd version of the API.
<p>Thanks
<p>Dharminder Singh
<p><?xml version="1.0" encoding="UTF-8"?>
<br><xsd:schema xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"
<br>
targetNamespace="<a href="http://myNamespace/">http://myNamespace/</a>">
<p> <xsd:element name="MyElement" type="MyDataType"/>
<p> <xsd:complexType name="MyDataType">
<br> <xsd:sequence>
<br> <xsd:element name="element1"
type="xsd:string" minOccurs="0"
<br>maxOccurs="1" />
<br> </xsd:sequence>
<br> <xsd:attribute name="attr1" type="xsd:string"
use="required"/>
<br> </xsd:complexType>
<br></schema></blockquote>
<p>--
<br>Ed Merks
<br> </html>
--------------8DB45D7C2D1DE51E95429A7C--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Element Declaration does not reference complex type [message #563797 is a reply to message #5267] |
Fri, 15 November 2002 00:15 |
Eclipse User |
|
|
|
Originally posted by: dsingh.altoweb.com
This is a multi-part message in MIME format.
------=_NextPart_000_0090_01C28BF9.1242F210
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi Ed,=20
Thanks for the reply, There still seems to be a problem as far as I can =
see. Even with your suggestions I saw the same problem, however when I =
move the element definition below the complex type definition in the =
file the elements type was correctly set. If you move the element =
definition above the complex type definition then the elements type is =
set to an unresolved simple type.
The Schema I tried that worked was as follows.
Thanks
Dharminder Singh
<?xml version=3D"1.0" encoding=3D"UTF-8"?>
<xsd:schema targetNamespace=3D"http://myNamespace/"
xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"
xmlns=3D"http://myNamespace/">
<xsd:complexType name=3D"MyDataType">
<xsd:sequence>
<xsd:element name=3D"element1" type=3D"xsd:string" =
minOccurs=3D"0" maxOccurs=3D"1" />
<xsd:element ref=3D"MyElement"/>
</xsd:sequence>
<xsd:attribute name=3D"attr1" type=3D"xsd:string" =
use=3D"required"/>
</xsd:complexType>
<xsd:element name=3D"MyElement" type=3D"MyDataType"/>
</xsd:schema>
"Ed Merks" <merks@ca.ibm.com> wrote in message =
news:3DD42CE7.889629AD@ca.ibm.com...
Hi,=20
It's good to try to open the file in the Sample XSD Editor so that it =
can find problems for you. There are two problems in red:=20
<?xml version=3D"1.0" encoding=3D"UTF-8"?>=20
<xsd:schema xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"=20
targetNamespace=3D"http://myNamespace/" =
xmlns=3D"http://myNamespace/">=20
<xsd:element name=3D"MyElement" type=3D"MyDataType"/>=20
<xsd:complexType name=3D"MyDataType">=20
<xsd:sequence>=20
<xsd:element name=3D"element1" type=3D"xsd:string" =
minOccurs=3D"0"=20
maxOccurs=3D"1" />=20
</xsd:sequence>=20
<xsd:attribute name=3D"attr1" type=3D"xsd:string" =
use=3D"required"/>=20
</xsd:complexType>=20
</xsd:schema>
You need to define an xmlns prefix for qualifying references to things =
in the schema's namespace and you need the end tag to match.=20
=20
Dharminder Singh wrote:=20
Hi all,=20
I'm having a slight problem with the XSD parser. I noticed that =
while=20
parsing the schema listed below. The "XSDElementDeclaration" object =
for=20
"MyElement" does not refer to a "XSDComplexTypeDeclaration" for its =
type.=20
Instead it refers to a "XSDSimpleTypeDefinition" this seems to be a =
very=20
elementary problem or maybe I'm doing something wrong or have =
misunderstood=20
something.=20
I would appreciate any help with this issue. I'm using the 1.0.1 =
October=20
23rd version of the API.=20
Thanks=20
Dharminder Singh=20
<?xml version=3D"1.0" encoding=3D"UTF-8"?>=20
<xsd:schema xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"=20
targetNamespace=3D"http://myNamespace/">=20
<xsd:element name=3D"MyElement" type=3D"MyDataType"/>=20
<xsd:complexType name=3D"MyDataType">=20
<xsd:sequence>=20
<xsd:element name=3D"element1" type=3D"xsd:string" =
minOccurs=3D"0"=20
maxOccurs=3D"1" />=20
</xsd:sequence>=20
<xsd:attribute name=3D"attr1" type=3D"xsd:string" =
use=3D"required"/>=20
</xsd:complexType>=20
</schema>
--=20
Ed Merks=20
=20
------=_NextPart_000_0090_01C28BF9.1242F210
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2716.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi Ed, </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks for the reply, There still seems =
to be a=20
problem as far as I can see. Even with your suggestions I saw the same =
problem,=20
however when I move the element definition below the complex type =
definition in=20
the file the </FONT><FONT face=3DArial size=3D2>elements type was =
correctly set. If=20
you move the element definition above the complex type definition then=20
</FONT><FONT face=3DArial size=3D2>the elements type is set to an =
unresolved simple=20
type.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The Schema I tried that worked was as=20
follows.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Dharminder Singh</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2><?xml version=3D"1.0"=20
encoding=3D"UTF-8"?><BR><xsd:schema targetNamespace=3D"</FONT><A=20
href=3D"http://myNamespace/"><FONT face=3D"Courier New"=20
size=3D2>http://myNamespace/</FONT></A><FONT face=3D"Courier New"=20
size=3D2>"<BR>  =
; =20
xmlns:xsd=3D"</FONT><A href=3D"http://www.w3.org/2001/XMLSchema"><FONT=20
face=3D"Courier New" =
size=3D2>http://www.w3.org/2001/XMLSchema</FONT></A><FONT=20
face=3D"Courier New"=20
size=3D2>"<BR>  =
; =20
xmlns=3D"</FONT><A href=3D"http://myNamespace/"><FONT face=3D"Courier =
New"=20
size=3D2>http://myNamespace/</FONT></A><FONT face=3D"Courier New"=20
size=3D2>"></FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2> <xsd:complexType=20
name=3D"MyDataType"><BR> =20
<xsd:sequence><BR> =20
<xsd:element name=3D"element1" type=3D"xsd:string" minOccurs=3D"0" =
maxOccurs=3D"1"=20
/><BR> <xsd:element=20
ref=3D"MyElement"/><BR> =20
</xsd:sequence><BR> =
<xsd:attribute=20
name=3D"attr1" type=3D"xsd:string" use=3D"required"/><BR> =20
</xsd:complexType></FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2> <xsd:element =
name=3D"MyElement"=20
type=3D"MyDataType"/></FONT></DIV>
<DIV><FONT face=3D"Courier New" =
size=3D2></xsd:schema></FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Ed Merks" <<A =
href=3D"mailto:merks@ca.ibm.com">merks@ca.ibm.com</A>>=20
wrote in message <A=20
=
href=3D"news:3DD42CE7.889629AD@ca.ibm.com">news:3DD42CE7.889629AD@ca.ibm.=
com</A>...</DIV>Hi,=20
<P>It's good to try to open the file in the Sample XSD Editor so that =
it can=20
find problems for you. There are two problems in <FONT=20
color=3D#cc0000>red:</FONT>=20
<BLOCKQUOTE><?xml version=3D"1.0" encoding=3D"UTF-8"?> =
<BR><xsd:schema=20
xmlns:xsd=3D"<A=20
=
href=3D"http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchem=
a</A>"=20
=
<BR> =20
targetNamespace=3D"<A =
href=3D"http://myNamespace/">http://myNamespace/</A>"=20
<B><FONT color=3D#cc0000>xmlns=3D"<A=20
href=3D"http://myNamespace/">http://myNamespace/</A>"</FONT></B>> =
<P> <xsd:element name=3D"MyElement" =
type=3D"MyDataType"/>=20
<P> <xsd:complexType name=3D"MyDataType">=20
<BR> <xsd:sequence>=20
<BR> <xsd:element=20
name=3D"element1" type=3D"xsd:string" minOccurs=3D"0"=20
<BR>maxOccurs=3D"1" /> <BR> =20
</xsd:sequence> <BR> =
<xsd:attribute=20
name=3D"attr1" type=3D"xsd:string" use=3D"required"/> <BR> =20
</xsd:complexType> <BR><<B><FONT =
color=3D#000000>/</FONT><FONT=20
color=3D#cc0000>xsd</FONT></B>:schema></P></BLOCKQUOTE >You need =
to define an=20
xmlns prefix for qualifying references to things in the schema's =
namespace and=20
you need the end tag to match. <BR> =20
<P>Dharminder Singh wrote:=20
<BLOCKQUOTE TYPE=3D"CITE">Hi all,=20
<P>I'm having a slight problem with the XSD parser. I noticed that =
while=20
<BR>parsing the schema listed below. The "XSDElementDeclaration" =
object for=20
<BR>"MyElement" does not refer to a "XSDComplexTypeDeclaration" for =
its=20
type. <BR>Instead it refers to a "XSDSimpleTypeDefinition" this =
seems to be=20
a very <BR>elementary problem or maybe I'm doing something wrong or =
have=20
misunderstood <BR>something.=20
<P>I would appreciate any help with this issue. I'm using the 1.0.1 =
October=20
<BR>23rd version of the API.=20
<P>Thanks=20
<P>Dharminder Singh=20
<P><?xml version=3D"1.0" encoding=3D"UTF-8"?> =
<BR><xsd:schema=20
xmlns:xsd=3D"<A=20
=
href=3D"http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchem=
a</A>"=20
=
<BR> =20
targetNamespace=3D"<A =
href=3D"http://myNamespace/">http://myNamespace/</A>">=20
<P> <xsd:element name=3D"MyElement" =
type=3D"MyDataType"/>=20
<P> <xsd:complexType name=3D"MyDataType">=20
<BR> <xsd:sequence>=20
<BR> <xsd:element=20
name=3D"element1" type=3D"xsd:string" minOccurs=3D"0"=20
<BR>maxOccurs=3D"1" /> <BR> =20
</xsd:sequence> <BR> =
<xsd:attribute=20
name=3D"attr1" type=3D"xsd:string" use=3D"required"/> <BR> =20
</xsd:complexType> <BR></schema></P></BLOCKQUOTE>
<P>-- <BR>Ed Merks <BR> </P></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0090_01C28BF9.1242F210--
|
|
|
Re: Element Declaration does not reference complex type [message #563816 is a reply to message #5334] |
Fri, 15 November 2002 00:50 |
Ed Merks Messages: 33264 Registered: July 2009 |
Senior Member |
|
|
--------------2F64084994EE3410825F0FB9
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Dharminder,
I see, you're right. There's a bug that causes forward references in
schemas with a target namespace to fail to resolve on first attempt.
It's fixed in the latest version with this additional method in
XSDNamedComponentImpl.java:
protected void adoptBy(XSDSchema xsdSchema)
{
String newTargetNamespace = xsdSchema.getTargetNamespace();
if (newTargetNamespace == null ? getTargetNamespace() != null :
!newTargetNamespace.equals(getTargetNamespace()))
{
setTargetNamespace(newTargetNamespace);
}
}
That's why I didn't notice it when looking at your example. I'm hoping
to get a new version out next week, but some folks that are helping have
some other commitments...
I think you can call
xsdSchema.setTargetNamespace(xsdSchema.setTargetNamespace()) to force a
resolve to happen in the driver you have.
Dharminder Singh wrote:
> Hi Ed, Thanks for the reply, There still seems to be a problem as far
> as I can see. Even with your suggestions I saw the same problem,
> however when I move the element definition below the complex type
> definition in the file the elements type was correctly set. If you
> move the element definition above the complex type definition then the
> elements type is set to an unresolved simple type. The Schema I tried
> that worked was as follows. Thanks Dharminder Singh <?xml
> version="1.0" encoding="UTF-8"?>
> <xsd:schema targetNamespace="http://myNamespace/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns="http://myNamespace/"> <xsd:complexType
> name="MyDataType">
> <xsd:sequence>
> <xsd:element name="element1" type="xsd:string" minOccurs="0"
> maxOccurs="1" />
> <xsd:element ref="MyElement"/>
> </xsd:sequence>
> <xsd:attribute name="attr1" type="xsd:string" use="required"/>
> </xsd:complexType> <xsd:element name="MyElement"
> type="MyDataType"/></xsd:schema>
>
> "Ed Merks" <merks@ca.ibm.com> wrote in message
> news:3DD42CE7.889629AD@ca.ibm.com...Hi,
>
> It's good to try to open the file in the Sample XSD Editor
> so that it can find problems for you. There are two
> problems in red:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://myNamespace/"
> xmlns="http://myNamespace/">
>
> <xsd:element name="MyElement"
> type="MyDataType"/>
>
> <xsd:complexType name="MyDataType">
> <xsd:sequence>
> <xsd:element name="element1"
> type="xsd:string" minOccurs="0"
> maxOccurs="1" />
> </xsd:sequence>
> <xsd:attribute name="attr1"
> type="xsd:string" use="required"/>
> </xsd:complexType>
> </xsd:schema>
>
> You need to define an xmlns prefix for qualifying references
> to things in the schema's namespace and you need the end tag
> to match.
>
>
> Dharminder Singh wrote:
>
> > Hi all,
> >
> > I'm having a slight problem with the XSD parser. I noticed
> > that while
> > parsing the schema listed below. The
> > "XSDElementDeclaration" object for
> > "MyElement" does not refer to a
> > "XSDComplexTypeDeclaration" for its type.
> > Instead it refers to a "XSDSimpleTypeDefinition" this
> > seems to be a very
> > elementary problem or maybe I'm doing something wrong or
> > have misunderstood
> > something.
> >
> > I would appreciate any help with this issue. I'm using the
> > 1.0.1 October
> > 23rd version of the API.
> >
> > Thanks
> >
> > Dharminder Singh
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > targetNamespace="http://myNamespace/">
> >
> > <xsd:element name="MyElement" type="MyDataType"/>
> >
> > <xsd:complexType name="MyDataType">
> > <xsd:sequence>
> > <xsd:element name="element1" type="xsd:string"
> > minOccurs="0"
> > maxOccurs="1" />
> > </xsd:sequence>
> > <xsd:attribute name="attr1" type="xsd:string"
> > use="required"/>
> > </xsd:complexType>
> > </schema>
>
> --
> Ed Merks
>
>
--
Ed Merks
--------------2F64084994EE3410825F0FB9
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<body bgcolor="#FFFFFF">
Dharminder,
<p>I see, you're right. There's a bug that causes forward references
in schemas with a target namespace to fail to resolve on first attempt.
It's fixed in the latest version with this additional method in XSDNamedComponentImpl.java:
<p> protected void adoptBy(XSDSchema xsdSchema)
<br> {
<br> String newTargetNamespace = xsdSchema.getTargetNamespace();
<br> if (newTargetNamespace == null ? getTargetNamespace()
!= null : !newTargetNamespace.equals(getTargetNamespace()))
<br> {
<br> setTargetNamespace(newTargetNamespace);
<br> }
<br> }
<p>That's why I didn't notice it when looking at your example. I'm
hoping to get a new version out next week, but some folks that are helping
have some other commitments...
<p>I think you can call xsdSchema.setTargetNamespace(xsdSchema.setTargetNamespace())
to force a resolve to happen in the driver you have.
<br>
<p>Dharminder Singh wrote:
<blockquote TYPE=CITE><style></style>
<font face="Arial"><font size=-1>Hi
Ed,</font></font> <font face="Arial"><font size=-1>Thanks for the
reply, There still seems to be a problem as far as I can see. Even with
your suggestions I saw the same problem, however when I move the element
definition below the complex type definition in the file the elements type
was correctly set. If you move the element definition above the complex
type definition then the elements type is set to an unresolved simple type.</font></font> <font face="Arial"><font size=-1>The
Schema I tried that worked was as follows.</font></font> <font face="Arial"><font size=-1>Thanks</font></font> <font face="Arial"><font size=-1>Dharminder
Singh</font></font> <font face="Courier New"><font size=-1><?xml
version="1.0" encoding="UTF-8"?></font></font>
<br><font face="Courier New"><font size=-1><xsd:schema targetNamespace="<a href="http://myNamespace/">http://myNamespace/</a>"</font></font>
<br><font face="Courier New"><font size=-1>
xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"</font></font>
<br><font face="Courier New"><font size=-1>
xmlns="<a href="http://myNamespace/">http://myNamespace/</a>"></font></font><font face="Courier New"><font size=-1>
<xsd:complexType name="MyDataType"></font></font>
<br><font face="Courier New"><font size=-1>
<xsd:sequence></font></font>
<br><font face="Courier New"><font size=-1>
<xsd:element name="element1" type="xsd:string" minOccurs="0" maxOccurs="1"
/></font></font>
<br><font face="Courier New"><font size=-1>
<xsd:element ref="MyElement"/></font></font>
<br><font face="Courier New"><font size=-1>
</xsd:sequence></font></font>
<br><font face="Courier New"><font size=-1>
<xsd:attribute name="attr1" type="xsd:string" use="required"/></font></font>
<br><font face="Courier New"><font size=-1> </xsd:complexType></font></font> <font face="Courier New"><font size=-1> <xsd:element
name="MyElement" type="MyDataType"/></font></font><font face="Courier New"><font size=-1></xsd:schema></font></font>
<blockquote dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">"Ed
Merks" <<a href="mailto:merks@ca.ibm.com">merks@ca.ibm.com</a>> wrote
in message <a href="news:3DD42CE7.889629AD@ca.ibm.com">news:3DD42CE7.889629AD@ca.ibm.com</a>...Hi,
<p>It's good to try to open the file in the Sample XSD Editor so that it
can find problems for you. There are two problems in <font color="#CC0000">red:</font>
<blockquote><?xml version="1.0" encoding="UTF-8"?>
<br><xsd:schema xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"
<br>
targetNamespace="<a href="http://myNamespace/">http://myNamespace/</a>"
<b><font color="#CC0000">xmlns="<a href="http://myNamespace/">http://myNamespace/</a>"</font></b>>
<p> <xsd:element name="MyElement" type="MyDataType"/>
<p> <xsd:complexType name="MyDataType">
<br> <xsd:sequence>
<br> <xsd:element name="element1"
type="xsd:string" minOccurs="0"
<br>maxOccurs="1" />
<br> </xsd:sequence>
<br> <xsd:attribute name="attr1" type="xsd:string"
use="required"/>
<br> </xsd:complexType>
<br><<b><font color="#000000">/</font><font color="#CC0000">xsd</font></b>:schema></blockquote>
You need to define an xmlns prefix for qualifying references to things
in the schema's namespace and you need the end tag to match.
<br>
<p>Dharminder Singh wrote:
<blockquote TYPE="CITE">Hi all,
<p>I'm having a slight problem with the XSD parser. I noticed that while
<br>parsing the schema listed below. The "XSDElementDeclaration" object
for
<br>"MyElement" does not refer to a "XSDComplexTypeDeclaration" for its
type.
<br>Instead it refers to a "XSDSimpleTypeDefinition" this seems to be a
very
<br>elementary problem or maybe I'm doing something wrong or have misunderstood
<br>something.
<p>I would appreciate any help with this issue. I'm using the 1.0.1 October
<br>23rd version of the API.
<p>Thanks
<p>Dharminder Singh
<p><?xml version="1.0" encoding="UTF-8"?>
<br><xsd:schema xmlns:xsd="<a href="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"
<br>
targetNamespace="<a href="http://myNamespace/">http://myNamespace/</a>">
<p> <xsd:element name="MyElement" type="MyDataType"/>
<p> <xsd:complexType name="MyDataType">
<br> <xsd:sequence>
<br> <xsd:element name="element1"
type="xsd:string" minOccurs="0"
<br>maxOccurs="1" />
<br> </xsd:sequence>
<br> <xsd:attribute name="attr1" type="xsd:string"
use="required"/>
<br> </xsd:complexType>
<br></schema></blockquote>
--
<br>Ed Merks
<br> </blockquote>
</blockquote>
<p>--
<br>Ed Merks
<br>
</body>
</html>
--------------2F64084994EE3410825F0FB9--
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Sat Dec 21 18:56:47 GMT 2024
Powered by FUDForum. Page generated in 0.03622 seconds
|