You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@apache.org on 2002/01/15 04:50:23 UTC

cvs commit: xml-xerces/java/docs faq-xni.xml docs-book.xml

andyc       02/01/14 19:50:23

  Modified:    java/docs docs-book.xml
  Added:       java/docs faq-xni.xml
  Log:
  Added FAQ page for the Xerces Native Interface. The first entry
  details how to override the default parser configuration.
  
  Revision  Changes    Path
  1.12      +1 -0      xml-xerces/java/docs/docs-book.xml
  
  Index: docs-book.xml
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/docs/docs-book.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- docs-book.xml	17 Dec 2001 16:12:09 -0000	1.11
  +++ docs-book.xml	15 Jan 2002 03:50:23 -0000	1.12
  @@ -38,6 +38,7 @@
     <faq title='Common FAQs' id='faq-common' source='faq-common.xml'/>
     <faq title='General FAQs' id='faq-general' source='faq-general.xml'/>
     <faq title='Parser Configuration, Features and Properties FAQs' id='faq-pcfp' source='faq-pcfp.xml'/>
  +  <faq title='Xerces Native Interface FAQs' id='faq-xni' source='faq-xni.xml'/>
     <faq title='Building and Running FAQs' 
          id='faq-build' source='faq-build.xml'/>
     <faq title='Writing Applications FAQs' 
  
  
  
  1.1                  xml-xerces/java/docs/faq-xni.xml
  
  Index: faq-xni.xml
  ===================================================================
  <?xml version='1.0' encoding='UTF-8'?>
  <!DOCTYPE faqs SYSTEM 'dtd/faqs.dtd'>
  <faqs title='Xerces Native Interface FAQs'>
   <faq title='Overriding Default Parser Configuration'>
    <q>How do I change the default parser configuration?</q>
    <a>
     <p>
      It is possible to override the default parser configuration used
      by the Xerces2 parsers without writing any code or changing the
      existing parser classes. Moreover, the DOM and SAX parsers created
      using the JAXP interfaces will use the specified parser configuration
      transparently and without need to call additional methods to set the
      parser configuration.
     </p>
     <p>
      The DOM and SAX parsers decide which parser configuration to use in
      the following order:
     </p>
     <ol>
      <li>
       First, the <code>org.apache.xerces.xni.parser.XMLParserConfiguration</code>
       file is requested from the <code>META-INF/services/</code> directory. 
       This file contains the class name of the parser configuration.
      </li>
      <li>
       Next, the <code>org.apache.xerces.xni.parser.XMLParserConfiguration</code>
       system property is queried for the class name of the parser configuration.
      </li>
      <li>
       Finally, the <code>org.apache.xerces.parsers.StandardParserConfiguration</code>
       is used as the default parser configuration.
      </li>
     </ol>
     <note>
      In all cases, the parser configuration class must have a public,
      no argument constructor so that it can be instantiated dynamically.
     </note>
     <p>
      When using Java 2, it is not necessary to rebuild the Xerces jar files
      in order to override the default parser configuration using the first
      method. As long as a JAR file containing the appropriate file exists
      in the <code>META-INF/services/</code> directory appears <em>before</em>
      the Xerces JAR files, the parser will use the new parser configuration.
     </p>
     <p>
      The second method can always be used on the command line for the JVM
      by using the <code>-D</code> option. For example, to override the
      default parser configuration using a custom configuration named
      <code>MyConfig</code>, use the following command line:
     </p>
     <source>java -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=MyConfig application_class</source>
    </a>
   </faq>
  </faqs>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org