OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] problem with noNamespaceSchemaLocation.....urgent ! !!

[ Lists Home | Date Index | Thread Index ]

Okay, here's the pertinent hrefs:

Properties:
http://xml.apache.org/xerces2-j/features.html#validation

FAQ:
http://xml.apache.org/xerces2-j/faq-pcfp.html


Now, these are Xerces 2.0.1 docs. I've tried setting this up in 1.4.1 as
follows. Everything runs, the schema is located, but no validation occurs:

public class TrivialApplication
{
 public static void main( String argv[] )
  throws SAXException, 
   FileNotFoundException, IOException
 {
  File inFile = new File( "d:\\xml\\schemas\\order.xml" );
  InputStream is = new FileInputStream( inFile );
  InputSource input = new InputSource( is );
  
  DefaultHandler handler = new OrderReporter();
  
  XMLReader parser = new SAXParser();
   try {
            parser.setFeature("http://xml.org/sax/features/namespaces";,
true);
            parser.setFeature("http://xml.org/sax/features/validation";,
true);
 
parser.setFeature("http://apache.org/xml/features/validation/dynamic";,
true);
 
parser.setFeature("http://apache.org/xml/features/validation/schema";, true);
//
parser.setFeature("http://apache.org/xml/features/validation/schema-full-che
cking", true);
 
parser.setProperty("http://apache.org/xml/properties/schema/external-noNames
paceSchemaLocation", "file:///d:/xml/schemas/order.xsd");
        }
        catch (SAXException e) {
            e.printStackTrace(System.err);
        }

  parser.setContentHandler( handler );
  parser.parse( input );
 }
}

Note that this code is not compatible with 2.0.1. I'm d/ling 2.0.1 and
trying again. If I succeed, you'll know; if I don't, we'll pretend this
conversation never occurred.

-- Jeff




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS