[jsword-svn] jsword/java/jsword/org/crosswire/jsword/book/filter/thml s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Tue May 24 18:12:37 MST 2005


Update of /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/filter/thml
In directory www.crosswire.org:/tmp/cvs-serv11115/java/jsword/org/crosswire/jsword/book/filter/thml

Modified Files:
	THMLFilter.java 
Log Message:
Fixed a problem of character entity references causing a parsing error.

Index: THMLFilter.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/filter/thml/THMLFilter.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** THMLFilter.java	17 May 2005 00:43:15 -0000	1.18
--- THMLFilter.java	25 May 2005 01:12:35 -0000	1.19
***************
*** 65,69 ****
          try
          {
!             ele = parse(plain);
          }
          catch (Exception ex1)
--- 65,69 ----
          try
          {
!             ele = parse(XMLUtil.cleanAllEntities(plain));
          }
          catch (Exception ex1)
***************
*** 72,101 ****
                                "\non: " + plain); //$NON-NLS-1$
  
!             // Attempt to fix broken entities, that could be a low damage
!             // way to fix a broken input string
!             String cropped = XMLUtil.cleanAllEntities(plain);
  
              try
              {
!                 ele = parse(cropped);
              }
              catch (Exception ex2)
              {
!                 log.warn("Could not fix it by cleaning entities: " + ex2.getMessage()); //$NON-NLS-1$
! 
!                 // So just try to strip out all XML looking things
!                 String shawn = XMLUtil.cleanAllTags(cropped);
  
                  try
                  {
-                     ele = parse(shawn);
-                 }
-                 catch (Exception ex3)
-                 {
-                     log.warn("Could not fix it by cleaning tags: " + ex3.getMessage()); //$NON-NLS-1$
- 
                      ele = OSISUtil.factory().createP();
                      ele.addContent(plain);
                  }
              }
          }
--- 72,95 ----
                                "\non: " + plain); //$NON-NLS-1$
  
!             // So just try to strip out all XML looking things
!             String shawn = XMLUtil.cleanAllTags(plain);
  
              try
              {
!                 ele = parse(shawn);
              }
              catch (Exception ex2)
              {
!                 log.warn("Could not fix it by cleaning tags: " + ex2.getMessage()); //$NON-NLS-1$
  
                  try
                  {
                      ele = OSISUtil.factory().createP();
                      ele.addContent(plain);
                  }
+                 catch (Exception ex4)
+                 {
+                     log.warn("no way. say it ain't so! " + ex4.getMessage()); //$NON-NLS-1$
+                 }
              }
          }
***************
*** 105,109 ****
              {
                  ele = OSISUtil.factory().createP();
-                 ele.addContent(plain);
              }
              // Make sure that other places don't report this problem
--- 99,102 ----



More information about the jsword-svn mailing list