From ericye@locus.apache.org Thu Sep 7 18:32:46 2000 Return-Path: Mailing-List: contact general-help@xml.apache.org; run by ezmlm Delivered-To: mailing list general@xml.apache.org Received: (qmail 91163 invoked from network); 7 Sep 2000 18:32:46 -0000 Received: from mailhub1.almaden.ibm.com (198.4.83.44) by locus.apache.org with SMTP; 7 Sep 2000 18:32:46 -0000 Received: from sun1.cupertino.ibm.com (sun1.cupertino.ibm.com [9.6.22.48]) by mailhub1.almaden.ibm.com (8.8.8/8.8.8) with ESMTP id LAA37436 for ; Thu, 7 Sep 2000 11:27:52 -0700 Received: from Trojan (Trojan.cupertino.ibm.com [9.6.22.229]) by sun1.cupertino.ibm.com (8.9.3/8.9.0) with SMTP id LAA12661 for ; Thu, 7 Sep 2000 11:32:20 -0700 (PDT) Message-ID: <00b001c018fa$1a85c980$e5160609@cupertino.ibm.com> Reply-To: "Eric Ye" From: "Eric Ye" To: Subject: Fw: Problems finding schema definition Date: Thu, 7 Sep 2000 11:33:22 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N Resend this one. I didn't see it posted. _____ Eric Ye * IBM, JTC - Silicon Valley * ericye@locus.apache.org ----- Original Message ----- From: "Eric Ye" To: Sent: Thursday, September 07, 2000 10:47 AM Subject: Re: Problems finding schema definition > > We could do a better job for the error messages. > > #0 should be the name of an anonymous complex type defined in one of the > element decls that appears first in you schema file. You can ignore the > line # and column # when you see a Schema error. > > The error message means you have a complex type decl like this > ... that contains no particle children in its > content, elements, groups, sequences and choices are categorized as > particles. > > However, although the spec didn't see it explicity, we found something in > the primer about complexType, that says if no "content" attribute is > specified, the defaut value is "elementOnly", and that is how we > implemented it. > > So in your case, the solution is to add "content='textOnly'" to the > anonymous type kicked out by the parser. > > If you can post the actual xsd file, I'd be more than happy to help take a > look. > _____ > > > Eric Ye * IBM, JTC - Silicon Valley * ericye@locus.apache.org > > ----- Original Message ----- > From: > To: > Sent: Thursday, September 07, 2000 6:35 AM > Subject: Re: Problems finding schema definition > > > > Thanks for the replies. Andy, I took your thorough advice but am getting > > another error. The top of my XML looks like: > > > > line 1: > > line 2: > > line 3: > line 4: xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' > > line 5: xsi:schemaLocation='NS GMI.xsd'> > > > > and the error I get is: > > > > java -cp > C:\XML\xerces-1_1_3\xerces.jar;C:\XML\xerces-1_1_3\xercesSamples.jar > dom.DOMCount -v file:///H:/Andy/Programs/Web/XML/GMI.xml > > [Error] GMIwithSchema.xml:5:38:Schema error: complexType '#0' with a > elementOnly or mixed content need to have at least one particle child. > > > > Some questions: > > > > Is the error in my XML file (as suggested by the fact that the error is on > line 5 of my XML file,) or my XSD file (as suggested by the fact that it is > > a "Schema error")? > > I have no '#0' in my schema file so how can it cause an error? > > What is a particle child? I have searched various XML resources for this > but with no luck. > > Is there a list of parser error messages somewhere and an explanation of > what they mean? > > > > Again, any assistance is appreciated. > > > > thanks, > > > > Andy > > > > > > > > > > > > > > Andy Clark on 06/09/2000 18:38:50 > > > > Please respond to general@xml.apache.org > > > > To: general@xml.apache.org > > cc: > > Subject: Re: Problems finding schema definition > > > > > > Andy_Carr@tertio.com wrote: > > > > > > [...] > > > > > > > Okay, there are two problems with your XML and XSD files. > > > > 1) Your XML file is in a namespace but your XML Schema grammar > > doesn't specify a target namespace. If your document instance > > is in a namespace, then your grammar has to specify a target > > namespace and the two must match! Here's an example of a > > grammar: > > > > > > > targetNamespace='NS'> > > > > > > > > > > > > > > > > > > However, this leads to a common problem. When you specify a > > target namespace in your XML Schema document, then all of the > > references to element types and attribute groups are QNames! > > What does this mean? This means that my example is wrong. > > > > The Schema processor will look at "sub" as a qualified name > > so it thinks that you are referring to an element declared > > in the default namespace. And since I have bound the default > > namespace to "http://www.w3.org/1999/XMLSchema", it will look > > in *that* grammar for an element called "sub". > > > > So how do we avoid this problem? Well, we have to fully > > qualify the "sub" element reference which, in turn, means > > that we need to bind that namespace. Here's the fix: > > > > > > > xmlns:a='NS' targetNamespace='NS'> > > > > > > > > > > > > > > > > > > Notice that the prefix "a" is bound to *exactly* the same > > namespace string as is specified in the targetNamespace > > attribute! > > > > Now on to your second problem... > > > > 2) The namespace binding is not the way in which that you > > tell the XML Schema processor to find your Schema grammar. The > > namespace is only a means of uniquely qualifying a namespace. > > So the following is incorrect. > > > > > > > > > > > > > > First you have to bind the XML Schema instance document > > namespace and then use the special attribute "schemaLocation" > > in order to locate your grammar. (The specification says > > that this is only a "hint" but who are they kidding...) The > > value of schemaLocation is a set of tuples: each tuple is a > > pair of namespace and grammar location. For example: > > > > > > > xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' > > xsi:schemaLocation='NS grammar.xsd'> > > > > > > > > Also, you probably shouldn't use 'file:///.../GMI.xsd' as > > your namespace binding; it's really the location of your > > grammar and should only be used in the xsi:schemaLocation > > or xsi:noNamespaceSchemaLocation attribute. > > > > Some disclaimers: > > > > a) Schema is confusing so if I've made any mistakes in the > > above examples, someone please correct me. > > b) I really shouldn't be using "NS" as my namespace binding. > > I'm only using it to simplify my example; otherwise > > *everything* is a URI and confuses the person trying to > > figure out what's related to what. > > > > -- > > Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org > > > > --------------------------------------------------------------------- > > In case of troubles, e-mail: webmaster@xml.apache.org > > To unsubscribe, e-mail: general-unsubscribe@xml.apache.org > > For additional commands, e-mail: general-help@xml.apache.org > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > In case of troubles, e-mail: webmaster@xml.apache.org > > To unsubscribe, e-mail: general-unsubscribe@xml.apache.org > > For additional commands, e-mail: general-help@xml.apache.org > > > > >