1 16 19 import java.io.BufferedInputStream ; 20 import java.io.BufferedReader ; 21 import java.io.File ; 22 import java.io.FileInputStream ; 23 import java.io.FileNotFoundException ; 24 import java.io.IOException ; 25 import java.io.InputStream ; 26 import java.io.InputStreamReader ; 27 import java.io.OutputStreamWriter ; 28 import java.io.Reader ; 29 import java.io.UnsupportedEncodingException ; 30 import java.util.Properties ; 31 32 import javax.xml.parsers.DocumentBuilder ; 33 import javax.xml.parsers.DocumentBuilderFactory ; 34 import javax.xml.parsers.ParserConfigurationException ; 35 import javax.xml.transform.OutputKeys ; 36 import javax.xml.transform.Result ; 37 import javax.xml.transform.Source ; 38 import javax.xml.transform.Templates ; 39 import javax.xml.transform.Transformer ; 40 import javax.xml.transform.TransformerConfigurationException ; 41 import javax.xml.transform.TransformerException ; 42 import javax.xml.transform.TransformerFactory ; 43 import javax.xml.transform.dom.DOMResult ; 44 import javax.xml.transform.dom.DOMSource ; 45 import javax.xml.transform.sax.SAXResult ; 46 import javax.xml.transform.sax.SAXSource ; 47 import javax.xml.transform.sax.SAXTransformerFactory ; 48 import javax.xml.transform.sax.TransformerHandler ; 49 import javax.xml.transform.stream.StreamResult ; 50 import javax.xml.transform.stream.StreamSource ; 51 52 import org.w3c.dom.Node ; 53 import org.xml.sax.InputSource ; 54 import org.xml.sax.SAXException ; 55 import org.xml.sax.XMLFilter ; 56 import org.xml.sax.XMLReader ; 57 import org.xml.sax.helpers.XMLReaderFactory ; 58 68 public class Examples 69 { 70 73 public static void main(String argv[]) 74 throws TransformerException , TransformerConfigurationException , IOException , SAXException , 75 ParserConfigurationException , FileNotFoundException 76 { 77 System.out.println("\n\n==== exampleSimple ===="); 78 try { 79 exampleSimple1("xml/foo.xml", "xsl/foo.xsl"); 80 } catch( Exception ex ) { 81 handleException(ex); 82 } 83 84 System.out.println("\n\n==== exampleSimple2 (see foo.out) ===="); 85 try { 86 exampleSimple2("xml/foo.xml", "xsl/foo.xsl"); 87 } catch( Exception ex ) { 88 handleException(ex); 89 } 90 91 System.out.println("\n\n==== exampleFromStream ===="); 92 try { 93 exampleFromStream("xml/foo.xml", "xsl/foo.xsl"); 94 } catch( Exception ex ) { 95 handleException(ex); 96 } 97 98 System.out.println("\n\n==== exampleFromReader ===="); 99 try { 100 exampleFromReader("xml/foo.xml", "xsl/foo.xsl"); 101 } catch( Exception ex ) { 102 handleException(ex); 103 } 104 105 System.out.println("\n\n==== exampleUseTemplatesObj ===="); 106 try { 107 exampleUseTemplatesObj("xml/foo.xml", "xml/baz.xml", "xsl/foo.xsl"); 108 } catch( Exception ex ) { 109 handleException(ex); 110 } 111 112 System.out.println("\n\n==== exampleContentHandlerToContentHandler ===="); 113 try { 114 exampleContentHandlerToContentHandler("xml/foo.xml", "xsl/foo.xsl"); 115 } catch( Exception ex ) { 116 handleException(ex); 117 } 118 119 System.out.println("\n\n==== exampleXMLReader ===="); 120 try { 121 exampleXMLReader("xml/foo.xml", "xsl/foo.xsl"); 122 } catch( Exception ex ) { 123 handleException(ex); 124 } 125 126 System.out.println("\n\n==== exampleXMLFilter ===="); 127 try { 128 exampleXMLFilter("xml/foo.xml", "xsl/foo.xsl"); 129 } catch( Exception ex ) { 130 handleException(ex); 131 } 132 133 System.out.println("\n\n==== exampleXMLFilterChain ===="); 134 try { 135 exampleXMLFilterChain("xml/foo.xml", "xsl/foo.xsl", "xsl/foo2.xsl", "xsl/foo3.xsl"); 136 } catch( Exception ex ) { 137 handleException(ex); 138 } 139 140 System.out.println("\n\n==== exampleDOM2DOM ===="); 141 try { 142 exampleDOM2DOM("xml/foo.xml", "xsl/foo.xsl"); 143 } catch( Exception ex ) { 144 handleException(ex); 145 } 146 147 System.out.println("\n\n==== exampleParam ===="); 148 try { 149 exampleParam("xml/foo.xml", "xsl/foo.xsl"); 150 } catch( Exception ex ) { 151 handleException(ex); 152 } 153 154 System.out.println("\n\n==== exampleTransformerReuse ===="); 155 try { 156 exampleTransformerReuse("xml/foo.xml", "xsl/foo.xsl"); 157 } catch( Exception ex ) { 158 handleException(ex); 159 } 160 161 System.out.println("\n\n==== exampleOutputProperties ===="); 162 try { 163 exampleOutputProperties("xml/foo.xml", "xsl/foo.xsl"); 164 } catch( Exception ex ) { 165 handleException(ex); 166 } 167 168 System.out.println("\n\n==== exampleUseAssociated ===="); 169 try { 170 exampleUseAssociated("xml/foo.xml"); 171 } catch( Exception ex ) { 172 handleException(ex); 173 } 174 175 System.out.println("\n\n==== exampleContentHandler2DOM ===="); 176 try { 177 exampleContentHandler2DOM("xml/foo.xml", "xsl/foo.xsl"); 178 } catch( Exception ex ) { 179 handleException(ex); 180 } 181 182 System.out.println("\n\n==== exampleAsSerializer ===="); 183 try { 184 exampleAsSerializer("xml/foo.xml", "xsl/foo.xsl"); 185 } catch( Exception ex ) { 186 handleException(ex); 187 } 188 189 System.out.println("\n\n==== exampleContentHandler2DOM ===="); 190 try { 191 exampleContentHandler2DOM("xml/foo.xml", "xsl/foo.xsl"); 192 } catch( Exception ex ) { 193 handleException(ex); 194 } 195 196 System.out.println("\n==== done! ===="); 197 } 198 199 203 public static void exampleSimple1(String sourceID, String xslID) 204 throws TransformerException , TransformerConfigurationException 205 { 206 TransformerFactory tfactory = TransformerFactory.newInstance(); 208 209 Transformer transformer 211 = tfactory.newTransformer(new StreamSource (xslID)); 212 213 transformer.transform( new StreamSource (sourceID), 215 new StreamResult (new OutputStreamWriter (System.out))); 216 } 217 218 222 public static void exampleSimple2(String sourceID, String xslID) 223 throws TransformerException , TransformerConfigurationException 224 { 225 TransformerFactory tfactory = TransformerFactory.newInstance(); 227 228 Transformer transformer 230 = tfactory.newTransformer(new StreamSource (xslID)); 231 232 transformer.transform( new StreamSource (new File (sourceID)), 234 new StreamResult (new File ("foo.out"))); 235 } 236 237 238 241 public static void exampleFromStream(String sourceID, String xslID) 242 throws TransformerException , TransformerConfigurationException , 243 FileNotFoundException 244 { 245 TransformerFactory tfactory = TransformerFactory.newInstance(); 247 248 InputStream xslIS = new BufferedInputStream (new FileInputStream (xslID)); 249 StreamSource xslSource = new StreamSource (xslIS); 250 xslSource.setSystemId(xslID); 252 253 Transformer transformer = tfactory.newTransformer(xslSource); 255 256 InputStream xmlIS = new BufferedInputStream (new FileInputStream (sourceID)); 257 StreamSource xmlSource = new StreamSource (xmlIS); 258 xmlSource.setSystemId(sourceID); 260 261 transformer.transform( xmlSource, new StreamResult (new OutputStreamWriter (System.out))); 263 } 264 265 270 public static void exampleFromReader(String sourceID, String xslID) 271 throws TransformerException , TransformerConfigurationException , 272 FileNotFoundException , UnsupportedEncodingException 273 { 274 TransformerFactory tfactory = TransformerFactory.newInstance(); 276 277 Reader xslReader = new BufferedReader (new InputStreamReader (new FileInputStream (xslID), "UTF-8")); 279 StreamSource xslSource = new StreamSource (xslReader); 280 xslSource.setSystemId(xslID); 282 283 Transformer transformer = tfactory.newTransformer(xslSource); 285 286 Reader xmlReader = new BufferedReader (new InputStreamReader (new FileInputStream (sourceID), "UTF-8")); 288 StreamSource xmlSource = new StreamSource (xmlReader); 289 xmlSource.setSystemId(sourceID); 291 292 transformer.transform( xmlSource, new StreamResult (new OutputStreamWriter (System.out))); 294 } 295 296 297 298 301 public static void exampleUseTemplatesObj(String sourceID1, 302 String sourceID2, 303 String xslID) 304 throws TransformerException , TransformerConfigurationException 305 { 306 307 TransformerFactory tfactory = TransformerFactory.newInstance(); 308 309 Templates templates = tfactory.newTemplates(new StreamSource (xslID)); 312 313 Transformer transformer1 = templates.newTransformer(); 316 Transformer transformer2 = templates.newTransformer(); 317 318 System.out.println("\n\n----- transform of "+sourceID1+" -----"); 319 320 transformer1.transform(new StreamSource (sourceID1), 321 new StreamResult (new OutputStreamWriter (System.out))); 322 323 System.out.println("\n\n----- transform of "+sourceID2+" -----"); 324 325 transformer2.transform(new StreamSource (sourceID2), 326 new StreamResult (new OutputStreamWriter (System.out))); 327 } 328 329 330 331 334 public static void exampleContentHandlerToContentHandler(String sourceID, 335 String xslID) 336 throws TransformerException , 337 TransformerConfigurationException , 338 SAXException , IOException 339 { 340 TransformerFactory tfactory = TransformerFactory.newInstance(); 341 342 if (tfactory.getFeature(SAXSource.FEATURE)) 344 { 345 SAXTransformerFactory stfactory = ((SAXTransformerFactory ) tfactory); 347 348 TransformerHandler handler 351 = stfactory.newTransformerHandler(new StreamSource (xslID)); 352 353 Result result = new SAXResult (new ExampleContentHandler()); 355 handler.setResult(result); 356 357 XMLReader reader=null; 359 360 try { 362 javax.xml.parsers.SAXParserFactory factory= 363 javax.xml.parsers.SAXParserFactory.newInstance(); 364 factory.setNamespaceAware( true ); 365 javax.xml.parsers.SAXParser jaxpParser= 366 factory.newSAXParser(); 367 reader=jaxpParser.getXMLReader(); 368 369 } catch( javax.xml.parsers.ParserConfigurationException ex ) { 370 throw new org.xml.sax.SAXException ( ex ); 371 } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) { 372 throw new org.xml.sax.SAXException ( ex1.toString() ); 373 } catch( NoSuchMethodError ex2 ) { 374 } 375 if( reader==null ) reader = XMLReaderFactory.createXMLReader(); 376 reader.setContentHandler(handler); 377 378 reader.setProperty("http://xml.org/sax/properties/lexical-handler", handler); 381 382 reader.parse(sourceID); 384 } 385 else 386 { 387 System.out.println( 388 "Can't do exampleContentHandlerToContentHandler because tfactory is not a SAXTransformerFactory"); 389 } 390 } 391 392 397 public static void exampleXMLReader(String sourceID, String xslID) 398 throws TransformerException , TransformerConfigurationException , SAXException , IOException { 400 TransformerFactory tfactory = TransformerFactory.newInstance(); 401 if(tfactory.getFeature(SAXSource.FEATURE)) 402 { 403 XMLReader reader 404 = ((SAXTransformerFactory ) tfactory).newXMLFilter(new StreamSource (xslID)); 405 406 reader.setContentHandler(new ExampleContentHandler()); 407 408 reader.parse(new InputSource (sourceID)); 409 } 410 else 411 System.out.println("tfactory does not support SAX features!"); 412 } 413 414 420 public static void exampleXMLFilter(String sourceID, String xslID) 421 throws TransformerException , TransformerConfigurationException , SAXException , IOException { 423 TransformerFactory tfactory = TransformerFactory.newInstance(); 424 425 XMLReader reader=null; 426 427 try { 429 javax.xml.parsers.SAXParserFactory factory= 430 javax.xml.parsers.SAXParserFactory.newInstance(); 431 factory.setNamespaceAware( true ); 432 javax.xml.parsers.SAXParser jaxpParser= 433 factory.newSAXParser(); 434 reader=jaxpParser.getXMLReader(); 435 436 } catch( javax.xml.parsers.ParserConfigurationException ex ) { 437 throw new org.xml.sax.SAXException ( ex ); 438 } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) { 439 throw new org.xml.sax.SAXException ( ex1.toString() ); 440 } catch( NoSuchMethodError ex2 ) { 441 } 442 if( reader==null ) reader = XMLReaderFactory.createXMLReader(); 443 reader.setContentHandler(new ExampleContentHandler()); 445 try 446 { 447 reader.setFeature("http://xml.org/sax/features/namespace-prefixes", 448 true); 449 reader.setFeature("http://apache.org/xml/features/validation/dynamic", 450 true); 451 } 452 catch (SAXException se) 453 { 454 455 } 458 459 XMLFilter filter 460 = ((SAXTransformerFactory ) tfactory).newXMLFilter(new StreamSource (xslID)); 461 462 filter.setParent(reader); 463 464 filter.parse(new InputSource (sourceID)); 468 } 469 470 475 public static void exampleXMLFilterChain( 476 String sourceID, String xslID_1, 477 String xslID_2, String xslID_3) 478 throws TransformerException , TransformerConfigurationException , SAXException , IOException 479 { 480 TransformerFactory tfactory = TransformerFactory.newInstance(); 481 482 Templates stylesheet1 = tfactory.newTemplates(new StreamSource (xslID_1)); 483 Transformer transformer1 = stylesheet1.newTransformer(); 484 485 if (tfactory.getFeature(SAXSource.FEATURE)) 487 { 488 SAXTransformerFactory stf = (SAXTransformerFactory )tfactory; 489 XMLReader reader=null; 490 491 try { 493 javax.xml.parsers.SAXParserFactory factory= 494 javax.xml.parsers.SAXParserFactory.newInstance(); 495 factory.setNamespaceAware( true ); 496 javax.xml.parsers.SAXParser jaxpParser= 497 factory.newSAXParser(); 498 reader=jaxpParser.getXMLReader(); 499 500 } catch( javax.xml.parsers.ParserConfigurationException ex ) { 501 throw new org.xml.sax.SAXException ( ex ); 502 } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) { 503 throw new org.xml.sax.SAXException ( ex1.toString() ); 504 } catch( NoSuchMethodError ex2 ) { 505 } 506 if( reader==null ) reader = XMLReaderFactory.createXMLReader(); 507 508 XMLFilter filter1 = stf.newXMLFilter(new StreamSource (xslID_1)); 509 XMLFilter filter2 = stf.newXMLFilter(new StreamSource (xslID_2)); 510 XMLFilter filter3 = stf.newXMLFilter(new StreamSource (xslID_3)); 511 512 if (null != filter1) { 514 filter1.setParent(reader); 516 517 filter2.setParent(filter1); 519 520 filter3.setParent(filter2); 522 523 filter3.setContentHandler(new ExampleContentHandler()); 524 526 filter3.parse(new InputSource (sourceID)); 533 } 534 else 535 { 536 System.out.println( 537 "Can't do exampleXMLFilter because "+ 538 "tfactory doesn't support asXMLFilter()"); 539 } 540 } 541 else 542 { 543 System.out.println( 544 "Can't do exampleXMLFilter because "+ 545 "tfactory is not a SAXTransformerFactory"); 546 } 547 } 548 549 554 public static Node exampleDOM2DOM(String sourceID, String xslID) 555 throws TransformerException , TransformerConfigurationException , SAXException , IOException , 556 ParserConfigurationException 557 { 558 TransformerFactory tfactory = TransformerFactory.newInstance(); 559 560 if (tfactory.getFeature(DOMSource.FEATURE)) 561 { 562 Templates templates; 563 564 { 565 DocumentBuilderFactory dfactory = 566 DocumentBuilderFactory.newInstance(); 567 dfactory.setNamespaceAware(true); 568 DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); 569 org.w3c.dom.Document outNode = docBuilder.newDocument(); 570 Node doc = docBuilder.parse(new InputSource (xslID)); 571 572 DOMSource dsource = new DOMSource (doc); 573 dsource.setSystemId(xslID); 576 577 templates = tfactory.newTemplates(dsource); 578 } 579 580 Transformer transformer = templates.newTransformer(); 581 DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); 582 dfactory.setNamespaceAware(true); 584 DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); 585 org.w3c.dom.Document outNode = docBuilder.newDocument(); 586 Node doc = docBuilder.parse(new InputSource (sourceID)); 587 588 transformer.transform(new DOMSource (doc), new DOMResult (outNode)); 589 590 Transformer serializer = tfactory.newTransformer(); 591 serializer.transform(new DOMSource (outNode), new StreamResult (new OutputStreamWriter (System.out))); 592 593 return outNode; 594 } 595 else 596 { 597 throw new org.xml.sax 598 .SAXNotSupportedException("DOM node processing not supported!"); 599 } 600 } 601 602 607 public static void exampleParam(String sourceID, 608 String xslID) 609 throws TransformerException , TransformerConfigurationException 610 { 611 TransformerFactory tfactory = TransformerFactory.newInstance(); 612 Templates templates = tfactory.newTemplates(new StreamSource (xslID)); 613 Transformer transformer1 = templates.newTransformer(); 614 Transformer transformer2 = templates.newTransformer(); 615 616 transformer1.setParameter("a-param", 617 "hello to you!"); 618 transformer1.transform(new StreamSource (sourceID), 619 new StreamResult (new OutputStreamWriter (System.out))); 620 621 System.out.println("\n========="); 622 623 transformer2.setOutputProperty(OutputKeys.INDENT, "yes"); 624 transformer2.transform(new StreamSource (sourceID), 625 new StreamResult (new OutputStreamWriter (System.out))); 626 } 627 628 632 public static void exampleTransformerReuse(String sourceID, String xslID) 633 throws TransformerException , TransformerConfigurationException 634 { 635 TransformerFactory tfactory = TransformerFactory.newInstance(); 637 638 Transformer transformer 640 = tfactory.newTransformer(new StreamSource (xslID)); 641 642 transformer.setParameter("a-param", 643 "hello to you!"); 644 645 transformer.transform( new StreamSource (sourceID), 647 new StreamResult (new OutputStreamWriter (System.out))); 648 649 System.out.println("\n=========\n"); 650 651 transformer.setParameter("a-param", 652 "hello to me!"); 653 transformer.setOutputProperty(OutputKeys.INDENT, "yes"); 654 655 transformer.transform( new StreamSource (sourceID), 657 new StreamResult (new OutputStreamWriter (System.out))); 658 } 659 660 663 public static void exampleOutputProperties(String sourceID, String xslID) 664 throws TransformerException , TransformerConfigurationException 665 { 666 667 TransformerFactory tfactory = TransformerFactory.newInstance(); 668 Templates templates = tfactory.newTemplates(new StreamSource (xslID)); 669 Properties oprops = templates.getOutputProperties(); 670 671 oprops.put(OutputKeys.INDENT, "yes"); 672 673 Transformer transformer = templates.newTransformer(); 674 675 transformer.setOutputProperties(oprops); 676 transformer.transform(new StreamSource (sourceID), 677 new StreamResult (new OutputStreamWriter (System.out))); 678 } 679 680 684 public static void exampleUseAssociated(String sourceID) 685 throws TransformerException , TransformerConfigurationException 686 { 687 TransformerFactory tfactory = TransformerFactory.newInstance(); 688 689 if (tfactory instanceof SAXTransformerFactory ) 692 { 693 SAXTransformerFactory stf = ((SAXTransformerFactory ) tfactory); 694 Source sources = 695 stf.getAssociatedStylesheet(new StreamSource (sourceID), 696 null, null, null); 697 698 if(null != sources) 699 { 700 Transformer transformer = tfactory.newTransformer(sources); 701 702 transformer.transform(new StreamSource (sourceID), 703 new StreamResult (new OutputStreamWriter (System.out))); 704 } 705 else 706 { 707 System.out.println("Can't find the associated stylesheet!"); 708 } 709 } 710 } 711 712 715 public static void exampleContentHandler2DOM(String sourceID, String xslID) 716 throws TransformerException , TransformerConfigurationException , SAXException , IOException , ParserConfigurationException 717 { 718 TransformerFactory tfactory = TransformerFactory.newInstance(); 719 720 if (tfactory.getFeature(SAXSource.FEATURE) 723 && tfactory.getFeature(DOMSource.FEATURE)) 724 { 725 SAXTransformerFactory sfactory = (SAXTransformerFactory ) tfactory; 727 728 DocumentBuilderFactory dfactory 730 = DocumentBuilderFactory.newInstance(); 731 DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); 732 org.w3c.dom.Document outNode = docBuilder.newDocument(); 733 734 TransformerHandler handler 737 = sfactory.newTransformerHandler(new StreamSource (xslID)); 738 handler.setResult(new DOMResult (outNode)); 739 740 XMLReader reader=null; 743 744 try { 746 javax.xml.parsers.SAXParserFactory factory= 747 javax.xml.parsers.SAXParserFactory.newInstance(); 748 factory.setNamespaceAware( true ); 749 javax.xml.parsers.SAXParser jaxpParser= 750 factory.newSAXParser(); 751 reader=jaxpParser.getXMLReader(); 752 753 } catch( javax.xml.parsers.ParserConfigurationException ex ) { 754 throw new org.xml.sax.SAXException ( ex ); 755 } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) { 756 throw new org.xml.sax.SAXException ( ex1.toString() ); 757 } catch( NoSuchMethodError ex2 ) { 758 } 759 if( reader==null ) reader= XMLReaderFactory.createXMLReader(); 760 reader.setContentHandler(handler); 761 reader.setProperty("http://xml.org/sax/properties/lexical-handler", 762 handler); 763 764 reader.parse(sourceID); 767 768 exampleSerializeNode(outNode); 770 } 771 else 772 { 773 System.out.println( 774 "Can't do exampleContentHandlerToContentHandler because tfactory is not a SAXTransformerFactory"); 775 } 776 } 777 778 781 public static void exampleSerializeNode(Node node) 782 throws TransformerException , TransformerConfigurationException , SAXException , IOException , 783 ParserConfigurationException 784 { 785 TransformerFactory tfactory = TransformerFactory.newInstance(); 786 787 Transformer serializer = tfactory.newTransformer(); 790 791 serializer.setOutputProperty(OutputKeys.INDENT, "yes"); 792 serializer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); 793 serializer.transform(new DOMSource (node), 794 new StreamResult (new OutputStreamWriter (System.out))); 795 } 796 797 801 public static void exampleAsSerializer(String sourceID, String xslID) 802 throws TransformerException , TransformerConfigurationException , SAXException , IOException , 803 ParserConfigurationException 804 { 805 DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance(); 806 DocumentBuilder docBuilder = dfactory.newDocumentBuilder(); 807 org.w3c.dom.Document outNode = docBuilder.newDocument(); 808 Node doc = docBuilder.parse(new InputSource (sourceID)); 809 810 TransformerFactory tfactory = TransformerFactory.newInstance(); 811 812 Transformer serializer = tfactory.newTransformer(); 815 816 Properties oprops = new Properties (); 817 oprops.put("method", "html"); 818 serializer.setOutputProperties(oprops); 819 serializer.transform(new DOMSource (doc), 820 new StreamResult (new OutputStreamWriter (System.out))); 821 } 822 823 824 private static void handleException( Exception ex ) { 825 System.out.println("EXCEPTION: " ); 826 ex.printStackTrace(); 827 828 if( ex instanceof TransformerConfigurationException ) { 829 System.out.println(); 830 System.out.println("Internal exception: " ); 831 Throwable ex1=((TransformerConfigurationException )ex).getException(); 832 ex1.printStackTrace(); 833 834 if( ex1 instanceof SAXException ) { 835 Exception ex2=((SAXException )ex1).getException(); 836 System.out.println("Internal sub-exception: " ); 837 ex2.printStackTrace(); 838 } 839 } 840 } 841 842 } 843 | Popular Tags |