xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mor...@apache.org
Subject cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/trax TransformerImpl.java
Date Thu, 25 Oct 2001 13:48:16 GMT
morten      01/10/25 06:48:16

  Modified:    java/src/org/apache/xalan/xsltc/trax TransformerImpl.java
  Log:
  Fix for a bug that seemed to be triggered by the sequence in which Xerces'
  lexical handler and content handler were set. The lexical handler must be
  set before the content handler, otherwise Xerces will keep generating the
  first startElement() event over and over again.
  PR:		bugzilla 2465
  Obtained from:	n/a
  Submitted by:	morten@xml.apache.org
  Reviewed by:	morten@xml.apache.org
  
  Revision  Changes    Path
  1.30      +12 -3     xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerImpl.java
  
  Index: TransformerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TransformerImpl.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- TransformerImpl.java	2001/10/25 12:34:07	1.29
  +++ TransformerImpl.java	2001/10/25 13:48:16	1.30
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: TransformerImpl.java,v 1.29 2001/10/25 12:34:07 morten Exp $
  + * @(#)$Id: TransformerImpl.java,v 1.30 2001/10/25 13:48:16 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -144,6 +144,8 @@
   
       private final static String LEXICAL_HANDLER_PROPERTY =
   	"http://xml.org/sax/properties/lexical-handler";
  +    private static final String NAMESPACE_FEATURE =
  +	"http://xml.org/sax/features/namespaces";
   
       /**
        * Implements JAXP's Transformer constructor
  @@ -309,13 +311,13 @@
   		// all content/lexical events
   		dom = new DOMImpl();
   		final DOMBuilder builder = dom.getBuilder();
  -		reader.setContentHandler(builder);
   		try {
   		    reader.setProperty(LEXICAL_HANDLER_PROPERTY, builder);
   		}
   		catch (SAXException e) {
   		    // quitely ignored
   		}
  +		reader.setContentHandler(builder);
   
   		// Parse the input and build the internal DOM
   		reader.parse(input);
  @@ -353,6 +355,13 @@
   
   		// With a StreamSource we need to create our own parser
   		final SAXParserFactory factory = SAXParserFactory.newInstance();
  +		try {
  +		    factory.setFeature(NAMESPACE_FEATURE,true);
  +		}
  +		catch (Exception e) {
  +		    factory.setNamespaceAware(true);
  +		}
  +
   		final SAXParser parser = factory.newSAXParser();
   		final XMLReader reader = parser.getXMLReader();
   
  @@ -364,13 +373,13 @@
   		// all content/lexical events
   		dom = new DOMImpl();
   		final DOMBuilder builder = dom.getBuilder();
  -		reader.setContentHandler(builder);
   		try {
   		    reader.setProperty(LEXICAL_HANDLER_PROPERTY, builder);
   		}
   		catch (SAXException e) {
   		    // quitely ignored
   		}
  +		reader.setContentHandler(builder);
   
   		InputSource input;
   		if (streamInput != null)
  
  
  

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


Mime
View raw message