users
[Top] [All Lists]

RE: [cinjug-users] XML Schema validation

To: <twcrone@xxxxxxxxxxxxx>, <users@xxxxxxxxxx>
Subject: RE: [cinjug-users] XML Schema validation
From: "Bullock, Jeffrey A." <Jeff_Bullock@xxxxxxxxxxx>
Date: Thu, 17 Nov 2005 12:49:15 -0500
Delivered-to: mailing list users@cinjug.org
Mailing-list: contact users-help@cinjug.org; run by ezmlm
Thread-index: AcXrl5RpXOTm4Pr3Qx69LYBBCpcQjgABnl9w
Thread-topic: [cinjug-users] XML Schema validation
We accomplish it this way:

   class MyEntityResolver implements org.xml.sax.EntityResolver {
      public org.xml.sax.InputSource resolveEntity(String publicId,
String systemId)
                                throws org.xml.sax.SAXException,
java.io.IOException
      {
         if (<override>) {
            return new
org.xml.sax.InputSource(PATH_TO_OVERRIDING_SCHEMA);
         }
         else
         {
            // use the default behaviour
            return null;
         }
      }
   };

Then in your application:

   xmlreader.setEntityResolver(new MyEntityResolver());

Cheers,

Jeff Bullock
jeff_bullock@xxxxxxxxxxx


-----Original Message-----
From: twcrone@xxxxxxxxxxxxx [mailto:twcrone@xxxxxxxxxxxxx] 
Sent: Thursday, November 17, 2005 11:54 AM
To: users@xxxxxxxxxx
Subject: [cinjug-users] XML Schema validation


I know that you set the following features to have a Xerces XML parser
to 
validate a document versus a schema...

                        parser.setFeature
( "http://xml.org/sax/features/validation";, true );
                        parser.setFeature( 
                
                "http://apache.org/xml/features/validation/schema";, true
);

But that only validates against the schema declared in the actual
document.  
How do I override the one declared and have it validate against a schema
that 
I specify?

--
twcrone@xxxxxxxxxxxxx
859-278-9634

---------
You may unsubscribe from this mailing list
by sending a blank email addressed to: users-unsubscribe@xxxxxxxxxx

--
Find additional help by sending a blank email
addressed to:
users-help@xxxxxxxxxx


<Prev in Thread] Current Thread [Next in Thread>