1 13 14 30 31 package com.icl.saxon.aelfred; 32 33 import java.io.InputStreamReader ; 34 import java.io.IOException ; 35 import java.io.Reader ; 36 import java.util.Enumeration ; 37 import java.util.Hashtable ; 38 import java.util.Locale ; 39 import java.util.Stack ; 40 import java.util.Vector ; 41 import java.net.URL ; 42 import java.net.MalformedURLException ; 43 44 import org.xml.sax.*; 45 import org.xml.sax.ext.*; 46 import org.xml.sax.helpers.NamespaceSupport ; 47 48 import com.icl.saxon.aelfred.DefaultHandler; 50 51 52 54 116 public class SAXDriver 117 implements Locator, Attributes, XMLReader, Parser, AttributeList 118 { 119 private final DefaultHandler base = new DefaultHandler (); 120 private XmlParser parser; 121 122 private EntityResolver entityResolver = base; 123 private ContentHandler contentHandler = base; 124 private DTDHandler dtdHandler = base; 125 private ErrorHandler errorHandler = base; 126 private DeclHandler declHandler = base; 127 private LexicalHandler lexicalHandler = base; 128 129 private String elementName = null; 130 private Stack entityStack = new Stack (); 131 132 private Vector attributeNames = new Vector (); 133 private Vector attributeNamespaces = new Vector (); 134 private Vector attributeLocalNames = new Vector (); 135 private Vector attributeValues = new Vector (); 136 137 private boolean namespaces = true; 138 private boolean xmlNames = false; 139 private boolean nspending = false; 142 private int attributeCount = 0; 143 private String nsTemp [] = new String [3]; 144 private NamespaceSupport prefixStack = new NamespaceSupport (); 145 146 private Hashtable features; 147 private Hashtable properties; 148 149 150 154 155 public SAXDriver () {} 156 157 158 162 167 public void setLocale (Locale locale) 168 throws SAXException 169 { 170 if ("en".equals (locale.getLanguage ())) 171 return ; 172 173 throw new SAXException ("AElfred only supports English locales."); 174 } 175 176 177 181 public EntityResolver getEntityResolver () 182 { 183 return entityResolver; 184 } 185 186 190 public void setEntityResolver (EntityResolver resolver) 191 { 192 if (resolver == null) 193 resolver = base; 194 this.entityResolver = resolver; 195 } 196 197 198 202 public DTDHandler getDTDHandler () 203 { 204 return dtdHandler; 205 } 206 207 211 public void setDTDHandler (DTDHandler handler) 212 { 213 if (handler == null) 214 handler = base; 215 this.dtdHandler = handler; 216 } 217 218 219 231 public void setDocumentHandler (DocumentHandler handler) 232 { 233 contentHandler = new Adapter (handler); 234 xmlNames = true; 235 } 236 237 241 public ContentHandler getContentHandler () 242 { 243 return contentHandler; 244 } 245 246 252 public void setContentHandler (ContentHandler handler) 253 { 254 if (handler == null) 255 handler = base; 256 contentHandler = handler; 257 } 258 259 263 public void setErrorHandler (ErrorHandler handler) 264 { 265 if (handler == null) 266 handler = base; 267 this.errorHandler = handler; 268 } 269 270 274 public ErrorHandler getErrorHandler () 275 { 276 return errorHandler; 277 } 278 279 280 296 297 public void parse (InputSource source) throws SAXException, IOException 298 { 299 synchronized (base) { 300 parser = new XmlParser (); 301 parser.setHandler (this); 302 303 try { 304 String systemId = source.getSystemId (); 305 309 systemId = tryToExpand(systemId); 310 311 315 if (systemId != null) 316 entityStack.push (systemId); 317 else entityStack.push ("illegal:unknown system ID"); 319 320 parser.doParse (systemId, 321 source.getPublicId (), 322 source.getCharacterStream (), 323 source.getByteStream (), 324 source.getEncoding ()); 325 } catch (SAXException e) { 326 throw e; 327 } catch (IOException e) { 328 throw e; 329 } catch (RuntimeException e) { 330 throw e; 331 } catch (Exception e) { 332 throw new SAXException (e.getMessage (), e); 333 } finally { 334 contentHandler.endDocument (); 335 entityStack.removeAllElements (); 336 } 337 } 338 } 339 340 341 345 346 public void parse (String systemId) throws SAXException, IOException 347 { 348 parse (new InputSource (systemId)); 349 } 350 351 static final String FEATURE = "http://xml.org/sax/features/"; 355 static final String HANDLER = "http://xml.org/sax/properties/"; 356 357 363 public boolean getFeature (String featureId) 364 throws SAXNotRecognizedException 365 { 366 if ((FEATURE + "validation").equals (featureId)) 367 return false; 368 369 if ((FEATURE + "external-general-entities").equals (featureId) 371 || (FEATURE + "external-parameter-entities") 372 .equals (featureId)) 373 return true; 374 375 if ((FEATURE + "namespace-prefixes").equals (featureId)) 377 return xmlNames; 378 379 if ((FEATURE + "namespaces").equals (featureId)) 381 return namespaces; 382 383 385 if ((FEATURE + "string-interning").equals (featureId)) 387 return true; 388 389 if (features != null && features.containsKey (featureId)) 390 return ((Boolean )features.get (featureId)).booleanValue (); 391 392 throw new SAXNotRecognizedException (featureId); 393 } 394 395 401 public Object getProperty (String propertyId) 402 throws SAXNotRecognizedException 403 { 404 if ((HANDLER + "declaration-handler").equals (propertyId)) 405 return declHandler; 406 407 if ((HANDLER + "lexical-handler").equals (propertyId)) 408 return lexicalHandler; 409 410 if (properties != null && properties.containsKey (propertyId)) 411 return properties.get (propertyId); 412 413 throw new SAXNotRecognizedException (propertyId); 415 } 416 417 422 public void setFeature (String featureId, boolean state) 423 throws SAXNotRecognizedException, SAXNotSupportedException 424 { 425 boolean value; 426 427 try { 428 value = getFeature (featureId); 430 431 if (state == value) 432 return; 433 434 if ((FEATURE + "namespace-prefixes").equals (featureId)) { 435 xmlNames = state; 437 return; 438 } 439 440 if ((FEATURE + "namespaces").equals (featureId)) { 441 if (true) { 443 namespaces = state; 444 return; 445 } 446 } 448 449 if (features == null || !features.containsKey (featureId)) 451 throw new SAXNotSupportedException (featureId); 452 453 } catch (SAXNotRecognizedException e) { 454 if (features == null) 456 features = new Hashtable (5); 457 } 458 459 features.put (featureId, 461 state 462 ? Boolean.TRUE 463 : Boolean.FALSE); 464 } 465 466 470 public void setProperty (String propertyId, Object property) 471 throws SAXNotRecognizedException, SAXNotSupportedException 472 { 473 Object value; 474 475 try { 476 value = getProperty (propertyId); 478 479 if ((HANDLER + "declaration-handler").equals (propertyId)) { 480 if (property == null) 481 declHandler = base; 482 else if (! (property instanceof DeclHandler)) 483 throw new SAXNotSupportedException (propertyId); 484 else 485 declHandler = (DeclHandler) property; 486 return ; 487 } 488 489 if ((HANDLER + "lexical-handler").equals (propertyId) || 490 "http://xml.org/sax/handlers/LexicalHandler".equals(propertyId)) { 491 if (property == null) 493 lexicalHandler = base; 494 else if (! (property instanceof LexicalHandler)) 495 throw new SAXNotSupportedException (propertyId); 496 else 497 lexicalHandler = (LexicalHandler) property; 498 return ; 499 } 500 501 if (properties == null || !properties.containsKey (propertyId)) 503 throw new SAXNotSupportedException (propertyId); 504 505 } catch (SAXNotRecognizedException e) { 506 if (properties == null) 508 properties = new Hashtable (5); 509 } 510 511 properties.put (propertyId, property); 513 } 514 515 516 522 526 void startDocument () throws SAXException 527 { 528 contentHandler.setDocumentLocator (this); 529 contentHandler.startDocument (); 530 attributeNames.removeAllElements (); 531 attributeValues.removeAllElements (); 532 } 533 534 void endDocument () throws SAXException 535 { 536 } 539 540 Object resolveEntity (String publicId, String systemId) 541 throws SAXException, IOException 542 { 543 InputSource source = entityResolver.resolveEntity (publicId, 544 systemId); 545 546 if (source == null) { 547 return null; 548 } else if (source.getCharacterStream () != null) { 549 return source.getCharacterStream (); 550 } else if (source.getByteStream () != null) { 551 if (source.getEncoding () == null) 552 return source.getByteStream (); 553 else try { 554 return new InputStreamReader ( 555 source.getByteStream (), 556 source.getEncoding () 557 ); 558 } catch (IOException e) { 559 return source.getByteStream (); 560 } 561 } else { 562 String sysId = source.getSystemId (); 563 return tryToExpand(sysId); } 565 } 569 570 574 private String tryToExpand(String systemId) { 575 if (systemId==null) { 576 systemId = ""; 577 } 578 try { 579 URL u = new URL (systemId); 580 return systemId; } catch (MalformedURLException err) { 582 String dir = System.getProperty("user.dir"); 583 if (dir.startsWith("/")) { 584 dir = "file://" + dir; 585 } else { 586 dir = "file:///" + dir; 587 } 588 if (!(dir.endsWith("/") || systemId.startsWith("/"))) { 589 dir = dir + "/"; 590 } 591 String file = dir + systemId; 592 try { 593 URL u2 = new URL (file); 594 return file; } catch (MalformedURLException err2) { 597 return systemId; 599 } 600 } 601 } 602 603 void startExternalEntity (String systemId) 604 throws SAXException 605 { 606 entityStack.push (systemId); 607 } 608 609 void endExternalEntity (String systemId) 610 throws SAXException 611 { 612 entityStack.pop (); 613 } 614 615 void doctypeDecl (String name, String publicId, String systemId) 616 throws SAXException 617 { 618 lexicalHandler.startDTD (name, publicId, systemId); 619 620 623 } 627 628 void endDoctype () throws SAXException 629 { 630 635 deliverDTDEvents (); 636 lexicalHandler.endDTD (); 637 } 638 639 640 void attribute (String aname, String value, boolean isSpecified) 641 throws SAXException 642 { 643 649 if (attributeCount++ == 0) { 650 if (namespaces) { 651 prefixStack.pushContext (); 652 } 653 } 654 655 if (value == null) { 658 return; 662 } 663 664 if (namespaces && aname.startsWith("xmlns")) { 665 if (aname.length() == 5) { 666 prefixStack.declarePrefix ("", value); 667 contentHandler.startPrefixMapping ("", value); 669 670 } else if (aname.charAt(5)==':' && !aname.equals("xmlns:xml")) { 671 672 if (aname.length() == 6) { 673 errorHandler.error (new SAXParseException ( 674 "Missing namespace prefix in namespace declaration: " + aname, 675 this)); 676 return; 677 } 678 String prefix = aname.substring (6); 679 if (value.length() == 0) { 680 errorHandler.error (new SAXParseException ( 681 "Missing URI in namespace declaration: " + aname, 682 this)); 683 return; 684 } 685 prefixStack.declarePrefix (prefix, value); 686 contentHandler.startPrefixMapping (prefix, value); 688 } 689 690 if (!xmlNames) { 691 return; 694 } 695 } 696 697 attributeNames.addElement (aname); 698 attributeValues.addElement (value); 699 } 700 701 void startElement (String elname) 702 throws SAXException 703 { 704 ContentHandler handler = contentHandler; 705 706 if (attributeCount == 0) 707 prefixStack.pushContext (); 708 709 elementName = elname; 711 if (namespaces) { 712 713 if (attributeCount > 0) { 715 for (int i=0; i<attributeNames.size(); i++) { 716 String aname = (String )attributeNames.elementAt(i); 717 if (aname.indexOf(':')>0) { 718 if (xmlNames && aname.startsWith("xmlns:")) { 719 attributeNamespaces.addElement(""); 720 attributeLocalNames.addElement(aname); 721 722 } else if (prefixStack.processName (aname, nsTemp, true) == null) { 723 errorHandler.error (new SAXParseException ( 724 "undeclared name prefix in: " + aname, 725 this)); 726 attributeNamespaces.addElement(""); 728 attributeLocalNames.addElement(aname.substring(aname.indexOf(':'))); 729 } else { 730 attributeNamespaces.addElement(nsTemp[0]); 731 attributeLocalNames.addElement(nsTemp[1]); 732 } 733 } else { 734 attributeNamespaces.addElement(""); 735 attributeLocalNames.addElement(aname); 736 } 737 for (int j=0; j<i; j++) { 739 if (attributeNamespaces.elementAt(i) == attributeNamespaces.elementAt(j) && 740 attributeLocalNames.elementAt(i) == attributeLocalNames.elementAt(j)) { 741 errorHandler.error( new SAXParseException ( 742 "duplicate attribute name: " + attributeLocalNames.elementAt(j), 743 this)); 744 } 745 } 746 } 747 } 748 749 if (prefixStack.processName (elname, nsTemp, false) == null) { 750 errorHandler.error (new SAXParseException ( 751 "undeclared name prefix in: " + elname, 752 this)); 753 nsTemp [0] = nsTemp [1] = ""; 754 elname = elname.substring(elname.indexOf(':')); 756 } 757 handler.startElement (nsTemp [0], nsTemp [1], elname, this); 758 } else 759 handler.startElement ("", "", elname, this); 760 762 if (attributeCount != 0) { 764 attributeNames.removeAllElements (); 765 attributeNamespaces.removeAllElements (); 766 attributeLocalNames.removeAllElements (); 767 attributeValues.removeAllElements (); 768 attributeCount = 0; 769 } 770 nspending = false; 771 } 772 773 void endElement (String elname) 774 throws SAXException 775 { 776 ContentHandler handler = contentHandler; 777 778 if (!namespaces) { 779 handler.endElement("", "", elname); 780 return; 781 } 782 783 if (prefixStack.processName (elname, nsTemp, false) == null) { 785 errorHandler.error (new SAXParseException ( 787 "undeclared name prefix in: " + elname, this)); 788 nsTemp [0] = nsTemp [1] = ""; 789 elname = elname.substring(elname.indexOf(':')); 790 } 791 792 handler.endElement (nsTemp[0], nsTemp[1], elname); 793 794 796 798 799 Enumeration prefixes = prefixStack.getDeclaredPrefixes (); 800 801 while (prefixes.hasMoreElements ()) 802 handler.endPrefixMapping ((String ) prefixes.nextElement ()); 803 prefixStack.popContext (); 804 } 805 806 void startCDATA () 807 throws SAXException 808 { 809 lexicalHandler.startCDATA (); 810 } 811 812 void charData (char ch[], int start, int length) 813 throws SAXException 814 { 815 contentHandler.characters (ch, start, length); 816 } 817 818 void endCDATA () 819 throws SAXException 820 { 821 lexicalHandler.endCDATA (); 822 } 823 824 void ignorableWhitespace (char ch[], int start, int length) 825 throws SAXException 826 { 827 contentHandler.ignorableWhitespace (ch, start, length); 828 } 829 830 void processingInstruction (String target, String data) 831 throws SAXException 832 { 833 837 contentHandler.processingInstruction (target, data); 838 } 839 840 void comment (char ch[], int start, int length) 841 throws SAXException 842 { 843 847 if (lexicalHandler != base) 848 lexicalHandler.comment (ch, start, length); 849 } 850 851 void error (String message, String url, int line, int column) 853 throws SAXException 854 { 855 SAXParseException fatal; 856 857 fatal = new SAXParseException (message, null, url, line, column); 858 errorHandler.fatalError (fatal); 859 860 throw fatal; 862 } 863 864 865 private void deliverDTDEvents () 869 throws SAXException 870 { 871 String ename; 872 String nname; 873 String publicId; 874 String systemId; 875 876 if (dtdHandler != base) { 878 Enumeration notationNames = parser.declaredNotations (); 879 880 while (notationNames.hasMoreElements ()) { 881 nname = (String ) notationNames.nextElement (); 882 publicId = parser.getNotationPublicId (nname); 883 systemId = parser.getNotationSystemId (nname); 884 dtdHandler.notationDecl (nname, publicId, systemId); 885 } 886 } 887 888 if (dtdHandler != base || declHandler != base) { 890 Enumeration entityNames = parser.declaredEntities (); 891 int type; 892 893 while (entityNames.hasMoreElements ()) { 894 ename = (String ) entityNames.nextElement (); 895 type = parser.getEntityType (ename); 896 897 if (ename.charAt (0) == '%') 898 continue; 899 900 if (type == XmlParser.ENTITY_NDATA) { 902 publicId = parser.getEntityPublicId (ename); 903 systemId = parser.getEntitySystemId (ename); 904 nname = parser.getEntityNotationName (ename); 905 dtdHandler.unparsedEntityDecl (ename, 906 publicId, systemId, nname); 907 908 } 910 else if (type == XmlParser.ENTITY_TEXT) { 911 publicId = parser.getEntityPublicId (ename); 912 systemId = parser.getEntitySystemId (ename); 913 declHandler.externalEntityDecl (ename, 914 publicId, systemId); 915 916 } 918 else if (type == XmlParser.ENTITY_INTERNAL) { 919 if ("lt".equals (ename) || "gt".equals (ename) 922 || "quot".equals (ename) 923 || "apos".equals (ename) 924 || "amp".equals (ename)) 925 continue; 926 declHandler.internalEntityDecl (ename, 927 parser.getEntityValue (ename)); 928 } 929 } 930 } 931 932 if (declHandler != base) { 934 Enumeration elementNames = parser.declaredElements (); 935 Enumeration attNames; 936 937 while (elementNames.hasMoreElements ()) { 938 String model = null; 939 940 ename = (String ) elementNames.nextElement (); 941 switch (parser.getElementContentType (ename)) { 942 case XmlParser.CONTENT_ANY: 943 model = "ANY"; 944 break; 945 case XmlParser.CONTENT_EMPTY: 946 model = "EMPTY"; 947 break; 948 case XmlParser.CONTENT_MIXED: 949 case XmlParser.CONTENT_ELEMENTS: 950 model = parser.getElementContentModel (ename); 951 break; 952 case XmlParser.CONTENT_UNDECLARED: 953 default: 954 model = null; 955 break; 956 } 957 if (model != null) 958 declHandler.elementDecl (ename, model); 959 960 attNames = parser.declaredAttributes (ename); 961 while (attNames != null && attNames.hasMoreElements ()) { 962 String aname = (String ) attNames.nextElement (); 963 String type; 964 String valueDefault; 965 String value; 966 967 switch (parser.getAttributeType (ename, aname)) { 968 case XmlParser.ATTRIBUTE_CDATA: 969 type = "CDATA"; 970 break; 971 case XmlParser.ATTRIBUTE_ENTITY: 972 type = "ENTITY"; 973 break; 974 case XmlParser.ATTRIBUTE_ENTITIES: 975 type = "ENTITIES"; 976 break; 977 case XmlParser.ATTRIBUTE_ENUMERATED: 978 type = parser.getAttributeEnumeration (ename, aname); 979 break; 980 case XmlParser.ATTRIBUTE_ID: 981 type = "ID"; 982 break; 983 case XmlParser.ATTRIBUTE_IDREF: 984 type = "IDREF"; 985 break; 986 case XmlParser.ATTRIBUTE_IDREFS: 987 type = "IDREFS"; 988 break; 989 case XmlParser.ATTRIBUTE_NMTOKEN: 990 type = "NMTOKEN"; 991 break; 992 case XmlParser.ATTRIBUTE_NMTOKENS: 993 type = "NMTOKENS"; 994 break; 995 996 case XmlParser.ATTRIBUTE_NOTATION: 1001 type = "NOTATION"; 1002 break; 1003 1004 default: 1005 errorHandler.fatalError (new SAXParseException ( 1006 "internal error, att type", this)); 1007 type = null; 1008 } 1009 1010 switch (parser.getAttributeDefaultValueType ( 1011 ename, aname)) { 1012 case XmlParser.ATTRIBUTE_DEFAULT_IMPLIED: 1013 valueDefault = "#IMPLIED"; 1014 break; 1015 case XmlParser.ATTRIBUTE_DEFAULT_REQUIRED: 1016 valueDefault = "#REQUIRED"; 1017 break; 1018 case XmlParser.ATTRIBUTE_DEFAULT_FIXED: 1019 valueDefault = "#FIXED"; 1020 break; 1021 case XmlParser.ATTRIBUTE_DEFAULT_SPECIFIED: 1022 valueDefault = null; 1023 break; 1024 1025 default: 1026 errorHandler.fatalError (new SAXParseException ( 1027 "internal error, att default", this)); 1028 valueDefault = null; 1029 } 1030 1031 value = parser.getAttributeDefaultValue (ename, aname); 1032 1033 declHandler.attributeDecl (ename, aname, 1034 type, valueDefault, value); 1035 } 1036 } 1037 } 1038 } 1039 1040 1041 1045 1049 public int getLength () 1050 { 1051 return attributeNames.size (); 1052 } 1053 1054 1057 public String getURI (int index) 1058 { 1059 return (String ) (attributeNamespaces.elementAt (index)); 1060 } 1061 1062 1065 public String getLocalName (int index) 1066 { 1067 return (String ) (attributeLocalNames.elementAt (index)); 1068 } 1069 1070 1073 public String getQName (int i) 1074 { 1075 return (String ) (attributeNames.elementAt (i)); 1076 } 1077 1078 1081 public String getName (int i) 1082 { 1083 return (String ) (attributeNames.elementAt (i)); 1084 } 1085 1086 1090 public String getType (int i) 1091 { 1092 switch (parser.getAttributeType (elementName, getQName (i))) { 1093 1094 case XmlParser.ATTRIBUTE_UNDECLARED: 1095 case XmlParser.ATTRIBUTE_CDATA: 1096 return "CDATA"; 1097 case XmlParser.ATTRIBUTE_ID: 1098 return "ID"; 1099 case XmlParser.ATTRIBUTE_IDREF: 1100 return "IDREF"; 1101 case XmlParser.ATTRIBUTE_IDREFS: 1102 return "IDREFS"; 1103 case XmlParser.ATTRIBUTE_ENTITY: 1104 return "ENTITY"; 1105 case XmlParser.ATTRIBUTE_ENTITIES: 1106 return "ENTITIES"; 1107 case XmlParser.ATTRIBUTE_ENUMERATED: 1108 case XmlParser.ATTRIBUTE_NMTOKEN: 1111 return "NMTOKEN"; 1112 case XmlParser.ATTRIBUTE_NMTOKENS: 1113 return "NMTOKENS"; 1114 case XmlParser.ATTRIBUTE_NOTATION: 1115 return "NOTATION"; 1118 1119 } 1120 1121 return null; 1122 } 1123 1124 1125 1129 public String getValue (int i) 1130 { 1131 return (String ) (attributeValues.elementAt (i)); 1132 } 1133 1134 1135 1138 public int getIndex (String uri, String local) 1139 { 1140 int length = getLength (); 1141 1142 for (int i = 0; i < length; i++) { 1143 if (!getURI (i).equals (uri)) 1144 continue; 1145 if (getLocalName (i).equals (local)) 1146 return i; 1147 } 1148 return -1; 1149 } 1150 1151 1152 1155 public int getIndex (String xmlName) 1156 { 1157 int length = getLength (); 1158 1159 for (int i = 0; i < length; i++) { 1160 if (getQName (i).equals (xmlName)) 1161 return i; 1162 } 1163 return -1; 1164 } 1165 1166 1167 1170 public String getType (String uri, String local) 1171 { 1172 int index = getIndex (uri, local); 1173 1174 if (index < 0) 1175 return null; 1176 return getType (index); 1177 } 1178 1179 1180 1184 public String getType (String xmlName) 1185 { 1186 int index = getIndex (xmlName); 1187 1188 if (index < 0) 1189 return null; 1190 return getType (index); 1191 } 1192 1193 1194 1197 public String getValue (String uri, String local) 1198 { 1199 int index = getIndex (uri, local); 1200 1201 if (index < 0) 1202 return null; 1203 return getValue (index); 1204 } 1205 1206 1207 1211 public String getValue (String xmlName) 1212 { 1213 int index = getIndex (xmlName); 1214 1215 if (index < 0) 1216 return null; 1217 return getValue (index); 1218 } 1219 1220 1221 1225 1228 public String getPublicId () 1229 { 1230 return null; } 1232 1233 1236 public String getSystemId () 1237 { 1238 return (String ) entityStack.peek (); 1239 } 1240 1241 1244 public int getLineNumber () 1245 { 1246 return parser.getLineNumber (); 1247 } 1248 1249 1252 public int getColumnNumber () 1253 { 1254 return parser.getColumnNumber (); 1255 } 1256 1257 1259 private static class Adapter implements ContentHandler 1260 { 1261 private DocumentHandler docHandler; 1262 1263 Adapter (DocumentHandler dh) 1264 { docHandler = dh; } 1265 1266 1267 public void setDocumentLocator (Locator l) 1268 { docHandler.setDocumentLocator (l); } 1269 1270 public void startDocument () throws SAXException 1271 { docHandler.startDocument (); } 1272 1273 public void processingInstruction (String target, String data) 1274 throws SAXException 1275 { docHandler.processingInstruction (target, data); } 1276 1277 public void startPrefixMapping (String prefix, String uri) 1278 { } 1279 1280 public void startElement ( 1281 String namespace, 1282 String local, 1283 String name, 1284 Attributes attrs ) throws SAXException 1285 { 1286 docHandler.startElement (name, (AttributeList) attrs); 1287 } 1288 1289 public void characters (char buf [], int offset, int len) 1290 throws SAXException 1291 { 1292 docHandler.characters (buf, offset, len); 1293 } 1294 1295 public void ignorableWhitespace (char buf [], int offset, int len) 1296 throws SAXException 1297 { 1298 docHandler.ignorableWhitespace (buf, offset, len); 1299 } 1300 1301 public void skippedEntity (String name) 1302 { } 1303 1304 public void endElement (String u, String l, String name) 1305 throws SAXException 1306 { docHandler.endElement (name); } 1307 1308 public void endPrefixMapping (String prefix) 1309 { } 1310 1311 public void endDocument () throws SAXException 1312 { docHandler.endDocument (); } 1313 } 1314} 1315 | Popular Tags |