1 16 package org.apache.xerces.xpointer; 17 18 import java.util.Hashtable ; 19 import java.util.Vector ; 20 21 import org.apache.xerces.impl.Constants; 22 import org.apache.xerces.impl.XMLErrorReporter; 23 import org.apache.xerces.util.SymbolTable; 24 import org.apache.xerces.util.XMLChar; 25 import org.apache.xerces.util.XMLSymbols; 26 import org.apache.xerces.xinclude.XIncludeHandler; 27 import org.apache.xerces.xinclude.XIncludeNamespaceSupport; 28 import org.apache.xerces.xni.Augmentations; 29 import org.apache.xerces.xni.QName; 30 import org.apache.xerces.xni.XMLAttributes; 31 import org.apache.xerces.xni.XMLString; 32 import org.apache.xerces.xni.XNIException; 33 import org.apache.xerces.xni.parser.XMLConfigurationException; 34 import org.apache.xerces.xni.parser.XMLErrorHandler; 35 36 60 public final class XPointerHandler extends XIncludeHandler implements 61 XPointerProcessor { 62 63 protected Vector fXPointerParts = null; 66 67 protected XPointerPart fXPointerPart = null; 69 70 protected boolean fFoundMatchingPtrPart = false; 72 73 protected XMLErrorReporter fXPointerErrorReporter; 75 76 protected XMLErrorHandler fErrorHandler; 78 79 protected SymbolTable fSymbolTable = null; 81 82 private final String ELEMENT_SCHEME_NAME = "element"; 84 85 protected boolean fIsXPointerResolved = false; 87 88 protected boolean fFixupBase = false; 90 protected boolean fFixupLang = false; 91 92 96 99 public XPointerHandler() { 100 super(); 101 102 fXPointerParts = new Vector (); 103 fSymbolTable = new SymbolTable(); 104 } 105 106 public XPointerHandler(SymbolTable symbolTable, 107 XMLErrorHandler errorHandler, XMLErrorReporter errorReporter) { 108 super(); 109 110 fXPointerParts = new Vector (); 111 fSymbolTable = symbolTable; 112 fErrorHandler = errorHandler; 113 fXPointerErrorReporter = errorReporter; 114 } 116 117 121 126 public void parseXPointer(String xpointer) throws XNIException { 127 128 init(); 130 131 final Tokens tokens = new Tokens(fSymbolTable); 133 134 Scanner scanner = new Scanner(fSymbolTable) { 136 protected void addToken(Tokens tokens, int token) 137 throws XNIException { 138 if (token == Tokens.XPTRTOKEN_OPEN_PAREN 139 || token == Tokens.XPTRTOKEN_CLOSE_PAREN 140 || token == Tokens.XPTRTOKEN_SCHEMENAME 141 || token == Tokens.XPTRTOKEN_SCHEMEDATA 142 || token == Tokens.XPTRTOKEN_SHORTHAND) { 143 super.addToken(tokens, token); 144 return; 145 } 146 reportError("InvalidXPointerToken", new Object [] { tokens 147 .getTokenString(token) }); 148 } 149 }; 150 151 int length = xpointer.length(); 153 boolean success = scanner.scanExpr(fSymbolTable, tokens, xpointer, 0, 154 length); 155 156 if (!success) 157 reportError("InvalidXPointerExpression", new Object [] { xpointer }); 158 159 while (tokens.hasMore()) { 160 int token = tokens.nextToken(); 161 162 switch (token) { 163 case Tokens.XPTRTOKEN_SHORTHAND: { 164 165 token = tokens.nextToken(); 167 String shortHandPointerName = tokens.getTokenString(token); 168 169 if (shortHandPointerName == null) { 170 reportError("InvalidXPointerExpression", 171 new Object [] { xpointer }); 172 } 173 174 XPointerPart shortHandPointer = new ShortHandPointer( 175 fSymbolTable); 176 shortHandPointer.setSchemeName(shortHandPointerName); 177 fXPointerParts.add(shortHandPointer); 178 break; 179 } 180 case Tokens.XPTRTOKEN_SCHEMENAME: { 181 182 token = tokens.nextToken(); 184 String prefix = tokens.getTokenString(token); 185 token = tokens.nextToken(); 186 String localName = tokens.getTokenString(token); 187 188 String schemeName = prefix + localName; 189 190 int openParenCount = 0; 192 int closeParenCount = 0; 193 194 token = tokens.nextToken(); 195 String openParen = tokens.getTokenString(token); 196 if (openParen != "XPTRTOKEN_OPEN_PAREN") { 197 198 if (token == Tokens.XPTRTOKEN_SHORTHAND) { 200 reportError("MultipleShortHandPointers", 201 new Object [] { xpointer }); 202 } else { 203 reportError("InvalidXPointerExpression", 204 new Object [] { xpointer }); 205 } 206 } 207 openParenCount++; 208 209 String schemeData = null; 211 while (tokens.hasMore()) { 212 token = tokens.nextToken(); 213 schemeData = tokens.getTokenString(token); 214 if (schemeData != "XPTRTOKEN_OPEN_PAREN") { 215 break; 216 } 217 openParenCount++; 218 } 219 token = tokens.nextToken(); 220 schemeData = tokens.getTokenString(token); 221 222 token = tokens.nextToken(); 224 String closeParen = tokens.getTokenString(token); 225 if (closeParen != "XPTRTOKEN_CLOSE_PAREN") { 226 reportError("SchemeDataNotFollowedByCloseParenthesis", 227 new Object [] { xpointer }); 228 } 229 closeParenCount++; 230 231 while (tokens.hasMore()) { 232 if (tokens.getTokenString(tokens.peekToken()) != "XPTRTOKEN_OPEN_PAREN") { 233 break; 234 } 235 closeParenCount++; 236 } 237 238 if (openParenCount != closeParenCount) { 240 reportError("UnbalancedParenthesisInXPointerExpression", 241 new Object [] { xpointer, 242 new Integer (openParenCount), 243 new Integer (closeParenCount) }); 244 } 245 246 if (schemeName.equals(ELEMENT_SCHEME_NAME)) { 248 XPointerPart elementSchemePointer = new ElementSchemePointer( 249 fSymbolTable, fErrorReporter); 250 elementSchemePointer.setSchemeName(schemeName); 251 elementSchemePointer.setSchemeData(schemeData); 252 253 try { 256 elementSchemePointer.parseXPointer(schemeData); 257 fXPointerParts.add(elementSchemePointer); 258 } catch (XNIException e) { 259 throw new XNIException (e); 261 } 262 263 } else { 264 reportWarning("SchemeUnsupported", 266 new Object [] { schemeName }); 267 } 268 269 break; 270 } 271 default: 272 reportError("InvalidXPointerExpression", 273 new Object [] { xpointer }); 274 } 275 } 276 277 } 278 279 283 public boolean resolveXPointer(QName element, XMLAttributes attributes, 284 Augmentations augs, int event) throws XNIException { 285 boolean resolved = false; 286 287 if (!fFoundMatchingPtrPart) { 295 296 for (int i = 0; i < fXPointerParts.size(); i++) { 299 300 fXPointerPart = (XPointerPart) fXPointerParts.get(i); 301 302 if (fXPointerPart.resolveXPointer(element, attributes, augs, 303 event)) { 304 fFoundMatchingPtrPart = true; 305 resolved = true; 306 } 307 } 308 } else { 309 if (fXPointerPart.resolveXPointer(element, attributes, augs, event)) { 310 resolved = true; 311 } 312 } 313 314 if (!fIsXPointerResolved) { 315 fIsXPointerResolved = resolved; 316 } 317 318 return resolved; 319 } 320 321 326 public boolean isFragmentResolved() throws XNIException { 327 boolean resolved = (fXPointerPart != null) ? fXPointerPart.isFragmentResolved() 328 : false; 329 330 if (!fIsXPointerResolved) { 331 fIsXPointerResolved = resolved; 332 } 333 334 return resolved; 335 } 336 337 344 public boolean isChildFragmentResolved() throws XNIException { 345 boolean resolved = (fXPointerPart != null) ? fXPointerPart 346 .isChildFragmentResolved() : false; 347 return resolved; 348 } 349 350 355 public boolean isXPointerResolved() throws XNIException { 356 return fIsXPointerResolved; 357 } 358 359 364 public XPointerPart getXPointerPart() { 365 return fXPointerPart; 366 } 367 368 372 private void reportError(String key, Object [] arguments) 373 throws XNIException { 374 379 throw new XNIException((fErrorReporter 380 .getMessageFormatter(XPointerMessageFormatter.XPOINTER_DOMAIN)) 381 .formatMessage(fErrorReporter.getLocale(), key, arguments)); 382 } 383 384 388 private void reportWarning(String key, Object [] arguments) 389 throws XNIException { 390 fXPointerErrorReporter.reportError( 391 XPointerMessageFormatter.XPOINTER_DOMAIN, key, arguments, 392 XMLErrorReporter.SEVERITY_WARNING); 393 } 394 395 399 protected void initErrorReporter() { 400 if (fXPointerErrorReporter == null) { 401 fXPointerErrorReporter = new XMLErrorReporter(); 402 } 403 if (fErrorHandler == null) { 404 fErrorHandler = new XPointerErrorHandler(); 405 } 406 410 fXPointerErrorReporter.putMessageFormatter( 411 XPointerMessageFormatter.XPOINTER_DOMAIN, 412 new XPointerMessageFormatter()); 413 } 414 415 418 protected void init() { 419 fXPointerParts.clear(); 420 fXPointerPart = null; 421 fFoundMatchingPtrPart = false; 422 fIsXPointerResolved = false; 423 426 initErrorReporter(); 427 } 428 429 434 public Vector getPointerParts() { 435 return fXPointerParts; 436 } 437 438 444 private final class Tokens { 445 446 459 private static final int XPTRTOKEN_OPEN_PAREN = 0, 460 XPTRTOKEN_CLOSE_PAREN = 1, XPTRTOKEN_SHORTHAND = 2, 461 XPTRTOKEN_SCHEMENAME = 3, XPTRTOKEN_SCHEMEDATA = 4; 462 463 private final String [] fgTokenNames = { "XPTRTOKEN_OPEN_PAREN", 465 "XPTRTOKEN_CLOSE_PAREN", "XPTRTOKEN_SHORTHAND", 466 "XPTRTOKEN_SCHEMENAME", "XPTRTOKEN_SCHEMEDATA" }; 467 468 private static final int INITIAL_TOKEN_COUNT = 1 << 8; 470 471 private int[] fTokens = new int[INITIAL_TOKEN_COUNT]; 472 473 private int fTokenCount = 0; 474 475 private int fCurrentTokenIndex; 477 478 private SymbolTable fSymbolTable; 479 480 private Hashtable fTokenNames = new Hashtable (); 481 482 487 private Tokens(SymbolTable symbolTable) { 488 fSymbolTable = symbolTable; 489 490 fTokenNames.put(new Integer (XPTRTOKEN_OPEN_PAREN), 491 "XPTRTOKEN_OPEN_PAREN"); 492 fTokenNames.put(new Integer (XPTRTOKEN_CLOSE_PAREN), 493 "XPTRTOKEN_CLOSE_PAREN"); 494 fTokenNames.put(new Integer (XPTRTOKEN_SHORTHAND), 495 "XPTRTOKEN_SHORTHAND"); 496 fTokenNames.put(new Integer (XPTRTOKEN_SCHEMENAME), 497 "XPTRTOKEN_SCHEMENAME"); 498 fTokenNames.put(new Integer (XPTRTOKEN_SCHEMEDATA), 499 "XPTRTOKEN_SCHEMEDATA"); 500 } 501 502 507 private String getTokenString(int token) { 508 return (String ) fTokenNames.get(new Integer (token)); 509 } 510 511 516 private void addToken(String tokenStr) { 517 Integer tokenInt = (Integer ) fTokenNames.get(tokenStr); 518 if (tokenInt == null) { 519 tokenInt = new Integer (fTokenNames.size()); 520 fTokenNames.put(tokenInt, tokenStr); 521 } 522 addToken(tokenInt.intValue()); 523 } 524 525 530 private void addToken(int token) { 531 try { 532 fTokens[fTokenCount] = token; 533 } catch (ArrayIndexOutOfBoundsException ex) { 534 int[] oldList = fTokens; 535 fTokens = new int[fTokenCount << 1]; 536 System.arraycopy(oldList, 0, fTokens, 0, fTokenCount); 537 fTokens[fTokenCount] = token; 538 } 539 fTokenCount++; 540 } 541 542 545 private void rewind() { 546 fCurrentTokenIndex = 0; 547 } 548 549 553 private boolean hasMore() { 554 return fCurrentTokenIndex < fTokenCount; 555 } 556 557 564 private int nextToken() throws XNIException { 565 if (fCurrentTokenIndex == fTokenCount) { 566 reportError("XPointerProcessingError", null); 567 } 568 return fTokens[fCurrentTokenIndex++]; 569 } 570 571 578 private int peekToken() throws XNIException { 579 if (fCurrentTokenIndex == fTokenCount) { 580 reportError("XPointerProcessingError", null); 581 } 582 return fTokens[fCurrentTokenIndex]; 583 } 584 585 593 private String nextTokenAsString() throws XNIException { 594 String tokenStrint = getTokenString(nextToken()); 595 if (tokenStrint == null) { 596 reportError("XPointerProcessingError", null); 597 } 598 return tokenStrint; 599 } 600 } 601 602 609 private class Scanner { 610 611 624 private static final byte CHARTYPE_INVALID = 0, CHARTYPE_OTHER = 1, CHARTYPE_WHITESPACE = 2, CHARTYPE_CARRET = 3, CHARTYPE_OPEN_PAREN = 4, CHARTYPE_CLOSE_PAREN = 5, CHARTYPE_MINUS = 6, CHARTYPE_PERIOD = 7, CHARTYPE_SLASH = 8, CHARTYPE_DIGIT = 9, CHARTYPE_COLON = 10, CHARTYPE_EQUAL = 11, CHARTYPE_LETTER = 12, CHARTYPE_UNDERSCORE = 13, CHARTYPE_NONASCII = 14; 640 private final byte[] fASCIICharMap = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 641 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 642 2, 1, 1, 1, 1, 1, 1, 1, 4, 5, 1, 1, 1, 6, 7, 8, 9, 9, 9, 9, 9, 643 9, 9, 9, 9, 9, 10, 1, 1, 11, 1, 1, 1, 12, 12, 12, 12, 12, 12, 644 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 645 12, 12, 12, 12, 1, 1, 1, 3, 13, 1, 12, 12, 12, 12, 12, 12, 12, 646 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 647 12, 12, 12, 1, 1, 1, 1, 1 }; 648 649 653 private SymbolTable fSymbolTable; 654 655 660 private Scanner(SymbolTable symbolTable) { 661 fSymbolTable = symbolTable; 663 664 } 666 670 private boolean scanExpr(SymbolTable symbolTable, Tokens tokens, 671 String data, int currentOffset, int endOffset) 672 throws XNIException { 673 674 int ch; 675 int openParen = 0; 676 int closeParen = 0; 677 int nameOffset, dataOffset; 678 boolean isQName = false; 679 String name = null; 680 String prefix = null; 681 String schemeData = null; 682 StringBuffer schemeDataBuff = new StringBuffer (); 683 684 while (true) { 685 686 if (currentOffset == endOffset) { 687 break; 688 } 689 ch = data.charAt(currentOffset); 690 691 while (ch == ' ' || ch == 0x0A || ch == 0x09 || ch == 0x0D) { 693 if (++currentOffset == endOffset) { 694 break; 695 } 696 ch = data.charAt(currentOffset); 697 } 698 if (currentOffset == endOffset) { 699 break; 700 } 701 702 byte chartype = (ch >= 0x80) ? CHARTYPE_NONASCII 719 : fASCIICharMap[ch]; 720 721 switch (chartype) { 722 723 case CHARTYPE_OPEN_PAREN: addToken(tokens, Tokens.XPTRTOKEN_OPEN_PAREN); 725 openParen++; 726 ++currentOffset; 727 break; 728 729 case CHARTYPE_CLOSE_PAREN: addToken(tokens, Tokens.XPTRTOKEN_CLOSE_PAREN); 731 closeParen++; 732 ++currentOffset; 733 break; 734 735 case CHARTYPE_CARRET: 736 case CHARTYPE_COLON: 737 case CHARTYPE_DIGIT: 738 case CHARTYPE_EQUAL: 739 case CHARTYPE_LETTER: 740 case CHARTYPE_MINUS: 741 case CHARTYPE_NONASCII: 742 case CHARTYPE_OTHER: 743 case CHARTYPE_PERIOD: 744 case CHARTYPE_SLASH: 745 case CHARTYPE_UNDERSCORE: 746 case CHARTYPE_WHITESPACE: 747 if (openParen == 0) { 749 nameOffset = currentOffset; 750 currentOffset = scanNCName(data, endOffset, 751 currentOffset); 752 753 if (currentOffset == nameOffset) { 754 reportError("InvalidShortHandPointer", 755 new Object [] { data }); 756 return false; 757 } 758 759 if (currentOffset < endOffset) { 760 ch = data.charAt(currentOffset); 761 } else { 762 ch = -1; 763 } 764 765 name = symbolTable.addSymbol(data.substring(nameOffset, 766 currentOffset)); 767 prefix = XMLSymbols.EMPTY_STRING; 768 769 if (ch == ':') { 771 if (++currentOffset == endOffset) { 772 return false; 773 } 774 775 ch = data.charAt(currentOffset); 776 prefix = name; 777 nameOffset = currentOffset; 778 currentOffset = scanNCName(data, endOffset, 779 currentOffset); 780 781 if (currentOffset == nameOffset) { 782 return false; 783 } 784 785 if (currentOffset < endOffset) { 786 ch = data.charAt(currentOffset); 787 } else { 788 ch = -1; 789 } 790 791 isQName = true; 792 name = symbolTable.addSymbol(data.substring( 793 nameOffset, currentOffset)); 794 } 795 796 if (currentOffset != endOffset) { 798 addToken(tokens, Tokens.XPTRTOKEN_SCHEMENAME); 799 tokens.addToken(prefix); 800 tokens.addToken(name); 801 isQName = false; 802 } else if (currentOffset == endOffset) { 803 addToken(tokens, Tokens.XPTRTOKEN_SHORTHAND); 805 tokens.addToken(name); 806 isQName = false; 807 } 808 809 closeParen = 0; 811 812 break; 813 814 } else if (openParen > 0 && closeParen == 0 && name != null) { 815 dataOffset = currentOffset; 817 currentOffset = scanData(data, schemeDataBuff, 818 endOffset, currentOffset); 819 820 if (currentOffset == dataOffset) { 821 reportError("InvalidSchemeDataInXPointer", 822 new Object [] { data }); 823 return false; 824 } 825 826 if (currentOffset < endOffset) { 827 ch = data.charAt(currentOffset); 828 } else { 829 ch = -1; 830 } 831 832 schemeData = symbolTable.addSymbol(schemeDataBuff 833 .toString()); 834 addToken(tokens, Tokens.XPTRTOKEN_SCHEMEDATA); 835 tokens.addToken(schemeData); 836 837 openParen = 0; 839 schemeDataBuff.delete(0, schemeDataBuff.length()); 840 841 } else { 842 return false; 845 } 846 } 847 } return true; 849 } 850 851 861 private int scanNCName(String data, int endOffset, int currentOffset) { 862 int ch = data.charAt(currentOffset); 863 if (ch >= 0x80) { 864 if (!XMLChar.isNameStart(ch)) { 865 return currentOffset; 866 } 867 } else { 868 byte chartype = fASCIICharMap[ch]; 869 if (chartype != CHARTYPE_LETTER 870 && chartype != CHARTYPE_UNDERSCORE) { 871 return currentOffset; 872 } 873 } 874 875 while (++currentOffset < endOffset) { 877 ch = data.charAt(currentOffset); 878 if (ch >= 0x80) { 879 if (!XMLChar.isName(ch)) { 880 break; 881 } 882 } else { 883 byte chartype = fASCIICharMap[ch]; 884 if (chartype != CHARTYPE_LETTER 885 && chartype != CHARTYPE_DIGIT 886 && chartype != CHARTYPE_PERIOD 887 && chartype != CHARTYPE_MINUS 888 && chartype != CHARTYPE_UNDERSCORE) { 889 break; 890 } 891 } 892 } 893 return currentOffset; 894 } 895 896 904 private int scanData(String data, StringBuffer schemeData, 905 int endOffset, int currentOffset) { 906 while (true) { 907 908 if (currentOffset == endOffset) { 909 break; 910 } 911 912 int ch = data.charAt(currentOffset); 913 byte chartype = (ch >= 0x80) ? CHARTYPE_NONASCII 914 : fASCIICharMap[ch]; 915 916 if (chartype == CHARTYPE_OPEN_PAREN) { 917 schemeData.append(ch); 918 currentOffset = scanData(data, schemeData, endOffset, 920 ++currentOffset); 921 if (currentOffset == endOffset) { 922 return currentOffset; 923 } 924 925 ch = data.charAt(currentOffset); 926 chartype = (ch >= 0x80) ? CHARTYPE_NONASCII 927 : fASCIICharMap[ch]; 928 929 if (chartype != CHARTYPE_CLOSE_PAREN) { 930 return endOffset; 931 } 932 schemeData.append((char) ch); 933 ++currentOffset; 935 } else if (chartype == CHARTYPE_CLOSE_PAREN) { 936 return currentOffset; 937 938 } else if (chartype == CHARTYPE_CARRET) { 939 ch = data.charAt(++currentOffset); 940 chartype = (ch >= 0x80) ? CHARTYPE_NONASCII 941 : fASCIICharMap[ch]; 942 943 if (chartype != CHARTYPE_CARRET 944 && chartype != CHARTYPE_OPEN_PAREN 945 && chartype != CHARTYPE_CLOSE_PAREN) { 946 break; 947 } 948 schemeData.append((char) ch); 949 ++currentOffset; 950 951 } else { 952 schemeData.append((char) ch); 953 ++currentOffset; } 955 } 956 957 return currentOffset; 958 } 959 960 964 972 protected void addToken(Tokens tokens, int token) throws XNIException { 973 tokens.addToken(token); 974 } 976 } 978 990 public void comment(XMLString text, Augmentations augs) throws XNIException { 991 if (!isChildFragmentResolved()) { 992 return; 993 } 994 super.comment(text, augs); 995 } 996 997 1015 public void processingInstruction(String target, XMLString data, 1016 Augmentations augs) throws XNIException { 1017 if (!isChildFragmentResolved()) { 1018 return; 1019 } 1020 super.processingInstruction(target, data, augs); 1021 } 1022 1023 1033 public void startElement(QName element, XMLAttributes attributes, 1034 Augmentations augs) throws XNIException { 1035 if (!resolveXPointer(element, attributes, augs, 1036 XPointerPart.EVENT_ELEMENT_START)) { 1037 1038 if (fFixupBase) { 1040 processXMLBaseAttributes(attributes); 1041 } 1042 if (fFixupLang) { 1043 processXMLLangAttributes(attributes); 1044 } 1045 1046 fNamespaceContext.setContextInvalid(); 1048 1049 return; 1050 } 1051 super.startElement(element, attributes, augs); 1052 } 1053 1054 1064 public void emptyElement(QName element, XMLAttributes attributes, 1065 Augmentations augs) throws XNIException { 1066 if (!resolveXPointer(element, attributes, augs, 1067 XPointerPart.EVENT_ELEMENT_EMPTY)) { 1068 if (fFixupBase) { 1070 processXMLBaseAttributes(attributes); 1071 } 1072 if (fFixupLang) { 1073 processXMLLangAttributes(attributes); 1074 } 1075 1077 fNamespaceContext.setContextInvalid(); 1079 return; 1080 } 1081 super.emptyElement(element, attributes, augs); 1082 } 1083 1084 1093 public void characters(XMLString text, Augmentations augs) 1094 throws XNIException { 1095 if (!isChildFragmentResolved()) { 1096 return; 1097 } 1098 super.characters(text, augs); 1099 } 1100 1101 1115 public void ignorableWhitespace(XMLString text, Augmentations augs) 1116 throws XNIException { 1117 if (!isChildFragmentResolved()) { 1118 return; 1119 } 1120 super.ignorableWhitespace(text, augs); 1121 } 1122 1123 1132 public void endElement(QName element, Augmentations augs) 1133 throws XNIException { 1134 if (!resolveXPointer(element, null, augs, 1135 XPointerPart.EVENT_ELEMENT_END)) { 1136 1137 return; 1139 } 1140 super.endElement(element, augs); 1141 } 1142 1143 1151 public void startCDATA(Augmentations augs) throws XNIException { 1152 if (!isChildFragmentResolved()) { 1153 return; 1154 } 1155 super.startCDATA(augs); 1156 } 1157 1158 1166 public void endCDATA(Augmentations augs) throws XNIException { 1167 if (!isChildFragmentResolved()) { 1168 return; 1169 } 1170 super.endCDATA(augs); 1171 } 1172 1173 1193 public void setProperty(String propertyId, Object value) 1194 throws XMLConfigurationException { 1195 1196 if (propertyId == Constants.XERCES_PROPERTY_PREFIX 1198 + Constants.ERROR_REPORTER_PROPERTY) { 1199 if (value != null) { 1200 fXPointerErrorReporter = (XMLErrorReporter) value; 1201 } else { 1202 fXPointerErrorReporter = null; 1203 } 1204 } 1205 1206 if (propertyId == Constants.XERCES_PROPERTY_PREFIX 1208 + Constants.ERROR_HANDLER_PROPERTY) { 1209 if (value != null) { 1210 fErrorHandler = (XMLErrorHandler) value; 1211 } else { 1212 fErrorHandler = null; 1213 } 1214 } 1215 1216 if (propertyId == Constants.XERCES_FEATURE_PREFIX 1218 + Constants.XINCLUDE_FIXUP_LANGUAGE_FEATURE) { 1219 if (value != null) { 1220 fFixupLang = ((Boolean )value).booleanValue(); 1221 } else { 1222 fFixupLang = false; 1223 } 1224 } 1225 1226 if (propertyId == Constants.XERCES_FEATURE_PREFIX 1228 + Constants.XINCLUDE_FIXUP_BASE_URIS_FEATURE) { 1229 if (value != null) { 1230 fFixupBase = ((Boolean )value).booleanValue(); 1231 } else { 1232 fFixupBase = false; 1233 } 1234 } 1235 1236 if (propertyId == Constants.XERCES_PROPERTY_PREFIX 1238 + Constants.NAMESPACE_CONTEXT_PROPERTY) { 1239 fNamespaceContext = (XIncludeNamespaceSupport) value; 1240 } 1241 1242 super.setProperty(propertyId, value); 1243 } 1244 1245} | Popular Tags |