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 Vincent Figari <vi...@yahoo.com> on 2004/01/14 14:59:34 UTC
Validation error on prefixed attribute
Hello Xerces users,
When parsing an xml element such as:
<pr:elem pr:attr="value" xmlns:pr="some-uri" />
With schema validation enabled, Xerces throws:
Fatal: cvc-complex-type.3.2.2: Attribute "pr:attr" is not allowed to appear in element "pr:elem".
I know it is weird to use a namespace prefix on an attribute, which references
the xml namespace of the owning element, but I do not think it is illegal as per
XML Schema specs.
Is this a bug or am I missing something here ?...
Vincent Figari
SAP Labs France
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Validation error on prefixed attribute
Posted by Bob Foster <bo...@objfac.com>.
Vincent Figari wrote:
> Hello Panos,
>
> Sorry may be I did not provide enough info:
> With my example, Xerces has schema validation enabled,
> and Xerces parser is initialized with a .xsd defining
> an element named "elem" having an attribute named "attr"
> in a namespace whose URI is "some-uri".
>
> <pr:elem attr="value" xmlns:pr="some-uri" />
> will be parsed succesfully by Xerces, but:
>
> <pr:elem pr:attr="value" xmlns:pr="some-uri" />
> will cause Xerces to throw:
> Fatal: cvc-complex-type.3.2.2: Attribute "pr:attr" is not allowed to appear in element "pr:elem"
>
> Although unusual, this still looks valid xml to me ?
But it probably isn't. A "local" attribute does not belong to any
namespace. For both examples to be valid, the element would have to have
an attribute named attr and there would have to be a global attribute in
the namespace (defined at the top level) named attr.
Bob Foster
http://xmlbuddy.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: Validation error on prefixed attribute
Posted by George Cristian Bina <ge...@sync.ro>.
... or using the xs:attribute/@form attribute:
<xs:attribute form="qualified"
It takes the same values as xs:schema/@attributeFormDefault, that is qualified and unqualified but it applies only to the parent element.
George
-------------------------------------------------------------
George Cristian Bina mailto:george@oxygenxml.com
<oXygen/> XML Editor - http://www.oxygenxml.com/
----- Original Message -----
From: Phil Weighill-Smith
To: xerces-j-user@xml.apache.org
Sent: Wednesday, January 14, 2004 5:51 PM
Subject: Re: Validation error on prefixed attribute
Interestingly you can change this default behaviour very easily via the schema element in your XSD.
Use the elementFormDefault attribute to change how namespacing of elements works and attributeFormDefault to change how namespacing of attributes works. Both reside on the schema element and both take either "qualified" or "unqualified".
Phil :n)
On Wed, 2004-01-14 at 15:18, Vincent Figari wrote:
George,
I think you are right, I guess I was wrongly assuming that the
attributes defined on elements specified in the .xsd were
implicitly belonging to the targetNamespace of the .xsd as well.
Sounds like a wrong assumption, attributes belong implicitly to
no name space.
Thanks,
Vincent
--- George Cristian Bina <ge...@sync.ro> wrote:
> > With my example, Xerces has schema validation enabled,
> > and Xerces parser is initialized with a .xsd defining
> > an element named "elem" having an attribute named "attr"
> > in a namespace whose URI is "some-uri".
> >
> > <pr:elem attr="value" xmlns:pr="some-uri" />
> > will be parsed succesfully by Xerces, but:
> >
> > <pr:elem pr:attr="value" xmlns:pr="some-uri" />
> > will cause Xerces to throw:
> > Fatal: cvc-complex-type.3.2.2: Attribute "pr:attr" is not allowed to
> appear in element "pr:elem"
>
> In the first case attr belongs to no namespace while in the second case attr
> belongs to "some-uri" namespace. It seems that your schema defines the the
> attribute in no namespace and not in the "some-uri" namespace.
>
> Best Regards,
> George
> -------------------------------------------------------------
> George Cristian Bina mailto:george@oxygenxml.com
> <oXygen/> XML Editor - http://www.oxygenxml.com/
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
-- Phil Weighill-Smith <ph...@volantis.com>Volantis Systems
Re: Validation error on prefixed attribute
Posted by Vincent Figari <vi...@yahoo.com>.
Absolutely right, I checked my .xsd: it is using elementFormDefault=qualified
and attributeFormDefault=unqualified, thus the attributes belonging to no
namespace.
Thanks again for the help.
Vincent
--- Phil Weighill-Smith <ph...@volantis.com> wrote:
> Interestingly you can change this default behaviour very easily via the
> schema element in your XSD.
>
> Use the elementFormDefault attribute to change how namespacing of
> elements works and attributeFormDefault to change how namespacing of
> attributes works. Both reside on the schema element and both take either
> "qualified" or "unqualified".
>
> Phil :n)
>
> On Wed, 2004-01-14 at 15:18, Vincent Figari wrote:
>
> > George,
> >
> > I think you are right, I guess I was wrongly assuming that the
> > attributes defined on elements specified in the .xsd were
> > implicitly belonging to the targetNamespace of the .xsd as well.
> >
> > Sounds like a wrong assumption, attributes belong implicitly to
> > no name space.
> >
> > Thanks,
> >
> > Vincent
> >
> >
> > --- George Cristian Bina <ge...@sync.ro> wrote:
> > > > With my example, Xerces has schema validation enabled,
> > > > and Xerces parser is initialized with a .xsd defining
> > > > an element named "elem" having an attribute named "attr"
> > > > in a namespace whose URI is "some-uri".
> > > >
> > > > <pr:elem attr="value" xmlns:pr="some-uri" />
> > > > will be parsed succesfully by Xerces, but:
> > > >
> > > > <pr:elem pr:attr="value" xmlns:pr="some-uri" />
> > > > will cause Xerces to throw:
> > > > Fatal: cvc-complex-type.3.2.2: Attribute "pr:attr" is not allowed to
> > > appear in element "pr:elem"
> > >
> > > In the first case attr belongs to no namespace while in the second case attr
> > > belongs to "some-uri" namespace. It seems that your schema defines the the
> > > attribute in no namespace and not in the "some-uri" namespace.
> > >
> > > Best Regards,
> > > George
> > > -------------------------------------------------------------
> > > George Cristian Bina mailto:george@oxygenxml.com
> > > <oXygen/> XML Editor - http://www.oxygenxml.com/
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> > >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
> > http://hotjobs.sweepstakes.yahoo.com/signingbonus
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
> --
> Phil Weighill-Smith <ph...@volantis.com>
> Volantis Systems
>
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Validation error on prefixed attribute
Posted by Phil Weighill-Smith <ph...@volantis.com>.
Interestingly you can change this default behaviour very easily via the
schema element in your XSD.
Use the elementFormDefault attribute to change how namespacing of
elements works and attributeFormDefault to change how namespacing of
attributes works. Both reside on the schema element and both take either
"qualified" or "unqualified".
Phil :n)
On Wed, 2004-01-14 at 15:18, Vincent Figari wrote:
> George,
>
> I think you are right, I guess I was wrongly assuming that the
> attributes defined on elements specified in the .xsd were
> implicitly belonging to the targetNamespace of the .xsd as well.
>
> Sounds like a wrong assumption, attributes belong implicitly to
> no name space.
>
> Thanks,
>
> Vincent
>
>
> --- George Cristian Bina <ge...@sync.ro> wrote:
> > > With my example, Xerces has schema validation enabled,
> > > and Xerces parser is initialized with a .xsd defining
> > > an element named "elem" having an attribute named "attr"
> > > in a namespace whose URI is "some-uri".
> > >
> > > <pr:elem attr="value" xmlns:pr="some-uri" />
> > > will be parsed succesfully by Xerces, but:
> > >
> > > <pr:elem pr:attr="value" xmlns:pr="some-uri" />
> > > will cause Xerces to throw:
> > > Fatal: cvc-complex-type.3.2.2: Attribute "pr:attr" is not allowed to
> > appear in element "pr:elem"
> >
> > In the first case attr belongs to no namespace while in the second case attr
> > belongs to "some-uri" namespace. It seems that your schema defines the the
> > attribute in no namespace and not in the "some-uri" namespace.
> >
> > Best Regards,
> > George
> > -------------------------------------------------------------
> > George Cristian Bina mailto:george@oxygenxml.com
> > <oXygen/> XML Editor - http://www.oxygenxml.com/
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-j-user-help@xml.apache.org
> >
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
> http://hotjobs.sweepstakes.yahoo.com/signingbonus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
--
Phil Weighill-Smith <ph...@volantis.com>
Volantis Systems
Re: Validation error on prefixed attribute
Posted by Vincent Figari <vi...@yahoo.com>.
George,
I think you are right, I guess I was wrongly assuming that the
attributes defined on elements specified in the .xsd were
implicitly belonging to the targetNamespace of the .xsd as well.
Sounds like a wrong assumption, attributes belong implicitly to
no name space.
Thanks,
Vincent
--- George Cristian Bina <ge...@sync.ro> wrote:
> > With my example, Xerces has schema validation enabled,
> > and Xerces parser is initialized with a .xsd defining
> > an element named "elem" having an attribute named "attr"
> > in a namespace whose URI is "some-uri".
> >
> > <pr:elem attr="value" xmlns:pr="some-uri" />
> > will be parsed succesfully by Xerces, but:
> >
> > <pr:elem pr:attr="value" xmlns:pr="some-uri" />
> > will cause Xerces to throw:
> > Fatal: cvc-complex-type.3.2.2: Attribute "pr:attr" is not allowed to
> appear in element "pr:elem"
>
> In the first case attr belongs to no namespace while in the second case attr
> belongs to "some-uri" namespace. It seems that your schema defines the the
> attribute in no namespace and not in the "some-uri" namespace.
>
> Best Regards,
> George
> -------------------------------------------------------------
> George Cristian Bina mailto:george@oxygenxml.com
> <oXygen/> XML Editor - http://www.oxygenxml.com/
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Validation error on prefixed attribute
Posted by George Cristian Bina <ge...@sync.ro>.
> With my example, Xerces has schema validation enabled,
> and Xerces parser is initialized with a .xsd defining
> an element named "elem" having an attribute named "attr"
> in a namespace whose URI is "some-uri".
>
> <pr:elem attr="value" xmlns:pr="some-uri" />
> will be parsed succesfully by Xerces, but:
>
> <pr:elem pr:attr="value" xmlns:pr="some-uri" />
> will cause Xerces to throw:
> Fatal: cvc-complex-type.3.2.2: Attribute "pr:attr" is not allowed to
appear in element "pr:elem"
In the first case attr belongs to no namespace while in the second case attr
belongs to "some-uri" namespace. It seems that your schema defines the the
attribute in no namespace and not in the "some-uri" namespace.
Best Regards,
George
-------------------------------------------------------------
George Cristian Bina mailto:george@oxygenxml.com
<oXygen/> XML Editor - http://www.oxygenxml.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: Validation error on prefixed attribute
Posted by Panos Konstantinidis <gi...@yahoo.com>.
Also if "attr" is indeed defined in the schema make
sure that is globally defined and that it can be
accessed.
--- Vincent Figari <vi...@yahoo.com> wrote:
> Hello Panos,
>
> Sorry may be I did not provide enough info:
> With my example, Xerces has schema validation
> enabled,
> and Xerces parser is initialized with a .xsd
> defining
> an element named "elem" having an attribute named
> "attr"
> in a namespace whose URI is "some-uri".
>
> <pr:elem attr="value" xmlns:pr="some-uri" />
> will be parsed succesfully by Xerces, but:
>
> <pr:elem pr:attr="value" xmlns:pr="some-uri" />
> will cause Xerces to throw:
> Fatal: cvc-complex-type.3.2.2: Attribute "pr:attr"
> is not allowed to appear in element "pr:elem"
>
> Although unusual, this still looks valid xml to me ?
>
> Vincent
>
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Validation error on prefixed attribute
Posted by Panos Konstantinidis <gi...@yahoo.com>.
Are you sure that the schema has the "attr"
attributed defined?
--- Vincent Figari <vi...@yahoo.com> wrote:
> Hello Panos,
>
> Sorry may be I did not provide enough info:
> With my example, Xerces has schema validation
> enabled,
> and Xerces parser is initialized with a .xsd
> defining
> an element named "elem" having an attribute named
> "attr"
> in a namespace whose URI is "some-uri".
>
> <pr:elem attr="value" xmlns:pr="some-uri" />
> will be parsed succesfully by Xerces, but:
>
> <pr:elem pr:attr="value" xmlns:pr="some-uri" />
> will cause Xerces to throw:
> Fatal: cvc-complex-type.3.2.2: Attribute "pr:attr"
> is not allowed to appear in element "pr:elem"
>
> Although unusual, this still looks valid xml to me ?
>
> Vincent
>
> --- Panos Konstantinidis <gi...@yahoo.com> wrote:
> > >
> > > <pr:elem pr:attr="value" xmlns:pr="some-uri" />
> > >
> > > With schema validation enabled, Xerces throws:
> > > Fatal: cvc-complex-type.3.2.2: Attribute
> "pr:attr"
> > > is not allowed to appear in element "pr:elem".
> > >
> >
> > Are you sure that this is a valid XML? It seems
> to
> > me that the DTD does not allow the specific
> attribute
> > inside the pr:elem element.
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Hotjobs: Enter the "Signing Bonus"
> Sweepstakes
> > http://hotjobs.sweepstakes.yahoo.com/signingbonus
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> xerces-j-user-unsubscribe@xml.apache.org
> > For additional commands, e-mail:
> xerces-j-user-help@xml.apache.org
> >
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Hotjobs: Enter the "Signing Bonus"
> Sweepstakes
> http://hotjobs.sweepstakes.yahoo.com/signingbonus
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> xerces-j-user-help@xml.apache.org
>
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Validation error on prefixed attribute
Posted by Vincent Figari <vi...@yahoo.com>.
Hello Panos,
Sorry may be I did not provide enough info:
With my example, Xerces has schema validation enabled,
and Xerces parser is initialized with a .xsd defining
an element named "elem" having an attribute named "attr"
in a namespace whose URI is "some-uri".
<pr:elem attr="value" xmlns:pr="some-uri" />
will be parsed succesfully by Xerces, but:
<pr:elem pr:attr="value" xmlns:pr="some-uri" />
will cause Xerces to throw:
Fatal: cvc-complex-type.3.2.2: Attribute "pr:attr" is not allowed to appear in element "pr:elem"
Although unusual, this still looks valid xml to me ?
Vincent
--- Panos Konstantinidis <gi...@yahoo.com> wrote:
> >
> > <pr:elem pr:attr="value" xmlns:pr="some-uri" />
> >
> > With schema validation enabled, Xerces throws:
> > Fatal: cvc-complex-type.3.2.2: Attribute "pr:attr"
> > is not allowed to appear in element "pr:elem".
> >
>
> Are you sure that this is a valid XML? It seems to
> me that the DTD does not allow the specific attribute
> inside the pr:elem element.
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
> http://hotjobs.sweepstakes.yahoo.com/signingbonus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
Re: Validation error on prefixed attribute
Posted by Panos Konstantinidis <gi...@yahoo.com>.
>
> <pr:elem pr:attr="value" xmlns:pr="some-uri" />
>
> With schema validation enabled, Xerces throws:
> Fatal: cvc-complex-type.3.2.2: Attribute "pr:attr"
> is not allowed to appear in element "pr:elem".
>
Are you sure that this is a valid XML? It seems to
me that the DTD does not allow the specific attribute
inside the pr:elem element.
__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org