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 ibrahim <ib...@natlab.research.philips.com> on 2001/02/12 15:47:17 UTC
Re: TargetNamespace Problem
Hi,
I'm trying to use namespace for my XML document here. I tried putting in
the example of TNS documents plus binding and elementFormDefault to be
'qualified' :
TNS.xml:
<?xml version="1.0" encoding="UTF-8"?>
<dv:main
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:dv="http://MyDomain.com/TNS"
xsi:schemaLocation="http://MyDomain.com/TNS TNS.xsd">
<dv:child />
</dv:main>
TNS.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns="http://MyDomain.com/TNS"
targetNamespace="http://MyDomain.com/TNS"
elementFormDefault="qualified">
<xsd:element name="main" >
<xsd:complexType content="elementOnly">
<xsd:element name="child" type="child" minOccurs="0"
maxOccurs="unbounded" />
</xsd:complexType>
</xsd:element>
<xsd:complexType name="child" content="empty" />
</xsd:schema>
But the parser gives erros saying that "dv:main" and "dv:child" must be
declared. What's wrong?
thanks a lot for your help,
cath
Re: TargetNamespace Problem (working ! )
Posted by ibrahim <ib...@natlab.research.philips.com>.
Working now ! Thank youu ! :)
Works after I get rid of 'xsd' prefix and add 'dv' in schema (thx to Andy!). But it
only works with 1999 WD. 2000/10 CR gives General Schema error : Grammar with uri
2:http://MyDomain.com/TNS can not found.
I wonder why.. ?
does anyone know why it doesn't work when 'xsd' prefix is attached ? I saw the
example on w3c page uses 'xsd'. Thought it shouldn't be a problem then.. ?
=^_^=
cath
Andrew Newton wrote:
> Are you using Xerces 1.2.x or 1.3.0?
>
> I'm not sure what the problem is, but this works for me in 1.3.0:
>
> TNS.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <dv:main
> xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
> xmlns:dv="http://MyDomain.com/TNS"
> xsi:schemaLocation="http://MyDomain.com/TNS TNS.xsd">
> <dv:child />
> </dv:main>
>
> TNS.xsd
> <?xml version="1.0" encoding="UTF-8"?>
> <schema
> xmlns="http://www.w3.org/2000/10/XMLSchema"
> xmlns:dv="http://MyDomain.com/TNS"
> targetNamespace="http://MyDomain.com/TNS"
> elementFormDefault="qualified">
>
> <element name="main" >
> <complexType>
> <sequence>
> <element name="child" type="dv:child" minOccurs="0"
> maxOccurs="unbounded" />
> </sequence>
> </complexType>
> </element>
>
> <complexType name="child" />
>
> </schema>
>
> $ java dom.DOMCount -v TNS.xml
> TNS.xml: 415 ms (2 elems, 3 attrs, 4 spaces, 0 chars)
>
> On Mon, Feb 12, 2001 at 05:09:46PM +0100, ibrahim wrote:
> > Hi Andy, Neil :)
> >
> > I tried putting the xsd for targetNamespace and elementFormDefault, but
> > DOMParser gives
> > General Schema error: Schema in TNS.xsd has a different target namespace from
> > the one specified in the instance document: http://MyDomain.com/TNS.
> >
> > in TNS.xsd
> > xsd:targetNamespace="http://MyDomain.com/TNS"
> > xsd:elementFormDefault="qualified">
> >
> > I changed 1999 into 2000/10 but DOMParser also gives General Schema error :
> > Grammar with uri 2:http://MyDomain.com/TNS can not found.
> >
> > in TNS.xsd :
> > xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
> >
> > in TNS.xml:
> > xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
> >
> > btw, better ask again to make sure. This namespace (http://MyDomain.com/TNS in
> > this case) does not need to be a truly existing url right... ?
> >
> > thx :)
> > cath
> >
> > Andrew Newton wrote:
> >
> > > Cath,
> > >
> > > Just a guess, but try "xsd:targetNamespace" and
> > > "xsd:elementFormDefault" in your schema.
> > >
> > > -andy
> > >
> > > On Mon, Feb 12, 2001 at 03:47:17PM +0100, ibrahim wrote:
> > > > Hi,
> > > >
> > > > I'm trying to use namespace for my XML document here. I tried putting in
> > > > the example of TNS documents plus binding and elementFormDefault to be
> > > > 'qualified' :
> > > >
> > > > TNS.xml:
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > <dv:main
> > > > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> > > > xmlns:dv="http://MyDomain.com/TNS"
> > > > xsi:schemaLocation="http://MyDomain.com/TNS TNS.xsd">
> > > > <dv:child />
> > > > </dv:main>
> > > >
> > > > TNS.xsd:
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > <xsd:schema
> > > > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
> > > > xmlns="http://MyDomain.com/TNS"
> > > > targetNamespace="http://MyDomain.com/TNS"
> > > > elementFormDefault="qualified">
> > > >
> > > > <xsd:element name="main" >
> > > > <xsd:complexType content="elementOnly">
> > > > <xsd:element name="child" type="child" minOccurs="0"
> > > > maxOccurs="unbounded" />
> > > > </xsd:complexType>
> > > > </xsd:element>
> > > >
> > > > <xsd:complexType name="child" content="empty" />
> > > >
> > > > </xsd:schema>
> > > >
> > > > But the parser gives erros saying that "dv:main" and "dv:child" must be
> > > > declared. What's wrong?
> > > >
> > > > thanks a lot for your help,
> > > > cath
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> > > > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> > >
> > > --
> > > Andrew Newton
> > > anewton@research.netsol.com
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
> --
> Andrew Newton
> Verisign Applied Research
> anewton@research.netsol.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: TargetNamespace Problem
Posted by Andrew Newton <an...@research.netsol.com>.
Are you using Xerces 1.2.x or 1.3.0?
I'm not sure what the problem is, but this works for me in 1.3.0:
TNS.xml
<?xml version="1.0" encoding="UTF-8"?>
<dv:main
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xmlns:dv="http://MyDomain.com/TNS"
xsi:schemaLocation="http://MyDomain.com/TNS TNS.xsd">
<dv:child />
</dv:main>
TNS.xsd
<?xml version="1.0" encoding="UTF-8"?>
<schema
xmlns="http://www.w3.org/2000/10/XMLSchema"
xmlns:dv="http://MyDomain.com/TNS"
targetNamespace="http://MyDomain.com/TNS"
elementFormDefault="qualified">
<element name="main" >
<complexType>
<sequence>
<element name="child" type="dv:child" minOccurs="0"
maxOccurs="unbounded" />
</sequence>
</complexType>
</element>
<complexType name="child" />
</schema>
$ java dom.DOMCount -v TNS.xml
TNS.xml: 415 ms (2 elems, 3 attrs, 4 spaces, 0 chars)
On Mon, Feb 12, 2001 at 05:09:46PM +0100, ibrahim wrote:
> Hi Andy, Neil :)
>
> I tried putting the xsd for targetNamespace and elementFormDefault, but
> DOMParser gives
> General Schema error: Schema in TNS.xsd has a different target namespace from
> the one specified in the instance document: http://MyDomain.com/TNS.
>
> in TNS.xsd
> xsd:targetNamespace="http://MyDomain.com/TNS"
> xsd:elementFormDefault="qualified">
>
> I changed 1999 into 2000/10 but DOMParser also gives General Schema error :
> Grammar with uri 2:http://MyDomain.com/TNS can not found.
>
> in TNS.xsd :
> xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
>
> in TNS.xml:
> xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
>
> btw, better ask again to make sure. This namespace (http://MyDomain.com/TNS in
> this case) does not need to be a truly existing url right... ?
>
> thx :)
> cath
>
> Andrew Newton wrote:
>
> > Cath,
> >
> > Just a guess, but try "xsd:targetNamespace" and
> > "xsd:elementFormDefault" in your schema.
> >
> > -andy
> >
> > On Mon, Feb 12, 2001 at 03:47:17PM +0100, ibrahim wrote:
> > > Hi,
> > >
> > > I'm trying to use namespace for my XML document here. I tried putting in
> > > the example of TNS documents plus binding and elementFormDefault to be
> > > 'qualified' :
> > >
> > > TNS.xml:
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <dv:main
> > > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> > > xmlns:dv="http://MyDomain.com/TNS"
> > > xsi:schemaLocation="http://MyDomain.com/TNS TNS.xsd">
> > > <dv:child />
> > > </dv:main>
> > >
> > > TNS.xsd:
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <xsd:schema
> > > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
> > > xmlns="http://MyDomain.com/TNS"
> > > targetNamespace="http://MyDomain.com/TNS"
> > > elementFormDefault="qualified">
> > >
> > > <xsd:element name="main" >
> > > <xsd:complexType content="elementOnly">
> > > <xsd:element name="child" type="child" minOccurs="0"
> > > maxOccurs="unbounded" />
> > > </xsd:complexType>
> > > </xsd:element>
> > >
> > > <xsd:complexType name="child" content="empty" />
> > >
> > > </xsd:schema>
> > >
> > > But the parser gives erros saying that "dv:main" and "dv:child" must be
> > > declared. What's wrong?
> > >
> > > thanks a lot for your help,
> > > cath
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> >
> > --
> > Andrew Newton
> > anewton@research.netsol.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
--
Andrew Newton
Verisign Applied Research
anewton@research.netsol.com
Re: TargetNamespace Problem
Posted by ibrahim <ib...@natlab.research.philips.com>.
Hi Andy, Neil :)
I tried putting the xsd for targetNamespace and elementFormDefault, but
DOMParser gives
General Schema error: Schema in TNS.xsd has a different target namespace from
the one specified in the instance document: http://MyDomain.com/TNS.
in TNS.xsd
xsd:targetNamespace="http://MyDomain.com/TNS"
xsd:elementFormDefault="qualified">
I changed 1999 into 2000/10 but DOMParser also gives General Schema error :
Grammar with uri 2:http://MyDomain.com/TNS can not found.
in TNS.xsd :
xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
in TNS.xml:
xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
btw, better ask again to make sure. This namespace (http://MyDomain.com/TNS in
this case) does not need to be a truly existing url right... ?
thx :)
cath
Andrew Newton wrote:
> Cath,
>
> Just a guess, but try "xsd:targetNamespace" and
> "xsd:elementFormDefault" in your schema.
>
> -andy
>
> On Mon, Feb 12, 2001 at 03:47:17PM +0100, ibrahim wrote:
> > Hi,
> >
> > I'm trying to use namespace for my XML document here. I tried putting in
> > the example of TNS documents plus binding and elementFormDefault to be
> > 'qualified' :
> >
> > TNS.xml:
> > <?xml version="1.0" encoding="UTF-8"?>
> > <dv:main
> > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> > xmlns:dv="http://MyDomain.com/TNS"
> > xsi:schemaLocation="http://MyDomain.com/TNS TNS.xsd">
> > <dv:child />
> > </dv:main>
> >
> > TNS.xsd:
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsd:schema
> > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
> > xmlns="http://MyDomain.com/TNS"
> > targetNamespace="http://MyDomain.com/TNS"
> > elementFormDefault="qualified">
> >
> > <xsd:element name="main" >
> > <xsd:complexType content="elementOnly">
> > <xsd:element name="child" type="child" minOccurs="0"
> > maxOccurs="unbounded" />
> > </xsd:complexType>
> > </xsd:element>
> >
> > <xsd:complexType name="child" content="empty" />
> >
> > </xsd:schema>
> >
> > But the parser gives erros saying that "dv:main" and "dv:child" must be
> > declared. What's wrong?
> >
> > thanks a lot for your help,
> > cath
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
> --
> Andrew Newton
> anewton@research.netsol.com
Re: TargetNamespace Problem
Posted by Andrew Newton <an...@research.netsol.com>.
Cath,
Just a guess, but try "xsd:targetNamespace" and
"xsd:elementFormDefault" in your schema.
-andy
On Mon, Feb 12, 2001 at 03:47:17PM +0100, ibrahim wrote:
> Hi,
>
> I'm trying to use namespace for my XML document here. I tried putting in
> the example of TNS documents plus binding and elementFormDefault to be
> 'qualified' :
>
> TNS.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <dv:main
> xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
> xmlns:dv="http://MyDomain.com/TNS"
> xsi:schemaLocation="http://MyDomain.com/TNS TNS.xsd">
> <dv:child />
> </dv:main>
>
> TNS.xsd:
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema
> xmlns:xsd="http://www.w3.org/1999/XMLSchema"
> xmlns="http://MyDomain.com/TNS"
> targetNamespace="http://MyDomain.com/TNS"
> elementFormDefault="qualified">
>
> <xsd:element name="main" >
> <xsd:complexType content="elementOnly">
> <xsd:element name="child" type="child" minOccurs="0"
> maxOccurs="unbounded" />
> </xsd:complexType>
> </xsd:element>
>
> <xsd:complexType name="child" content="empty" />
>
> </xsd:schema>
>
> But the parser gives erros saying that "dv:main" and "dv:child" must be
> declared. What's wrong?
>
> thanks a lot for your help,
> cath
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
--
Andrew Newton
anewton@research.netsol.com