this is the first set <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:myschema"> <xs:element name="gift"> <xs:complexType> <xs:sequence> <xs:element name="birthday" type="xs:date"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
<?xml version="1.0"?> <gift xmlns="urn:myschema"> <birthday>2001-01-10</birthday> </gift> Ok, I think I am beginning to understand. Thank you for your help. Colin p.s. Why can't the w3c make their specs readable to mere mortals? -----Original Message----- From: Rahul Srivastava [mailto:[EMAIL PROTECTED] Sent: 02 November 2001 08:09 To: [EMAIL PROTECTED] Subject: RE: xsd schema problem > From: Colin Savage <[EMAIL PROTECTED]> > > Then that means that that is not the solution, since in the instance doc > <birthday> is not qualified with a prefix. Unless the fact that there is no > prefix defined for the namespace, implies that elements with no prefix are > qualified? That could explain why it would work with the attribute set to > "qualified", but it doesn't explain why the first schema doesn't work... Elements with no prefixes will be treated as qualified, iff you have specified a default namespace (xmlns="..."). As you have not specified elementFormDefault in your schema file, it defaults to unqualified. This means only your global elements should be qualified. But, by specifying a default namespace, you qualified all the elements. So, your instance file you should be: <?xml version="1.0"?> <prefix:gift xmlns:prefix="urn:myschema"> <birthday>2001-01-10</birthday> </prefix:gift> Which one is your first schema?. Cheers, Rahul. > > Colin. > > -----Original Message----- > From: Rahul Srivastava [mailto:[EMAIL PROTECTED] > Sent: 02 November 2001 06:44 > To: [EMAIL PROTECTED] > Subject: RE: xsd schema problem > > > > From: Colin Savage <[EMAIL PROTECTED]> > > > > someone just told me how to fix... elementFormDefault="qualified"...I'm > not > > entirely sure what this does, but I intend to find out. > > If you set elementFormDefault as qualified, it means that in the instance > doc., > all the elements (global + local) should be qualified. > > If you set elementFormDefault as unqualified, it means that in the instance > doc., you need to qualify *only* the global elements. > > Hope this helps. > > Cheers, > Rahul. > > > > > Thanks for your help > > > > Colin > > > > -----Original Message----- > > From: Rahul Srivastava [mailto:[EMAIL PROTECTED] > > Sent: 02 November 2001 06:11 > > To: [EMAIL PROTECTED] > > Subject: Re: xsd schema problem > > > > > > > From: Colin Savage <[EMAIL PROTECTED]> > > > > > > I can't figure out what is wrong with this schema, can someone please > help > > > (Xerces 1.4.3) > > > > > > [Error] result.xml:3:12: Element type "birthday" must be declared. > > > [Error] result.xml:4:9: The content of element type "gift" must match > > > "(birthday)". > > > <?xml version="1.0"?> > > > <xs:schema > > > xmlns:xs="http://www.w3.org/2001/XMLSchema" > > > targetNamespace="urn:myschema"> > > > <xs:element name="gift"> > > > <xs:complexType> > > > <xs:sequence> > > > <xs:element name="birthday" type="xs:date"/> > > > </xs:sequence> > > > </xs:complexType> > > > </xs:element> > > > </xs:schema> > > > > > > <?xml version="1.0"?> > > > <gift xmlns="urn:myschema"> > > > <birthday>2001-01-10</birthday> > > > </gift> > > > > Though there is nothing wrong with your schema/instance file. The problem > > here > > is the parser is unable to resolve the namespace in the instance file to a > > > grammar, as it can't find your schema file. So, if you specify a > > schemaLocation > > in your instance file, things may work. > > > > <gift xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xsi:schemaLocation="urn:myschema schemaFile.xsd"> > > <birthday>2001-01-10</birthday> > > </gift> > > > > Other way can be to use external-schemaLocation property of xerces-j. This > > is > > not yet implemented in xerces2-j. > > > > Cheers, > > Rahul. > > > > Sun Microsystems, Inc. > > > > > > > > Thanks > > > Colin > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > 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] > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > Sun Microsystems, Inc. > > > --------------------------------------------------------------------- > 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] > Sun Microsystems, Inc. --------------------------------------------------------------------- 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]
