Re: pollo's validation of a wierd schema
Olivier POTONNIEE <[email protected]> Mon, 07 Jun 2004 09:33:49 +0200
| Newsgroups | gmane.editors.pollo.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --------------090808060100010804060704 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit This is a known problem for which I submitted a patch, which has not yet been integrated in the distribution. I you want to want to fix it by yourself, you need to change the Java code of the PolloMSvVerfier class. I attach here the full class file. -- Olivier Benedykt P. Barszcz wrote: > HI list, > <prolog> > This pollo editor is just a great stuff... Thanks for making it > available via sf.net. > </prolog> > > <problem> > pollo_conf.xml > [...] > <viewtype name="osisCore" description="osisCore.1.1.1.xsd Schema"> > <schemas> > <schema factory="org.outerj.pollo.xmleditor.schema.MsvSchemaFactory"> > <parameter name="source" > value="classpath:/schema/osisCore.1.1.1.xsd"/> > </schema> > </schemas> > <display-specifications> > <display-specification > factory="org.outerj.pollo.xmleditor.displayspec.GenericDisplaySpecFactory"> > <parameter name="use-random-colors" value="true"/> > </display-specification> > </display-specifications> > [...] > > </template> > <template description="OSIS (v1.1.1) file" > factory="org.outerj.pollo.template.FileTemplateFactory"> > <parameter name="source" > value="classpath:/template/osisCore.xml"/> > </template> > [...] > > The osisCore.xml file contains this: > <?xml version="1.0" encoding="UTF-8"?> > <osis xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:noNamespaceSchemaLocation="osisCore.1.1.xsd"> > <osisText/> > </osis> > > This here is the Schema file; > http://whi.wts.edu/OSIS/Projects/Markup/specs/osisCore.1.1.1.xsd > > The PROBLEM is that when I try "SCHEMA -> validate document" from the > menu i get this in the validator window: > unexpected attribute "xsi:noNamespaceSchemaLocation" > > Does it mean I am unable to validate the document against a legitimate > schema? > > > tnx for any pointer in this matter > > Benedict > > a hapy user of pollo xml editor. > > > ------------------------------------------------------- > This SF.Net email is sponsored by the new InstallShield X. > >> From Windows to Linux, servers to mobile, InstallShield X is the one > > installation-authoring solution that does it all. Learn more and > evaluate today! http://www.installshield.com/Dev2Dev/0504 > _______________________________________________ > Pollo-development mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/pollo-development > > --------------090808060100010804060704 Content-Type: text/java; name="PolloMsvVerifier.java" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="PolloMsvVerifier.java" package org.outerj.pollo.xmleditor.schema.msv; import com.sun.msv.util.StartTagInfo; import com.sun.msv.verifier.Acceptor; import com.sun.msv.verifier.DocumentDeclaration; import com.sun.msv.verifier.Verifier; import org.xml.sax.ErrorHandler; import org.xml.sax.SAXException; import com.sun.msv.util.StringRef; import com.sun.msv.verifier.ValidityViolation; import com.sun.msv.verifier.ErrorInfo; /** * Extension of the standard MSV Verifier class. It adds the posiblity * to stop validation at a certain moment. This is used for determing the content * model of the currently selected node, this works in combination with * the SAXEventGenerator how will call setStopNow(true) when it streams * the element in question. See MsvSchema.getExpression for how its used. * * <p> * In the end, it would probably be better to write a special DOM version * of the Verifier, but this was just quicker to implement. * * @author Bruno Dumon */ public class PolloMsvVerifier extends Verifier { protected boolean stopNow = false; public PolloMsvVerifier(DocumentDeclaration documentDeclaration, ErrorHandler errorHandler) { super(documentDeclaration, errorHandler); } protected void onNextAcceptorReady(StartTagInfo info, Acceptor acceptor) throws SAXException { if (stopNow) { // to stop the validation here, we throw an exception, though it's not really // meant as an exception, its just to stop the validation process here. throw new StopValidationException(info, acceptor); } } public void setStopNow(boolean stopNow) { this.stopNow = stopNow; } /** * signals an error. * * This method can be overrided by the derived class to provide different behavior. */ protected ValidityViolation onError( StringRef ref, String defaultMsg, ErrorInfo ei ) throws SAXException { if ((ErrorInfo.BadAttribute.class.isInstance(ei)) && (((ErrorInfo.BadAttribute)ei).attLocalName.equals("noNamespaceSchemaLocation"))) { return null; } else { return super.onError( ref, defaultMsg, ei ); } } protected ValidityViolation onError( String msg, ErrorInfo ei ) throws SAXException { if ((ErrorInfo.BadAttribute.class.isInstance(ei)) && (((ErrorInfo.BadAttribute)ei).attLocalName.equals("noNamespaceSchemaLocation"))) { return null; } else { return super.onError( msg, ei ); } } } --------------090808060100010804060704-- ------------------------------------------------------- This SF.Net email is sponsored by the new InstallShield X. From Windows to Linux, servers to mobile, InstallShield X is the one installation-authoring solution that does it all. Learn more and evaluate today! http://www.installshield.com/Dev2Dev/0504