[jsword-svn] common/java/core/org/crosswire/common/xml s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Sat Dec 31 07:32:47 MST 2005


Update of /cvs/jsword/common/java/core/org/crosswire/common/xml
In directory www.crosswire.org:/tmp/cvs-serv8460/java/core/org/crosswire/common/xml

Modified Files:
	TransformingSAXEventProvider.java 
Log Message:
Bug Fix: View -> No Verse Numbers was not working.

Index: TransformingSAXEventProvider.java
===================================================================
RCS file: /cvs/jsword/common/java/core/org/crosswire/common/xml/TransformingSAXEventProvider.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** TransformingSAXEventProvider.java	27 Jul 2005 23:26:42 -0000	1.8
--- TransformingSAXEventProvider.java	31 Dec 2005 14:32:44 -0000	1.9
***************
*** 31,34 ****
--- 31,35 ----
  
  import javax.xml.transform.ErrorListener;
+ import javax.xml.transform.Result;
  import javax.xml.transform.Source;
  import javax.xml.transform.Templates;
***************
*** 55,59 ****
   * @author Joe Walker [joe at eireneh dot com]
   */
! public class TransformingSAXEventProvider implements SAXEventProvider
  {
      /**
--- 56,60 ----
   * @author Joe Walker [joe at eireneh dot com]
   */
! public class TransformingSAXEventProvider extends Transformer implements SAXEventProvider
  {
      /**
***************
*** 103,153 ****
  
      /* (non-Javadoc)
!      * @see org.crosswire.common.xml.SAXEventProvider#provideSAXEvents(org.xml.sax.ContentHandler)
       */
!     public void provideSAXEvents(ContentHandler handler) throws SAXException
      {
          try
          {
!             Source src_in = new SAXSource(new SAXEventProviderXMLReader(xmlsep), new SAXEventProviderInputSource());
! 
!             TemplateInfo tinfo = getTemplateInfo();
! 
!             SAXResult res_out = new SAXResult(handler);
! 
!             Transformer transformer = tinfo.getTemplates().newTransformer();
! 
!             for (Iterator it = outputs.keySet().iterator(); it.hasNext(); )
!             {
!                 String key = (String) it.next();
!                 String val = getOutputProperty(key);
!                 transformer.setOutputProperty(key, val);
!             }
  
!             for (Iterator it = params.keySet().iterator(); it.hasNext(); )
!             {
!                 String key = (String) it.next();
!                 Object val = params.get(key);
!                 transformer.setParameter(key, val);
!             }
  
!             if (errors != null)
!             {
!                 transformer.setErrorListener(errors);
!             }
  
!             if (resolver != null)
!             {
!                 transformer.setURIResolver(resolver);
!             }
  
!             transformer.transform(src_in, res_out);
          }
!         catch (IOException ex)
          {
!             throw new SAXException(ex);
          }
!         catch (TransformerConfigurationException ex)
          {
!             throw new SAXException(ex);
          }
          catch (TransformerException ex)
--- 104,162 ----
  
      /* (non-Javadoc)
!      * @see javax.xml.transform.Transformer#transform(javax.xml.transform.Source, javax.xml.transform.Result)
       */
!     public void transform(Source xmlSource, Result outputTarget) throws TransformerException
      {
+         TemplateInfo tinfo;
          try
          {
!             tinfo = getTemplateInfo();
!         }
!         catch (IOException e)
!         {
!             throw new TransformerException(e);
!         }
  
!         Transformer transformer = tinfo.getTemplates().newTransformer();
  
!         for (Iterator it = outputs.keySet().iterator(); it.hasNext(); )
!         {
!             String key = (String) it.next();
!             String val = getOutputProperty(key);
!             transformer.setOutputProperty(key, val);
!         }
  
!         for (Iterator it = params.keySet().iterator(); it.hasNext(); )
!         {
!             String key = (String) it.next();
!             Object val = params.get(key);
!             transformer.setParameter(key, val);
!         }
  
!         if (errors != null)
!         {
!             transformer.setErrorListener(errors);
          }
! 
!         if (resolver != null)
          {
!             transformer.setURIResolver(resolver);
          }
! 
!         transformer.transform(xmlSource, outputTarget);
!     }
! 
!     /* (non-Javadoc)
!      * @see org.crosswire.common.xml.SAXEventProvider#provideSAXEvents(org.xml.sax.ContentHandler)
!      */
!     public void provideSAXEvents(ContentHandler handler) throws SAXException
!     {
!         try
          {
!             Source xmlSource = new SAXSource(new SAXEventProviderXMLReader(xmlsep), new SAXEventProviderInputSource());
! 
!             SAXResult outputTarget = new SAXResult(handler);
! 
!             transform(xmlSource, outputTarget);
          }
          catch (TransformerException ex)



More information about the jsword-svn mailing list