1 16 17 package sax; 18 19 import java.lang.reflect.Method ; 20 21 import java.io.OutputStream ; 22 import java.io.OutputStreamWriter ; 23 import java.io.PrintWriter ; 24 import java.io.UnsupportedEncodingException ; 25 26 import sax.helpers.AttributesImpl; 27 28 import org.xml.sax.Attributes ; 29 import org.xml.sax.Locator ; 30 import org.xml.sax.Parser ; 31 import org.xml.sax.SAXException ; 32 import org.xml.sax.SAXNotRecognizedException ; 33 import org.xml.sax.SAXNotSupportedException ; 34 import org.xml.sax.SAXParseException ; 35 import org.xml.sax.XMLReader ; 36 import org.xml.sax.ext.LexicalHandler ; 37 import org.xml.sax.helpers.DefaultHandler ; 38 import org.xml.sax.helpers.ParserAdapter ; 39 import org.xml.sax.helpers.ParserFactory ; 40 import org.xml.sax.helpers.XMLReaderFactory ; 41 42 51 public class Writer 52 extends DefaultHandler 53 implements LexicalHandler { 54 55 59 61 62 protected static final String NAMESPACES_FEATURE_ID = "http://xml.org/sax/features/namespaces"; 63 64 65 protected static final String NAMESPACE_PREFIXES_FEATURE_ID = "http://xml.org/sax/features/namespace-prefixes"; 66 67 68 protected static final String VALIDATION_FEATURE_ID = "http://xml.org/sax/features/validation"; 69 70 71 protected static final String SCHEMA_VALIDATION_FEATURE_ID = "http://apache.org/xml/features/validation/schema"; 72 73 74 protected static final String SCHEMA_FULL_CHECKING_FEATURE_ID = "http://apache.org/xml/features/validation/schema-full-checking"; 75 76 77 protected static final String VALIDATE_ANNOTATIONS_ID = "http://apache.org/xml/features/validate-annotations"; 78 79 80 protected static final String GENERATE_SYNTHETIC_ANNOTATIONS_ID = "http://apache.org/xml/features/generate-synthetic-annotations"; 81 82 83 protected static final String DYNAMIC_VALIDATION_FEATURE_ID = "http://apache.org/xml/features/validation/dynamic"; 84 85 86 protected static final String LOAD_EXTERNAL_DTD_FEATURE_ID = "http://apache.org/xml/features/nonvalidating/load-external-dtd"; 87 88 89 protected static final String XINCLUDE_FEATURE_ID = "http://apache.org/xml/features/xinclude"; 90 91 92 protected static final String XINCLUDE_FIXUP_BASE_URIS_FEATURE_ID = "http://apache.org/xml/features/xinclude/fixup-base-uris"; 93 94 95 protected static final String XINCLUDE_FIXUP_LANGUAGE_FEATURE_ID = "http://apache.org/xml/features/xinclude/fixup-language"; 96 97 99 100 protected static final String LEXICAL_HANDLER_PROPERTY_ID = "http://xml.org/sax/properties/lexical-handler"; 101 102 104 105 protected static final String DEFAULT_PARSER_NAME = "org.apache.xerces.parsers.SAXParser"; 106 107 108 protected static final boolean DEFAULT_NAMESPACES = true; 109 110 111 protected static final boolean DEFAULT_NAMESPACE_PREFIXES = false; 112 113 114 protected static final boolean DEFAULT_VALIDATION = false; 115 116 117 protected static final boolean DEFAULT_LOAD_EXTERNAL_DTD = true; 118 119 120 protected static final boolean DEFAULT_SCHEMA_VALIDATION = false; 121 122 123 protected static final boolean DEFAULT_SCHEMA_FULL_CHECKING = false; 124 125 126 protected static final boolean DEFAULT_VALIDATE_ANNOTATIONS = false; 127 128 129 protected static final boolean DEFAULT_GENERATE_SYNTHETIC_ANNOTATIONS = false; 130 131 132 protected static final boolean DEFAULT_DYNAMIC_VALIDATION = false; 133 134 135 protected static final boolean DEFAULT_XINCLUDE = false; 136 137 138 protected static final boolean DEFAULT_XINCLUDE_FIXUP_BASE_URIS = true; 139 140 141 protected static final boolean DEFAULT_XINCLUDE_FIXUP_LANGUAGE = true; 142 143 144 protected static final boolean DEFAULT_CANONICAL = false; 145 146 150 151 protected PrintWriter fOut; 152 153 154 protected boolean fCanonical; 155 156 157 protected int fElementDepth; 158 159 160 protected Locator fLocator; 161 162 163 protected boolean fXML11; 164 165 166 protected boolean fInCDATA; 167 168 172 173 public Writer() { 174 } 176 180 181 public void setCanonical(boolean canonical) { 182 fCanonical = canonical; 183 } 185 186 public void setOutput(OutputStream stream, String encoding) 187 throws UnsupportedEncodingException { 188 189 if (encoding == null) { 190 encoding = "UTF8"; 191 } 192 193 java.io.Writer writer = new OutputStreamWriter (stream, encoding); 194 fOut = new PrintWriter (writer); 195 196 } 198 199 public void setOutput(java.io.Writer writer) { 200 201 fOut = writer instanceof PrintWriter 202 ? (PrintWriter )writer : new PrintWriter (writer); 203 204 } 206 210 211 public void setDocumentLocator(Locator locator) { 212 fLocator = locator; 213 } 215 216 public void startDocument() throws SAXException { 217 218 fElementDepth = 0; 219 fXML11 = false; 220 fInCDATA = false; 221 222 } 224 225 public void processingInstruction(String target, String data) 226 throws SAXException { 227 228 if (fElementDepth > 0) { 229 fOut.print("<?"); 230 fOut.print(target); 231 if (data != null && data.length() > 0) { 232 fOut.print(' '); 233 fOut.print(data); 234 } 235 fOut.print("?>"); 236 fOut.flush(); 237 } 238 239 } 241 242 public void startElement(String uri, String local, String raw, 243 Attributes attrs) throws SAXException { 244 245 if (fElementDepth == 0) { 247 if (fLocator != null) { 248 fXML11 = "1.1".equals(getVersion()); 249 fLocator = null; 250 } 251 252 if (!fCanonical) { 256 if (fXML11) { 257 fOut.println("<?xml version=\"1.1\" encoding=\"UTF-8\"?>"); 258 } 259 else { 260 fOut.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); 261 } 262 fOut.flush(); 263 } 264 } 265 266 fElementDepth++; 267 fOut.print('<'); 268 fOut.print(raw); 269 if (attrs != null) { 270 attrs = sortAttributes(attrs); 271 int len = attrs.getLength(); 272 for (int i = 0; i < len; i++) { 273 fOut.print(' '); 274 fOut.print(attrs.getQName(i)); 275 fOut.print("=\""); 276 normalizeAndPrint(attrs.getValue(i), true); 277 fOut.print('"'); 278 } 279 } 280 fOut.print('>'); 281 fOut.flush(); 282 283 } 285 286 public void characters(char ch[], int start, int length) 287 throws SAXException { 288 289 if (!fInCDATA) { 290 normalizeAndPrint(ch, start, length, false); 291 } 292 else { 293 for (int i = 0; i < length; ++i) { 294 fOut.print(ch[start+i]); 295 } 296 } 297 fOut.flush(); 298 299 } 301 302 public void ignorableWhitespace(char ch[], int start, int length) 303 throws SAXException { 304 305 characters(ch, start, length); 306 fOut.flush(); 307 308 } 310 311 public void endElement(String uri, String local, String raw) 312 throws SAXException { 313 314 fElementDepth--; 315 fOut.print("</"); 316 fOut.print(raw); 317 fOut.print('>'); 318 fOut.flush(); 319 320 } 322 326 327 public void warning(SAXParseException ex) throws SAXException { 328 printError("Warning", ex); 329 } 331 332 public void error(SAXParseException ex) throws SAXException { 333 printError("Error", ex); 334 } 336 337 public void fatalError(SAXParseException ex) throws SAXException { 338 printError("Fatal Error", ex); 339 throw ex; 340 } 342 346 347 public void startDTD(String name, String publicId, String systemId) 348 throws SAXException { 349 } 351 352 public void endDTD() throws SAXException { 353 } 355 356 public void startEntity(String name) throws SAXException { 357 } 359 360 public void endEntity(String name) throws SAXException { 361 } 363 364 public void startCDATA() throws SAXException { 365 if (!fCanonical) { 366 fOut.print("<![CDATA["); 367 fInCDATA = true; 368 } 369 } 371 372 public void endCDATA() throws SAXException { 373 if (!fCanonical) { 374 fInCDATA = false; 375 fOut.print("]]>"); 376 } 377 } 379 380 public void comment(char ch[], int start, int length) throws SAXException { 381 if (!fCanonical && fElementDepth > 0) { 382 fOut.print("<!--"); 383 for (int i = 0; i < length; ++i) { 384 fOut.print(ch[start+i]); 385 } 386 fOut.print("-->"); 387 fOut.flush(); 388 } 389 } 391 395 396 protected Attributes sortAttributes(Attributes attrs) { 397 398 AttributesImpl attributes = new AttributesImpl(); 399 400 int len = (attrs != null) ? attrs.getLength() : 0; 401 for (int i = 0; i < len; i++) { 402 String name = attrs.getQName(i); 403 int count = attributes.getLength(); 404 int j = 0; 405 while (j < count) { 406 if (name.compareTo(attributes.getQName(j)) < 0) { 407 break; 408 } 409 j++; 410 } 411 attributes.insertAttributeAt(j, name, attrs.getType(i), 412 attrs.getValue(i)); 413 } 414 415 return attributes; 416 417 } 419 420 protected void normalizeAndPrint(String s, boolean isAttValue) { 421 422 int len = (s != null) ? s.length() : 0; 423 for (int i = 0; i < len; i++) { 424 char c = s.charAt(i); 425 normalizeAndPrint(c, isAttValue); 426 } 427 428 } 430 431 protected void normalizeAndPrint(char[] ch, int offset, int length, boolean isAttValue) { 432 for (int i = 0; i < length; i++) { 433 normalizeAndPrint(ch[offset + i], isAttValue); 434 } 435 } 437 438 protected void normalizeAndPrint(char c, boolean isAttValue) { 439 440 switch (c) { 441 case '<': { 442 fOut.print("<"); 443 break; 444 } 445 case '>': { 446 fOut.print(">"); 447 break; 448 } 449 case '&': { 450 fOut.print("&"); 451 break; 452 } 453 case '"': { 454 if (isAttValue) { 457 fOut.print("""); 458 } 459 else { 460 fOut.print("\""); 461 } 462 break; 463 } 464 case '\r': { 465 fOut.print("
"); 470 break; 471 } 472 case '\n': { 473 if (fCanonical) { 474 fOut.print("
"); 475 break; 476 } 477 } 479 default: { 480 if (fXML11 && ((c >= 0x01 && c <= 0x1F && c != 0x09 && c != 0x0A) 489 || (c >= 0x7F && c <= 0x9F) || c == 0x2028) 490 || isAttValue && (c == 0x09 || c == 0x0A)) { 491 fOut.print("&#x"); 492 fOut.print(Integer.toHexString(c).toUpperCase()); 493 fOut.print(";"); 494 } 495 else { 496 fOut.print(c); 497 } 498 } 499 } 500 } 502 503 protected void printError(String type, SAXParseException ex) { 504 505 System.err.print("["); 506 System.err.print(type); 507 System.err.print("] "); 508 String systemId = ex.getSystemId(); 509 if (systemId != null) { 510 int index = systemId.lastIndexOf('/'); 511 if (index != -1) 512 systemId = systemId.substring(index + 1); 513 System.err.print(systemId); 514 } 515 System.err.print(':'); 516 System.err.print(ex.getLineNumber()); 517 System.err.print(':'); 518 System.err.print(ex.getColumnNumber()); 519 System.err.print(": "); 520 System.err.print(ex.getMessage()); 521 System.err.println(); 522 System.err.flush(); 523 524 } 526 527 protected String getVersion() { 528 if (fLocator == null) { 529 return null; 530 } 531 String version = null; 532 Method getXMLVersion = null; 533 try { 534 getXMLVersion = fLocator.getClass().getMethod("getXMLVersion", new Class []{}); 535 if (getXMLVersion != null) { 537 version = (String ) getXMLVersion.invoke(fLocator, (Object []) null); 538 } 539 } 540 catch (Exception e) { 541 } 544 return version; 545 } 547 551 552 public static void main(String argv[]) { 553 554 if (argv.length == 0) { 556 printUsage(); 557 System.exit(1); 558 } 559 560 Writer writer = null; 562 XMLReader parser = null; 563 boolean namespaces = DEFAULT_NAMESPACES; 564 boolean namespacePrefixes = DEFAULT_NAMESPACE_PREFIXES; 565 boolean validation = DEFAULT_VALIDATION; 566 boolean externalDTD = DEFAULT_LOAD_EXTERNAL_DTD; 567 boolean schemaValidation = DEFAULT_SCHEMA_VALIDATION; 568 boolean schemaFullChecking = DEFAULT_SCHEMA_FULL_CHECKING; 569 boolean validateAnnotations = DEFAULT_VALIDATE_ANNOTATIONS; 570 boolean generateSyntheticAnnotations = DEFAULT_GENERATE_SYNTHETIC_ANNOTATIONS; 571 boolean dynamicValidation = DEFAULT_DYNAMIC_VALIDATION; 572 boolean xincludeProcessing = DEFAULT_XINCLUDE; 573 boolean xincludeFixupBaseURIs = DEFAULT_XINCLUDE_FIXUP_BASE_URIS; 574 boolean xincludeFixupLanguage = DEFAULT_XINCLUDE_FIXUP_LANGUAGE; 575 boolean canonical = DEFAULT_CANONICAL; 576 577 for (int i = 0; i < argv.length; i++) { 579 String arg = argv[i]; 580 if (arg.startsWith("-")) { 581 String option = arg.substring(1); 582 if (option.equals("p")) { 583 if (++i == argv.length) { 585 System.err.println("error: Missing argument to -p option."); 586 } 587 String parserName = argv[i]; 588 589 try { 591 parser = XMLReaderFactory.createXMLReader(parserName); 592 } 593 catch (Exception e) { 594 try { 595 Parser sax1Parser = ParserFactory.makeParser(parserName); 596 parser = new ParserAdapter (sax1Parser); 597 System.err.println("warning: Features and properties not supported on SAX1 parsers."); 598 } 599 catch (Exception ex) { 600 parser = null; 601 System.err.println("error: Unable to instantiate parser ("+parserName+")"); 602 e.printStackTrace(System.err); 603 } 604 } 605 continue; 606 } 607 if (option.equalsIgnoreCase("n")) { 608 namespaces = option.equals("n"); 609 continue; 610 } 611 if (option.equalsIgnoreCase("np")) { 612 namespacePrefixes = option.equals("np"); 613 continue; 614 } 615 if (option.equalsIgnoreCase("v")) { 616 validation = option.equals("v"); 617 continue; 618 } 619 if (option.equalsIgnoreCase("xd")) { 620 externalDTD = option.equals("xd"); 621 continue; 622 } 623 if (option.equalsIgnoreCase("s")) { 624 schemaValidation = option.equals("s"); 625 continue; 626 } 627 if (option.equalsIgnoreCase("f")) { 628 schemaFullChecking = option.equals("f"); 629 continue; 630 } 631 if (option.equalsIgnoreCase("va")) { 632 validateAnnotations = option.equals("va"); 633 continue; 634 } 635 if (option.equalsIgnoreCase("ga")) { 636 generateSyntheticAnnotations = option.equals("ga"); 637 continue; 638 } 639 if (option.equalsIgnoreCase("dv")) { 640 dynamicValidation = option.equals("dv"); 641 continue; 642 } 643 if (option.equalsIgnoreCase("xi")) { 644 xincludeProcessing = option.equals("xi"); 645 continue; 646 } 647 if (option.equalsIgnoreCase("xb")) { 648 xincludeFixupBaseURIs = option.equals("xb"); 649 continue; 650 } 651 if (option.equalsIgnoreCase("xl")) { 652 xincludeFixupLanguage = option.equals("xl"); 653 continue; 654 } 655 if (option.equalsIgnoreCase("c")) { 656 canonical = option.equals("c"); 657 continue; 658 } 659 if (option.equals("h")) { 660 printUsage(); 661 continue; 662 } 663 } 664 665 if (parser == null) { 667 668 try { 670 parser = XMLReaderFactory.createXMLReader(DEFAULT_PARSER_NAME); 671 } 672 catch (Exception e) { 673 System.err.println("error: Unable to instantiate parser ("+DEFAULT_PARSER_NAME+")"); 674 e.printStackTrace(System.err); 675 continue; 676 } 677 } 678 679 try { 681 parser.setFeature(NAMESPACES_FEATURE_ID, namespaces); 682 } 683 catch (SAXException e) { 684 System.err.println("warning: Parser does not support feature ("+NAMESPACES_FEATURE_ID+")"); 685 } 686 try { 687 parser.setFeature(NAMESPACE_PREFIXES_FEATURE_ID, namespacePrefixes); 688 } 689 catch (SAXException e) { 690 System.err.println("warning: Parser does not support feature ("+NAMESPACE_PREFIXES_FEATURE_ID+")"); 691 } 692 try { 693 parser.setFeature(VALIDATION_FEATURE_ID, validation); 694 } 695 catch (SAXException e) { 696 System.err.println("warning: Parser does not support feature ("+VALIDATION_FEATURE_ID+")"); 697 } 698 try { 699 parser.setFeature(LOAD_EXTERNAL_DTD_FEATURE_ID, externalDTD); 700 } 701 catch (SAXNotRecognizedException e) { 702 System.err.println("warning: Parser does not recognize feature ("+LOAD_EXTERNAL_DTD_FEATURE_ID+")"); 703 } 704 catch (SAXNotSupportedException e) { 705 System.err.println("warning: Parser does not support feature ("+LOAD_EXTERNAL_DTD_FEATURE_ID+")"); 706 } 707 try { 708 parser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, schemaValidation); 709 } 710 catch (SAXNotRecognizedException e) { 711 System.err.println("warning: Parser does not recognize feature ("+SCHEMA_VALIDATION_FEATURE_ID+")"); 712 } 713 catch (SAXNotSupportedException e) { 714 System.err.println("warning: Parser does not support feature ("+SCHEMA_VALIDATION_FEATURE_ID+")"); 715 } 716 try { 717 parser.setFeature(SCHEMA_FULL_CHECKING_FEATURE_ID, schemaFullChecking); 718 } 719 catch (SAXNotRecognizedException e) { 720 System.err.println("warning: Parser does not recognize feature ("+SCHEMA_FULL_CHECKING_FEATURE_ID+")"); 721 } 722 catch (SAXNotSupportedException e) { 723 System.err.println("warning: Parser does not support feature ("+SCHEMA_FULL_CHECKING_FEATURE_ID+")"); 724 } 725 try { 726 parser.setFeature(VALIDATE_ANNOTATIONS_ID, validateAnnotations); 727 } 728 catch (SAXNotRecognizedException e) { 729 System.err.println("warning: Parser does not recognize feature ("+VALIDATE_ANNOTATIONS_ID+")"); 730 } 731 catch (SAXNotSupportedException e) { 732 System.err.println("warning: Parser does not support feature ("+VALIDATE_ANNOTATIONS_ID+")"); 733 } 734 try { 735 parser.setFeature(GENERATE_SYNTHETIC_ANNOTATIONS_ID, generateSyntheticAnnotations); 736 } 737 catch (SAXNotRecognizedException e) { 738 System.err.println("warning: Parser does not recognize feature ("+GENERATE_SYNTHETIC_ANNOTATIONS_ID+")"); 739 } 740 catch (SAXNotSupportedException e) { 741 System.err.println("warning: Parser does not support feature ("+GENERATE_SYNTHETIC_ANNOTATIONS_ID+")"); 742 } 743 try { 744 parser.setFeature(DYNAMIC_VALIDATION_FEATURE_ID, dynamicValidation); 745 } 746 catch (SAXNotRecognizedException e) { 747 System.err.println("warning: Parser does not recognize feature ("+DYNAMIC_VALIDATION_FEATURE_ID+")"); 748 } 749 catch (SAXNotSupportedException e) { 750 System.err.println("warning: Parser does not support feature ("+DYNAMIC_VALIDATION_FEATURE_ID+")"); 751 } 752 try { 753 parser.setFeature(XINCLUDE_FEATURE_ID, xincludeProcessing); 754 } 755 catch (SAXNotRecognizedException e) { 756 System.err.println("warning: Parser does not recognize feature ("+XINCLUDE_FEATURE_ID+")"); 757 } 758 catch (SAXNotSupportedException e) { 759 System.err.println("warning: Parser does not support feature ("+XINCLUDE_FEATURE_ID+")"); 760 } 761 try { 762 parser.setFeature(XINCLUDE_FIXUP_BASE_URIS_FEATURE_ID, xincludeFixupBaseURIs); 763 } 764 catch (SAXNotRecognizedException e) { 765 System.err.println("warning: Parser does not recognize feature ("+XINCLUDE_FIXUP_BASE_URIS_FEATURE_ID+")"); 766 } 767 catch (SAXNotSupportedException e) { 768 System.err.println("warning: Parser does not support feature ("+XINCLUDE_FIXUP_BASE_URIS_FEATURE_ID+")"); 769 } 770 try { 771 parser.setFeature(XINCLUDE_FIXUP_LANGUAGE_FEATURE_ID, xincludeFixupLanguage); 772 } 773 catch (SAXNotRecognizedException e) { 774 System.err.println("warning: Parser does not recognize feature ("+XINCLUDE_FIXUP_LANGUAGE_FEATURE_ID+")"); 775 } 776 catch (SAXNotSupportedException e) { 777 System.err.println("warning: Parser does not support feature ("+XINCLUDE_FIXUP_LANGUAGE_FEATURE_ID+")"); 778 } 779 780 if (writer == null) { 782 writer = new Writer(); 783 try { 784 writer.setOutput(System.out, "UTF8"); 785 } 786 catch (UnsupportedEncodingException e) { 787 System.err.println("error: Unable to set output. Exiting."); 788 System.exit(1); 789 } 790 } 791 792 parser.setContentHandler(writer); 794 parser.setErrorHandler(writer); 795 try { 796 parser.setProperty(LEXICAL_HANDLER_PROPERTY_ID, writer); 797 } 798 catch (SAXException e) { 799 } 801 802 writer.setCanonical(canonical); 804 try { 805 parser.parse(arg); 806 } 807 catch (SAXParseException e) { 808 } 810 catch (Exception e) { 811 System.err.println("error: Parse error occurred - "+e.getMessage()); 812 if (e instanceof SAXException ) { 813 Exception nested = ((SAXException )e).getException(); 814 if (nested != null) { 815 e = nested; 816 } 817 } 818 e.printStackTrace(System.err); 819 } 820 } 821 822 } 824 828 829 private static void printUsage() { 830 831 System.err.println("usage: java sax.Writer (options) uri ..."); 832 System.err.println(); 833 834 System.err.println("options:"); 835 System.err.println(" -p name Select parser by name."); 836 System.err.println(" -n | -N Turn on/off namespace processing."); 837 System.err.println(" -np | -NP Turn on/off namespace prefixes."); 838 System.err.println(" NOTE: Requires use of -n."); 839 System.err.println(" -v | -V Turn on/off validation."); 840 System.err.println(" -xd | -XD Turn on/off loading of external DTDs."); 841 System.err.println(" NOTE: Always on when -v in use and not supported by all parsers."); 842 System.err.println(" -s | -S Turn on/off Schema validation support."); 843 System.err.println(" NOTE: Not supported by all parsers."); 844 System.err.println(" -f | -F Turn on/off Schema full checking."); 845 System.err.println(" NOTE: Requires use of -s and not supported by all parsers."); 846 System.err.println(" -va | -VA Turn on/off validation of schema annotations."); 847 System.err.println(" NOTE: Requires use of -s and not supported by all parsers."); 848 System.err.println(" -ga | -GA Turn on/off generation of synthetic schema annotations."); 849 System.err.println(" NOTE: Requires use of -s and not supported by all parsers."); 850 System.err.println(" -dv | -DV Turn on/off dynamic validation."); 851 System.err.println(" NOTE: Not supported by all parsers."); 852 System.err.println(" -xi | -XI Turn on/off XInclude processing."); 853 System.err.println(" NOTE: Not supported by all parsers."); 854 System.err.println(" -xb | -XB Turn on/off base URI fixup during XInclude processing."); 855 System.err.println(" NOTE: Requires use of -xi and not supported by all parsers."); 856 System.err.println(" -xl | -XL Turn on/off language fixup during XInclude processing."); 857 System.err.println(" NOTE: Requires use of -xi and not supported by all parsers."); 858 System.err.println(" -c | -C Turn on/off Canonical XML output."); 859 System.err.println(" NOTE: This is not W3C canonical output."); 860 System.err.println(" -h This help screen."); 861 System.err.println(); 862 863 System.err.println("defaults:"); 864 System.err.println(" Parser: "+DEFAULT_PARSER_NAME); 865 System.err.print(" Namespaces: "); 866 System.err.println(DEFAULT_NAMESPACES ? "on" : "off"); 867 System.err.print(" Prefixes: "); 868 System.err.println(DEFAULT_NAMESPACE_PREFIXES ? "on" : "off"); 869 System.err.print(" Validation: "); 870 System.err.println(DEFAULT_VALIDATION ? "on" : "off"); 871 System.err.print(" Load External DTD: "); 872 System.err.println(DEFAULT_LOAD_EXTERNAL_DTD ? "on" : "off"); 873 System.err.print(" Schema: "); 874 System.err.println(DEFAULT_SCHEMA_VALIDATION ? "on" : "off"); 875 System.err.print(" Schema full checking: "); 876 System.err.println(DEFAULT_SCHEMA_FULL_CHECKING ? "on" : "off"); 877 System.err.print(" Dynamic: "); 878 System.err.println(DEFAULT_DYNAMIC_VALIDATION ? "on" : "off"); 879 System.err.print(" Canonical: "); 880 System.err.println(DEFAULT_CANONICAL ? "on" : "off"); 881 System.err.print(" Validate Annotations: "); 882 System.err.println(DEFAULT_VALIDATE_ANNOTATIONS ? "on" : "off"); 883 System.err.print(" Generate Synthetic Annotations: "); 884 System.err.println(DEFAULT_GENERATE_SYNTHETIC_ANNOTATIONS ? "on" : "off"); 885 System.err.print(" XInclude: "); 886 System.err.println(DEFAULT_XINCLUDE ? "on" : "off"); 887 System.err.print(" XInclude base URI fixup: "); 888 System.err.println(DEFAULT_XINCLUDE_FIXUP_BASE_URIS ? "on" : "off"); 889 System.err.print(" XInclude language fixup: "); 890 System.err.println(DEFAULT_XINCLUDE_FIXUP_LANGUAGE ? "on" : "off"); 891 892 } 894 } | Popular Tags |