I also had problem validating my xml file against schema. That was a
namespace problem. The Java application would give me lot of validation
errors but XML Spy would simply validate it. That surprises me too!!!!

-Shital Joshi
MFG Systems



-----Original Message-----
From: Jaladurgam, Ramana [mailto:[EMAIL PROTECTED]
Sent: Friday, May 02, 2003 10:08 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Constraints in Schema


Hello Rahul,
  Thanks for the solution.
  I have changed the default namespace to pfx namespace and parser is
validating now.
  But, when I used the "no namespace" version in XML Spy it works fine?
  Any ideas?

Regards,
Ramana.JV.

-----Original Message-----
From: Rahul Srivastava [mailto:[EMAIL PROTECTED]
Sent: Friday, May 02, 2003 4:28 AM
To: [EMAIL PROTECTED]
Subject: RE: Constraints in Schema


Hi Ramana,

The XPath expression in your Schema, for the selector, is something like:
<xsd:selector xpath="Axis"/>

This expression tries to find an element - Axis, with null namespace, but,
the Axis element you have defined in your Schema, lies in
http://www.pearson.com/assessments/MTx namespace. Hence, the Identity
Constraints are not being applied.

You might think, that you have defined a default namespace at the schema
element as, xmlns="http://www.pearson.com/assessments/MTx";, and thus, things
should work. But things don't work this way.
See: http://www.w3.org/TR/xpath#node-tests
[
A QName in the node test is expanded into an expanded-name using the
namespace declarations from the expression context. This is the same way
expansion is done for element type names in start and end-tags except that
the default namespace declared with xmlns is not used: if the QName does not
have a prefix, then the namespace URI is null (this is the same way
attribute names are expanded). It is an error if the QName has a prefix for
which there is no namespace declaration in the expression context. ]

To make your Identity Constraints work, you must explicitly prefix the
elements in the XPath expression for the selector: <xsd:selector
xpath="pfx:Axis"/> where, pfx resolves to
http://www.pearson.com/assessments/MTx.

Hope that helps.

Cheers,
Rahul.


 > -----Original Message-----
 > From: Jaladurgam, Ramana [mailto:[EMAIL PROTECTED]
 > Sent: Thursday, May 01, 2003 9:04 PM
 > To: '[EMAIL PROTECTED]'
 > Subject: RE: Constraints in Schema
 >
 >
 > Attached are the xml and xsd files.
 >
 > I am using "java sax.Counter -v -s -f MTxGD.xml" to test for validation.
>  > Regards,  > Ramana.JV.  >  > -----Original Message-----  > From: Sandy
Gao [mailto:[EMAIL PROTECTED]  > Sent: Thursday, May 01, 2003 10:32 AM  >
To: [EMAIL PROTECTED]  > Subject: Re: Constraints in Schema  >  >
> Xerces does support Identity Constraint. But there is always a  >
possibility  > of bug. :-)  >  > Could you post your xml/xsd files? And how
are you invoking the parser?  >  > Cheers,  > Sandy Gao  > Software
Developer, IBM Canada  > (1-905) 413-3255  > [EMAIL PROTECTED]  >  >  >  >
>
 >                       "Jaladurgam, Ramana"
 >
 >                       <[EMAIL PROTECTED]        To:
 > "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
 >                       earson.com>                 cc:
 >
 >                                                   Subject:
 > Constraints in
 > Schema
 >                       05/01/2003 11:26 AM
 >
 >                       Please respond to
 >
 >                       xerces-j-user
 >
 >
 >
 >
 >
 >
 >
 >
 > Hello Group,
 >   I have an XML Schema that has unique constraint in it.
 >   But Xerces is not validating the XML against this constraints.
 >   Does, Xerces is able to handle unique/relationship constraints that are
 > defined using Xpath.
 >   I know that someone might have already posted this. But the
 > mailing list
 > archive is unavailable at this point.
 >
 >
 > Regards,
 > Ramana.JV.
 >
 > *****************************************************************
 > ***********
 >
 >
 > This email may contain confidential material.
 > If you were not an intended recipient,
 > Please notify the sender and delete all copies.
 > We may monitor email to and from our network.
 > *****************************************************************
 > ***********
 >
 >
 > ---------------------------------------------------------------------
 > To unsubscribe, e-mail: [EMAIL PROTECTED]
 > For additional commands, e-mail: [EMAIL PROTECTED]  >  >
>  >  >  >
---------------------------------------------------------------------
 > To unsubscribe, e-mail: [EMAIL PROTECTED]
 > For additional commands, e-mail: [EMAIL PROTECTED]  >  >
> *****************************************************************
 > ***********
 > This email may contain confidential material.
 > If you were not an intended recipient,
 > Please notify the sender and delete all copies.
 > We may monitor email to and from our network.
 > *****************************************************************
 > ***********
 >



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

****************************************************************************
This email may contain confidential material.
If you were not an intended recipient,
Please notify the sender and delete all copies.
We may monitor email to and from our network.
****************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to