View Javadoc
1 /*** 2 * Copyright (c) 2002, CodeStreet LLC. All rights reserved.<p> 3 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following 4 * conditions are met:<p> 5 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer 7 * in the documentation and/or other materials provided with the distribution. Neither the name of CodeStreet LLC. nor the 8 * names of its contributors may be used to endorse or promote products derived from this software without specific prior written 9 * permission.<p> 10 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT 11 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 12 * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 13 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 14 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 15 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.<p> 16 */ 17 18 package com.codestreet.messageforge; 19 20 import org.jdom.Element; 21 import org.jdom.Namespace; 22 import org.jdom.input.SAXBuilder; 23 24 /*** 25 * Converter class for XML. This class provides the methods for marshalling a 26 * <tt>RMapMessage</tt> to XML and for unmarshalling XML to 27 * <tt>RMapMessage</tt> 28 * 29 * @author Jawaid Hakim. 30 */ 31 public abstract class ConverterXML extends Converter 32 { 33 /*** 34 * This will set whether XML validation occurs when parsing. 35 * 36 * @param validate 37 * <tt>true</tt> if validation will occur, otherwise 38 * <tt>false</tt>. 39 * @param schemas 40 * Set of XML schemas to use for validation. Each schema must be 41 * specified as an <tt>URL</tt>. For example, 42 * <tt>http://www.w3.org/2001/12/soap-envelope soap-envelope.xsd</tt>. 43 */ 44 public static void setXmlValidation(boolean validate, String[] schemas) 45 throws ConverterException 46 { 47 VALIDATE_XML = validate; 48 if (VALIDATE_XML) 49 { 50 if (schemas == null) 51 throw new ConverterException("No schema specified"); 52 53 StringBuffer schemasConcat = new StringBuffer(); 54 for (int i = 0; i < schemas.length; ++i) 55 { 56 if (i > 0) 57 schemasConcat.append(" "); 58 59 schemasConcat.append(schemas[i]); 60 } 61 62 SCHEMAS = schemasConcat.toString(); 63 } 64 } 65 66 /*** 67 * This will set whether empty elements are expanded from <tagName>to 68 * <tagName></tagName>. 69 * 70 * @param expandEmptyElements 71 * boolean indicating whether or not empty elements should be 72 * expanded. 73 */ 74 public static void setExpandEmptyElements(boolean expandEmptyElements) 75 { 76 EXPAND_EMPTY_ELEMENTS = expandEmptyElements; 77 } 78 79 /*** 80 * This will set the indent <tt>String</tt> to use; this is usually a 81 * <tt>String</tt> of empty spaces. If you pass <tt>null</tt>, or the 82 * empty string (""), then no indentation will happen. 83 * 84 * @param indent 85 * <tt>String</tt> to use for indentation. 86 */ 87 public static void setIndent(String indent) 88 { 89 INDENT = indent; 90 } 91 92 /*** 93 * Sets the output encoding. The name should be an accepted XML encoding. 94 * 95 * @param encoding 96 * the encoding format. Use XML-style names like UTF-8 or 97 * ISO-8859-1 or US-ASCII 98 */ 99 public static void setEncoding(String encoding) 100 { 101 ENCODING = encoding; 102 } 103 104 /*** 105 * Gets the output encoding. 106 * 107 * @see #setEncoding(String) 108 */ 109 public static String getEncoding() 110 { 111 return ENCODING; 112 } 113 114 /*** 115 * This will set whether the XML declaration ( <?xml version="1.0"?>) is 116 * written with the XML. 117 * 118 * @param omitDeclaration 119 * Flag indicating whether or not the XML declaration should be 120 * written. 121 */ 122 public static void setOmitDeclaration(boolean omitDeclaration) 123 { 124 OMIT_DECLARATION = omitDeclaration; 125 } 126 127 /*** 128 * This will set whether the XML declaration ( <?xml version="1.0" 129 * encoding="UTF-8"?>) includes the encoding of the document. It is common 130 * to omit this in uses such as WML and other wireless device protocols. 131 * 132 * @param omitEncoding 133 * Flag indicating whether or not the XML declaration should 134 * indicate the document encoding. 135 */ 136 public static void setOmitEncoding(boolean omitEncoding) 137 { 138 OMIT_ENCODING = omitEncoding; 139 } 140 141 /*** 142 * This will set whether newlines are printed with the generated XML. 143 * 144 * @param newLines 145 * <tt>true</tt> indicates new lines should be printed, else 146 * new lines are ignored (compacted). 147 */ 148 public static void setNewlines(boolean newLines) 149 { 150 NEWLINES = newLines; 151 } 152 153 /*** 154 * Convert a message object to XML. 155 * 156 * @param source 157 * Message object. 158 * @return XML representation of the message object. 159 */ 160 public static String marshal(RMapMessage source) throws ConverterException 161 { 162 java.io.StringWriter writer = new java.io.StringWriter(); 163 marshal(false, false, 0, RMsg.XML_TAG, source, writer); 164 return writer.toString(); 165 } 166 167 /*** 168 * Convert a message object to XML. 169 * 170 * @param skipJMSSupported 171 * If <tt>true</tt> then fields that are natively supported by 172 * JMS <tt>MapMessage</tt> are not marshalled. 173 * @param source 174 * Message object. 175 * @return XML representation of the message object. If none of the fields 176 * were marshalled, then <tt>null</tt> if returned. 177 */ 178 public static String marshal(boolean skipJMSSupported, RMapMessage source) 179 throws ConverterException 180 { 181 java.io.StringWriter writer = new java.io.StringWriter(); 182 int numFlds = marshal(skipJMSSupported, false, 0, RMsg.XML_TAG, source, 183 writer); 184 return (numFlds != 0) ? writer.toString() : null; 185 } 186 187 /*** 188 * Convert a message object to XML and write to specified <tt>File</tt>. 189 * 190 * @param source 191 * Message object. 192 * @param target 193 * Target output file. 194 */ 195 public static void marshal(RMapMessage source, java.io.File target) 196 throws ConverterException 197 { 198 try 199 { 200 java.io.BufferedWriter writer = new java.io.BufferedWriter( 201 new java.io.FileWriter(target)); 202 marshal(false, false, 0, RMsg.XML_TAG, source, writer); 203 writer.close(); 204 } 205 catch (java.io.IOException ex) 206 { 207 throw new ConverterException(ex); 208 } 209 } 210 211 /*** 212 * Convert a message object to XML and write to specified 213 * <tt>OutputStream</tt>. 214 * 215 * @param source 216 * Message object. 217 * @param target 218 * Target output stream. 219 */ 220 public static void marshal(RMapMessage source, java.io.OutputStream target) 221 throws ConverterException 222 { 223 try 224 { 225 java.io.OutputStreamWriter writer = new java.io.OutputStreamWriter( 226 new java.io.BufferedOutputStream(target)); 227 marshal(false, false, 0, RMsg.XML_TAG, source, writer); 228 writer.close(); 229 } 230 catch (java.io.IOException ex) 231 { 232 throw new ConverterException(ex); 233 } 234 } 235 236 /*** 237 * Convert a message object to XML and write to specified target writer. 238 * 239 * @param source 240 * Message object. 241 * @param target 242 * Target writer. 243 */ 244 public static void marshal(RMapMessage source, java.io.Writer target) 245 throws ConverterException 246 { 247 marshal(false, false, 0, RMsg.XML_TAG, source, target); 248 } 249 250 /*** 251 * Convert a message object to XML and write to specified target writer. 252 * 253 * @param skipJMSSupported 254 * If <tt>true</tt> then fields that are natively supported by 255 * JMS <tt>MapMessage</tt> are skipped. 256 * @param skipDeclaration 257 * If <tt>true</tt> then the XML declaration is not written. 258 * @param indentLevel 259 * Indentation level. 260 * @param xmlTag 261 * XML tag for the top level element. 262 * @param source 263 * Message object. 264 * @param target 265 * Target writer. 266 * @return Number of fields that were marshalled. 267 */ 268 public static int marshal(boolean skipJMSSupported, 269 boolean skipDeclaration, int indentLevel, String xmlTag, 270 RMapMessage source, java.io.Writer target) 271 throws ConverterException 272 { 273 try 274 { 275 // Write XML encoding 276 if (!skipDeclaration) 277 writeDeclaration(target); 278 279 // Write start tag opening 280 openTag(target, xmlTag, indentLevel, INDENT); 281 282 // Write message name 283 writeAttribute(target, RMsg.XML_ATTR_NAME, source.getName()); 284 285 // Close start tag opening 286 closeStartTag(target, NEWLINES); 287 288 // Initialize number of marshalled fields 289 int numFlds = 0; 290 291 ++indentLevel; 292 RFld[] fldsArray = source.getFieldsAsArray(); 293 for (int i = fldsArray.length - 1; i >= 0; --i) 294 { 295 RFld fld = fldsArray[i]; 296 297 // If the field value is set, and, either we are not skipping 298 // JMS supported 299 // fields or this field is not suported by JMS then marshal it 300 if (fld.isValSet() 301 && (!skipJMSSupported || !fld.getType() 302 .isJMSSupported())) 303 { 304 ++numFlds; 305 fld.marshal(target, indentLevel, INDENT, NEWLINES, 306 EXPAND_EMPTY_ELEMENTS); 307 } 308 } 309 --indentLevel; 310 311 // Write close tag 312 closeTag(target, xmlTag, indentLevel, INDENT, NEWLINES); 313 314 return numFlds; 315 } 316 catch (java.io.IOException ex) 317 { 318 throw new ConverterException(ex); 319 } 320 } 321 322 /*** 323 * Create a message object from XML. 324 * 325 * @param source 326 * Source XML. 327 */ 328 public static RMapMessage unmarshal(String source) 329 throws ConverterException 330 { 331 return unmarshal(new java.io.StringReader(source)); 332 } 333 334 /*** 335 * Create a message object from specified <tt>Reader</tt>. 336 * 337 * @param source 338 * Source <tt>Reader</tt>. 339 */ 340 public static RMapMessage unmarshal(java.io.Reader source) 341 throws ConverterException 342 { 343 try 344 { 345 SAXBuilder builder = createBuilder(); 346 Element root = builder.build(source).getRootElement(); 347 String msgName = root.getAttributeValue(RMsg.XML_ATTR_NAME); 348 if (msgName != null) 349 { 350 return process(root, createMsgObj(msgName)); 351 } 352 // Message name is not present - create an empty message 353 return process(root, new RMsg()); 354 } 355 catch (Exception ex) 356 { 357 throw new ConverterException(ex); 358 } 359 } 360 361 /*** 362 * Create a <code>SAXBuilder</code>. 363 * 364 * @return A new <code>SAXBuilder</code>. 365 * @seealso input.SAXBuilder 366 */ 367 private static SAXBuilder createBuilder() 368 { 369 SAXBuilder builder = new SAXBuilder(); 370 if (VALIDATE_XML) 371 { 372 builder.setValidation(true); 373 builder.setFeature( 374 "http://apache.org/xml/features/validation/schema", true); 375 builder 376 .setProperty( 377 "http://apache.org/xml/properties/schema/external-schemaLocation", 378 SCHEMAS); 379 } 380 return builder; 381 } 382 383 /*** 384 * Create a message object from specified <tt>InputStream</tt>. 385 * 386 * @param source 387 * Source <tt>InputStream</tt>. 388 */ 389 public static RMapMessage unmarshal(java.io.InputStream source) 390 throws ConverterException 391 { 392 try 393 { 394 SAXBuilder builder = createBuilder(); 395 if (VALIDATE_XML) 396 { 397 builder.setFeature( 398 "http://apache.org/xml/features/validation/schema", 399 true); 400 builder 401 .setProperty( 402 "http://apache.org/xml/properties/schema/external-schemaLocation", 403 SCHEMAS); 404 } 405 Element root = builder.build(source).getRootElement(); 406 String msgName = root.getAttributeValue(RMsg.XML_ATTR_NAME); 407 if (msgName != null) 408 { 409 return process(root, createMsgObj(msgName)); 410 } 411 // Message name is not present - create an empty message 412 return process(root, new RMsg()); 413 } 414 catch (Exception ex) 415 { 416 throw new ConverterException(ex); 417 } 418 } 419 420 /*** 421 * Create a message object from specified <tt>File</tt>. 422 * 423 * @param source 424 * Source <tt>File</tt>. 425 */ 426 public static RMapMessage unmarshal(java.io.File source) 427 throws ConverterException 428 { 429 try 430 { 431 SAXBuilder builder = createBuilder(); 432 Element root = builder.build(source).getRootElement(); 433 String msgName = root.getAttributeValue(RMsg.XML_ATTR_NAME); 434 if (msgName != null) 435 { 436 return process(root, createMsgObj(msgName)); 437 } 438 // Message name is not present - create an empty message 439 return process(root, new RMsg()); 440 } 441 catch (Exception ex) 442 { 443 throw new ConverterException(ex); 444 } 445 } 446 447 /*** 448 * Create a message object from specified <tt>URL</tt>. 449 * 450 * @param source 451 * Source <tt>URL</tt>. 452 */ 453 public static RMapMessage unmarshal(java.net.URL source) 454 throws ConverterException 455 { 456 try 457 { 458 SAXBuilder builder = createBuilder(); 459 Element root = builder.build(source).getRootElement(); 460 String msgName = root.getAttributeValue(RMsg.XML_ATTR_NAME); 461 if (msgName != null) 462 { 463 return process(root, createMsgObj(msgName)); 464 } 465 // Message name is not present - create an empty message 466 return process(root, new RMsg()); 467 } 468 catch (Exception ex) 469 { 470 throw new ConverterException(ex); 471 } 472 } 473 474 /*** 475 * Create message object from message name. 476 * 477 * @param msgName 478 * Message name. 479 * @return Message object instance. 480 */ 481 private static RMapMessage createMsgObj(String msgName) 482 throws ConverterException 483 { 484 RMapMessage msgObj = Converter.createMsgObject(msgName); 485 return msgObj; 486 } 487 488 /*** 489 * Create a message object from specified <tt>Element</tt>. 490 * 491 * @param root 492 * Source <tt>Element</tt>. 493 */ 494 public static RMapMessage unmarshal(Element root) throws ConverterException 495 { 496 String msgName = root.getAttributeValue(RMsg.XML_ATTR_NAME); 497 if (msgName != null) 498 { 499 return process(root, Converter.createMsgObject(msgName)); 500 } 501 // Message name is not present - create an empty message 502 return process(root, new RMsg()); 503 } 504 505 /*** 506 * Create a message object from specified <tt>Element</tt>. 507 * 508 * @param source 509 * Source XML. 510 * @param target 511 * Target message object. 512 */ 513 public static RMapMessage unmarshal(String source, RMapMessage target) 514 throws ConverterException 515 { 516 try 517 { 518 SAXBuilder builder = createBuilder(); 519 Element root = builder.build(new java.io.StringReader(source)) 520 .getRootElement(); 521 return process(root, target); 522 } 523 catch (Exception ex) 524 { 525 throw new ConverterException(ex); 526 } 527 } 528 529 /*** 530 * Create a message object from specified <tt>Element</tt>. 531 * 532 * @param source 533 * Source <tt>Element</tt>. 534 * @param target 535 * Target message object. 536 */ 537 private static RMapMessage process(Element source, RMapMessage target) 538 throws ConverterException 539 { 540 try 541 { 542 for (java.util.Iterator iter = source.getChildren().iterator(); iter 543 .hasNext();) 544 { 545 Element elem = (Element) iter.next(); 546 String fldName = elem.getAttributeValue(RFld.XML_ATTR_NAME); 547 RFld fld = target.getFieldIfExists(fldName); 548 if (fld != null) 549 { 550 if (!fld.isLocked()) 551 fld.set(elem); 552 } 553 else if (target.isEmptyMsg()) 554 { 555 try 556 { 557 RFld newFld = RFldFactory.createField(elem.getName(), 558 fldName, elem 559 .getAttributeValue(RFld.XML_ATTR_ID)); 560 newFld.set(elem); 561 target.addField(newFld); 562 } 563 catch (FactoryException ex) 564 { 565 // TODO 566 } 567 } 568 } 569 return target; 570 } 571 catch (FieldValidationException ex) 572 { 573 throw new ConverterException(ex); 574 } 575 } 576 577 /*** 578 * Write an open tag to the specified writer. This is used to start a XML 579 * element. 580 * 581 * @param writer 582 * Writer. 583 * @param tag 584 * Tag. 585 * @param indentLevel 586 * Indentation level. 587 * @param indent 588 * Indentation. 589 */ 590 public static final void openTag(java.io.Writer writer, String tag, 591 int indentLevel, String indent) throws java.io.IOException 592 { 593 StringBuffer buf = new StringBuffer(); 594 if (indent != null && indent.length() != 0) 595 { 596 for (int i = indentLevel - 1; i >= 0; --i) 597 buf.append(indent); 598 } 599 buf.append('<').append(tag); 600 601 writer.write(buf.toString()); 602 } 603 604 /*** 605 * Write the close of an open tag to the specified writer. This is used to 606 * close a XML element that has no content. 607 * 608 * @param writer 609 * Writer. 610 * @param newLines 611 * A newline is written if <tt>true</tt>. 612 */ 613 public static final void closeTag(java.io.Writer writer, boolean newLines) 614 throws java.io.IOException 615 { 616 // Space before the closing characters otherwise some browsers get 617 // confused - See Java and XML by Brett McLaughlin 2nd Ed. page 15 618 if (newLines) 619 writer.write(" />\n"); 620 else 621 writer.write(" />"); 622 } 623 624 /*** 625 * Close the close of an open tag to the specified writer. This is used to 626 * close a XML element that has content. 627 * 628 * @param writer 629 * Writer. 630 * @param tag 631 * Tag. 632 * @param indentLevel 633 * Indentation level. 634 * @param indent 635 * Indentation. 636 */ 637 public static final void closeTag(java.io.Writer writer, String tag, 638 int indentLevel, String indent, boolean newLines) 639 throws java.io.IOException 640 { 641 StringBuffer buf = new StringBuffer(); 642 if (indent != null && indent.length() != 0) 643 { 644 for (int i = indentLevel - 1; i >= 0; --i) 645 buf.append(indent); 646 } 647 buf.append("</").append(tag).append('>'); 648 if (newLines) 649 buf.append('\n'); 650 651 writer.write(buf.toString()); 652 } 653 654 /*** 655 * Write the close of an open tag to the specified writer. This is used to 656 * close an element that has content. 657 * 658 * @param writer 659 * Writer. 660 * @param newLines 661 * A newline is written if <tt>true</tt>. 662 */ 663 public static final void closeStartTag(java.io.Writer writer, 664 boolean newLines) throws java.io.IOException 665 { 666 if (newLines) 667 writer.write(">\n"); 668 else 669 writer.write('>'); 670 } 671 672 /*** 673 * Write up to three attributes to the specified writer. If any attribute 674 * name is <tt>null</tt> then that attribute is skipped. 675 * 676 * @param writer 677 * Writer. 678 * @param name0 679 * First attribute name. 680 * @param value0 681 * First attribute value. 682 * @param name1 683 * Second attribute name. 684 * @param value1 685 * Second attribute value. 686 */ 687 public static final void writeAttribute(java.io.Writer writer, 688 String name0, String value0, String name1, String value1) 689 throws java.io.IOException 690 { 691 StringBuffer buf = new StringBuffer(80); 692 if (name0 != null) 693 { 694 String escaped = escape(value0); 695 buf.append(' ').append(name0).append('=').append('"').append( 696 escaped).append('"'); 697 } 698 if (name1 != null) 699 { 700 String escaped = escape(value1); 701 buf.append(' ').append(name1).append('=').append('"').append( 702 escaped).append('"'); 703 } 704 writer.write(buf.toString()); 705 } 706 707 /*** 708 * Write an attribute to the specified writer. 709 * 710 * @param writer 711 * Writer. 712 * @param name 713 * Attribute name. 714 * @param val 715 * Attribute value. 716 */ 717 public static final void writeAttribute(java.io.Writer writer, String name, 718 String val) throws java.io.IOException 719 { 720 StringBuffer buf = new StringBuffer(80); 721 String escaped = escape(val); 722 buf.append(' ').append(name).append('=').append('"').append(escaped) 723 .append('"'); 724 writer.write(buf.toString()); 725 } 726 727 /*** 728 * Escape markup characters within attribute values. For example, if the 729 * attribute value contains the less than character (' <') then the escape 730 * sequence '<' is used as replacement. The following meta characters are 731 * replaced: ' <'', '>', '&', single quote, and double quotes. 732 * 733 * @param val 734 * Attribute value to esacpe. 735 * @return Escaped attribute value. 736 */ 737 private static String escape(String val) 738 { 739 String result = escape('&', "&", val); 740 result = escape('<', "<", result); 741 result = escape('>', ">", result); 742 result = escape('\'', "'", result); 743 result = escape('"', """, result); 744 return result; 745 } 746 747 private static String escape(char meta, String replacement, String source) 748 { 749 int start = 0; 750 int ind = source.indexOf(meta); 751 if (ind >= 0) 752 { 753 StringBuffer result = new StringBuffer(); 754 String tmpVal = source; 755 int len = tmpVal.length(); 756 while (ind >= 0) 757 { 758 result.append(tmpVal.substring(start, ind)); 759 result.append(replacement); 760 if (ind + 1 < len) 761 { 762 tmpVal = tmpVal.substring(ind + 1); 763 ind = tmpVal.indexOf(meta); 764 } 765 else 766 { 767 tmpVal = ""; 768 break; 769 } 770 } 771 result.append(tmpVal); 772 return result.toString(); 773 } 774 775 return source; 776 } 777 778 public static void main(String[] args) 779 { 780 String result = ConverterXML 781 .escape("coupon < 9.0 && coupon >= 4.5 && name = 'jawaid'"); 782 } 783 784 /*** 785 * Write the XML version/encoding to specified writer. 786 * 787 * @param writer 788 * Writer. 789 */ 790 public static final void writeDeclaration(java.io.Writer writer) 791 throws java.io.IOException 792 { 793 if (!OMIT_DECLARATION) 794 { 795 StringBuffer buf = new StringBuffer(80); 796 if (OMIT_ENCODING) 797 buf.append("<?xml version=\"1.0\"?>"); 798 else 799 buf.append("<?xml version=\"1.0\" encoding=\"") 800 .append(ENCODING).append("\"?>"); 801 802 if (NEWLINES) 803 buf.append('\n'); 804 805 writer.write(buf.toString()); 806 } 807 } 808 809 /*** 810 * Encoding - default is UTF-8. 811 * 812 * @see #setEncoding(String) 813 */ 814 private static String ENCODING = "UTF-8"; 815 816 /*** 817 * This will set the indent String to use; this is usually a String of empty 818 * spaces. Default is <tt>1</tt> space. 819 * 820 * @see #setIndent(String) 821 */ 822 private static String INDENT = " "; 823 824 /*** 825 * Newlines - default is <tt>true</tt> 826 * 827 * @see #setNewlines(boolean) 828 */ 829 private static boolean NEWLINES = true; 830 831 /*** 832 * This will set whether the XML declaration ( <?xml version="1.0"?>) is 833 * generated with the XML. Default is <tt>false</tt>. 834 * 835 * @see #setOmitEncoding(boolean) 836 */ 837 private static boolean OMIT_DECLARATION = false; 838 839 /*** 840 * This will set whether the XML declaration ( <?xml version="1.0" 841 * encoding="UTF-8"?>) includes the encoding of the document. Default is 842 * <tt>false</tt>. 843 * 844 * @see #setOmitEncoding(boolean) 845 */ 846 private static boolean OMIT_ENCODING = false; 847 848 /*** 849 * This will set whether empty elements are expanded from <tagName>to 850 * <tagName></tagName>. Default is <tt>false</tt>. 851 * 852 * @see #setExpandEmptyElements(boolean) 853 */ 854 private static boolean EXPAND_EMPTY_ELEMENTS = false; 855 856 /*** 857 * This will set whether XML valdation will occur when parsing XML. Default 858 * is <tt>false</tt>. 859 * 860 * @see #setXmlValidation(boolean, String[]) 861 */ 862 private static boolean VALIDATE_XML = false; 863 864 /*** 865 * Schemas to validate XML imput. 866 */ 867 private static String SCHEMAS; 868 869 /*** 870 * This will set the namespace - default is <tt>Namespace.NO_NAMESPACE</tt>. 871 */ 872 static final Namespace NAMESPACE = Namespace.NO_NAMESPACE; 873 }

This page was automatically generated by Maven