xml-xmlbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Franco Lazzarino <f...@ufl.edu>
Subject RE: Schema retrieval error
Date Tue, 20 Jul 2004 22:15:25 GMT
you see i wont know the type for the buckets' contents because they can
be of any valid xml. which means that i cannot compile a bean for each
type.

the strategy that i'm planning to use is:

* make a SchemaTypeSystem based on all the (namespace, schema url) pairs
in the xsi:schemaLocation attribute of my root element.
* making a SchemaTypeLoader based on the above SchemaTypeSystem to
validate my instance document

but it seems that there must be an easier way to validate against the
xsi:schemaLocation and the xmlns:* attributes already in the root
element.


On Tue, 2004-07-20 at 17:42, David Remy wrote:
> > -----Original Message-----
> > From: Cezar Andrei
> > Sent: Tuesday, July 20, 2004 1:57 PM
> > To: xmlbeans-user@xml.apache.org
> > Subject: RE: Schema retrieval error
> > 
> > A definition of any like this:
> >    <xsd:any namespace="##any" maxOccurs="unbounded"/>
> > means that the processContents attribute gets the default value, which
> is
> > "strict".
> > 
> > This means that when validation occurs the validator will search in
> the
> > current SchemaTypeSystem for explicit definitions of the elements in
> the
> > any bucket.
> > 
> > In your case, you need to have the schema files that define the
> "dc:title"
> > and "dc:date" when you validate your document.
> 
> you could also have the attribute processContents="lax" on the xsd:any
> and the schema would validate even without having these other types in
> the type system.
> 
> > 
> > Cezar
> > 
> > > -----Original Message-----
> > > From: Franco Lazzarino [mailto:flaz@ufl.edu]
> > > Sent: Tuesday, July 20, 2004 2:58 PM
> > > To: xmlbeans-user@xml.apache.org
> > > Subject: Re: Schema retrieval error
> > >
> > >
> > > I forgot to mention that all the elements that errors occur
> > > are defined
> > > as 'xsd:any' elements in the schema.
> > > <xsd:any namespace="##any" maxOccurs="unbounded"/>
> > >
> > > but each schema associated with these elements is declared in the
> root
> > > element of the document.
> > >
> > > everything that is under the root (METS) namespace validates fine.
> the
> > > elements associated with the non-root namespaces are the ones that
> are
> > > not validating. it seems as if these schemas are not being accessed.
> > >
> > > On Tue, 2004-07-20 at 12:48, Franco Lazzarino wrote:
> > > > I believe that xmlbeans is not retrieving the proper schemas for
> > > > namespaces that are used inside the document that are
> > > different than the
> > > > namespace of the document element.
> > > >
> > > > For example, when I parse the document and validate it
> > > using the code
> > > > below I get the given output.
> > > >
> > > > XML:
> > > > <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
> > > > <METS:mets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > > 	xmlns:METS="http://www.loc.gov/METS/"
> > > > 	xmlns:xlink="http://www.w3.org/TR/xlink"
> > > > 	xmlns:dc="http://purl.org/dc/elements/1.1/"
> > > > 	xmlns:techmd="http://www.fcla.edu/dls/md/techmd/"
> > > > 	xmlns:palmm="http://www.fcla.edu/dls/md/palmm/"
> > > > 	xmlns:rightsmd="http://www.fcla.edu/dls/md/rightsmd/"
> > > > 	xsi:schemaLocation="http://www.loc.gov/METS/
> > > > http://www.loc.gov/standards/mets/mets.xsd
> > > > 		http://purl.org/dc/elements/1.1/
> > > > http://dublincore.org/schemas/xmls/simpledc20021212.xsd
> > > > 		http://www.fcla.edu/dls/md/techmd/
> > > > http://www.fcla.edu/dls/md/techmd.xsd
> > > > 		http://www.fcla.edu/dls/md/palmm/
> > > http://www.fcla.edu/dls/md/palmm.xsd
> > > > 		http://www.fcla.edu/dls/md/rightsmd/
> > > > http://www.fcla.edu/dls/md/rightsmd.xsd"
> > > > 		...
> > > > 		...
> > > > 		...
> > > > 		<METS:mdWrap MIMETYPE="text/xml" MDTYPE="DC">
> > > > 			<METS:xmlData>
> > > > 				<dc:title>Crop statistics</dc:title>
> > > > 				<dc:date>1931</dc:date>
> > > > 			</METS:xmlData>
> > > > 		</METS:mdWrap>
> > > > 		...
> > > > 		...
> > > > 		...
> > > > </METS:mets>
> > > >
> > > >
> > > > CODE:
> > > > XmlOptions options = new XmlOptions();
> > > > Vector errors = new Vector();
> > > > options.setErrorListener(errors);
> > > >
> > > > MetsDocument root = MetsDocument.Factory.parse(file, options);
> > > >
> > > > root.validate(options);
> > > > for (Iterator iter = errors.iterator(); iter.hasNext();) {
> > > > 	XmlError error = (XmlError) iter.next();
> > > > 	System.out.println(error.getMessage());
> > > > 	System.out.println();
> > > > }
> > > >
> > > >
> > > > OUTPUT:
> > > > Element not allowed (strict wildcard, and no definition found):
> > > > title@http://purl.org/dc/elements/1.1/ in element
> > > > xmlData@http://www.loc.gov/METS/
> > > > 	...
> > > > 	...
> > > > 	...
> > > >
> > > > is this something that I am (not?) doing, or is it part of
> > > xmlbeans that
> > > > is not finished yet?
> > > >
> > > > -----------------------------
> > > > Franco Lazzarino flaz@ufl.edu
> > > > Florida Center for Library Automation http://www.fcla.edu
> > > >
> > > >
> > > >
> > > > -
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> > > > For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> > > > Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
> > > >
> > > >
> > >
> > >
> > > -
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> > > Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
> > >
> > >
> > 
> > -
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> > Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
> 
> 
> - ---------------------------------------------------------------------
> To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
> Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/
> 
> 


- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Mime
View raw message