1 16 19 package com.sun.org.apache.xml.internal.dtm.ref; 20 21 import javax.xml.transform.SourceLocator ; 22 23 import com.sun.org.apache.xml.internal.dtm.DTM; 24 import com.sun.org.apache.xml.internal.dtm.DTMAxisIterator; 25 import com.sun.org.apache.xml.internal.dtm.DTMAxisTraverser; 26 import com.sun.org.apache.xml.internal.dtm.DTMManager; 27 import com.sun.org.apache.xml.internal.dtm.DTMWSFilter; 28 import com.sun.org.apache.xml.internal.utils.FastStringBuffer; 29 import com.sun.org.apache.xml.internal.utils.XMLString; 30 import com.sun.org.apache.xml.internal.utils.XMLStringFactory; 31 32 import org.xml.sax.Attributes ; 33 import org.xml.sax.ContentHandler ; 34 import org.xml.sax.Locator ; 35 import org.xml.sax.ext.LexicalHandler ; 36 37 61 public class DTMDocumentImpl 62 implements DTM, org.xml.sax.ContentHandler , org.xml.sax.ext.LexicalHandler 63 { 64 65 protected static final byte DOCHANDLE_SHIFT = 22; 67 protected static final int NODEHANDLE_MASK = (1 << (DOCHANDLE_SHIFT + 1)) - 1; 70 protected static final int DOCHANDLE_MASK = -1 - NODEHANDLE_MASK; 73 74 int m_docHandle = NULL; int m_docElement = NULL; 77 int currentParent = 0; int previousSibling = 0; protected int m_currentNode = -1; 82 86 private boolean previousSiblingWasParent = false; 87 int gotslot[] = new int[4]; 89 90 private boolean done = false; 92 boolean m_isError = false; 93 94 private final boolean DEBUG = false; 95 96 97 protected String m_documentBaseURI; 98 99 110 private IncrementalSAXSource m_incrSAXSource=null; 111 112 113 115 ChunkedIntArray nodes = new ChunkedIntArray(4); 120 121 private FastStringBuffer m_char = new FastStringBuffer(); 124 private int m_char_current_start=0; 127 128 private DTMStringPool m_localNames = new DTMStringPool(); 134 private DTMStringPool m_nsNames = new DTMStringPool(); 135 private DTMStringPool m_prefixNames = new DTMStringPool(); 136 137 private ExpandedNameTable m_expandedNames= 144 new ExpandedNameTable(); 145 146 private XMLStringFactory m_xsf; 147 148 149 159 public DTMDocumentImpl(DTMManager mgr, int documentNumber, 160 DTMWSFilter whiteSpaceFilter, 161 XMLStringFactory xstringfactory){ 162 initDocument(documentNumber); m_xsf = xstringfactory; 164 } 165 166 177 public void setIncrementalSAXSource(IncrementalSAXSource source) 178 { 179 m_incrSAXSource=source; 180 181 source.setContentHandler(this); 183 source.setLexicalHandler(this); 184 185 } 191 192 204 private final int appendNode(int w0, int w1, int w2, int w3) 205 { 206 int slotnumber = nodes.appendSlot(w0, w1, w2, w3); 208 209 if (DEBUG) System.out.println(slotnumber+": "+w0+" "+w1+" "+w2+" "+w3); 210 211 if (previousSiblingWasParent) 212 nodes.writeEntry(previousSibling,2,slotnumber); 213 214 previousSiblingWasParent = false; 216 return slotnumber; 217 } 218 219 221 229 public void setFeature(String featureId, boolean state) {}; 230 231 238 public void setLocalNameTable(DTMStringPool poolRef) { 239 m_localNames = poolRef; 240 } 241 242 247 public DTMStringPool getLocalNameTable() { 248 return m_localNames; 249 } 250 251 258 public void setNsNameTable(DTMStringPool poolRef) { 259 m_nsNames = poolRef; 260 } 261 262 267 public DTMStringPool getNsNameTable() { 268 return m_nsNames; 269 } 270 271 278 public void setPrefixNameTable(DTMStringPool poolRef) { 279 m_prefixNames = poolRef; 280 } 281 282 287 public DTMStringPool getPrefixNameTable() { 288 return m_prefixNames; 289 } 290 291 297 void setContentBuffer(FastStringBuffer buffer) { 298 m_char = buffer; 299 } 300 301 306 FastStringBuffer getContentBuffer() { 307 return m_char; 308 } 309 310 319 public org.xml.sax.ContentHandler getContentHandler() 320 { 321 if (m_incrSAXSource instanceof IncrementalSAXSource_Filter) 322 return (ContentHandler ) m_incrSAXSource; 323 else 324 return this; 325 } 326 327 337 public LexicalHandler getLexicalHandler() 338 { 339 340 if (m_incrSAXSource instanceof IncrementalSAXSource_Filter) 341 return (LexicalHandler ) m_incrSAXSource; 342 else 343 return this; 344 } 345 346 351 public org.xml.sax.EntityResolver getEntityResolver() 352 { 353 354 return null; 355 } 356 357 362 public org.xml.sax.DTDHandler getDTDHandler() 363 { 364 365 return null; 366 } 367 368 373 public org.xml.sax.ErrorHandler getErrorHandler() 374 { 375 376 return null; 377 } 378 379 384 public org.xml.sax.ext.DeclHandler getDeclHandler() 385 { 386 387 return null; 388 } 389 390 395 public boolean needsTwoThreads() 396 { 397 return null!=m_incrSAXSource; 398 } 399 400 405 public void characters(char[] ch, int start, int length) 406 throws org.xml.sax.SAXException 407 { 408 m_char.append(ch,start,length); 412 } 413 414 private void processAccumulatedText() 416 { 417 int len=m_char.length(); 418 if(len!=m_char_current_start) 419 { 420 appendTextChild(m_char_current_start,len-m_char_current_start); 422 m_char_current_start=len; 423 } 424 } 425 public void endDocument() 426 throws org.xml.sax.SAXException 427 { 428 appendEndDocument(); 431 } 432 public void endElement(java.lang.String namespaceURI, java.lang.String localName, 433 java.lang.String qName) 434 throws org.xml.sax.SAXException 435 { 436 processAccumulatedText(); 437 appendEndElement(); 440 } 441 public void endPrefixMapping(java.lang.String prefix) 442 throws org.xml.sax.SAXException 443 { 444 } 446 public void ignorableWhitespace(char[] ch, int start, int length) 447 throws org.xml.sax.SAXException 448 { 449 } 451 public void processingInstruction(java.lang.String target, java.lang.String data) 452 throws org.xml.sax.SAXException 453 { 454 processAccumulatedText(); 455 } 457 public void setDocumentLocator(Locator locator) 458 { 459 } 461 public void skippedEntity(java.lang.String name) 462 throws org.xml.sax.SAXException 463 { 464 processAccumulatedText(); 465 } 467 public void startDocument() 468 throws org.xml.sax.SAXException 469 { 470 appendStartDocument(); 471 } 472 public void startElement(java.lang.String namespaceURI, java.lang.String localName, 473 java.lang.String qName, Attributes atts) 474 throws org.xml.sax.SAXException 475 { 476 processAccumulatedText(); 477 478 String prefix=null; 480 int colon=qName.indexOf(':'); 481 if(colon>0) 482 prefix=qName.substring(0,colon); 483 484 System.out.println("Prefix="+prefix+" index="+m_prefixNames.stringToIndex(prefix)); 486 appendStartElement(m_nsNames.stringToIndex(namespaceURI), 487 m_localNames.stringToIndex(localName), 488 m_prefixNames.stringToIndex(prefix)); 490 int nAtts=(atts==null) ? 0 : atts.getLength(); 494 for(int i=nAtts-1;i>=0;--i) 496 { 497 qName=atts.getQName(i); 498 if(qName.startsWith("xmlns:") || "xmlns".equals(qName)) 499 { 500 prefix=null; 501 colon=qName.indexOf(':'); 502 if(colon>0) 503 { 504 prefix=qName.substring(0,colon); 505 } 506 else 507 { 508 prefix=null; } 511 512 513 appendNSDeclaration( 514 m_prefixNames.stringToIndex(prefix), 515 m_nsNames.stringToIndex(atts.getValue(i)), 516 atts.getType(i).equalsIgnoreCase("ID")); 517 } 518 } 519 520 for(int i=nAtts-1;i>=0;--i) 521 { 522 qName=atts.getQName(i); 523 if(!(qName.startsWith("xmlns:") || "xmlns".equals(qName))) 524 { 525 prefix=null; 529 colon=qName.indexOf(':'); 530 if(colon>0) 531 { 532 prefix=qName.substring(0,colon); 533 localName=qName.substring(colon+1); 534 } 535 else 536 { 537 prefix=""; localName=qName; 539 } 540 541 542 m_char.append(atts.getValue(i)); int contentEnd=m_char.length(); 544 545 if(!("xmlns".equals(prefix) || "xmlns".equals(qName))) 546 appendAttribute(m_nsNames.stringToIndex(atts.getURI(i)), 547 m_localNames.stringToIndex(localName), 548 m_prefixNames.stringToIndex(prefix), 549 atts.getType(i).equalsIgnoreCase("ID"), 550 m_char_current_start, contentEnd-m_char_current_start); 551 m_char_current_start=contentEnd; 552 } 553 } 554 } 555 public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) 556 throws org.xml.sax.SAXException 557 { 558 } 560 561 public void comment(char[] ch, int start, int length) 566 throws org.xml.sax.SAXException 567 { 568 processAccumulatedText(); 569 570 m_char.append(ch,start,length); appendComment(m_char_current_start,length); 572 m_char_current_start+=length; 573 } 574 public void endCDATA() 575 throws org.xml.sax.SAXException 576 { 577 } 579 public void endDTD() 580 throws org.xml.sax.SAXException 581 { 582 } 584 public void endEntity(java.lang.String name) 585 throws org.xml.sax.SAXException 586 { 587 } 589 public void startCDATA() 590 throws org.xml.sax.SAXException 591 { 592 } 594 public void startDTD(java.lang.String name, java.lang.String publicId, 595 java.lang.String systemId) 596 throws org.xml.sax.SAXException 597 { 598 } 600 public void startEntity(java.lang.String name) 601 throws org.xml.sax.SAXException 602 { 603 } 605 606 607 613 620 final void initDocument(int documentNumber) 621 { 622 m_docHandle = documentNumber<<DOCHANDLE_SHIFT; 624 625 nodes.writeSlot(0,DOCUMENT_NODE,-1,-1,0); 627 done = false; 629 } 630 631 647 656 662 688 702 708 740 743 779 797 801 806 810 814 827 858 876 892 911 923 928 944 960 972 977 984 986 997 public boolean hasChildNodes(int nodeHandle) { 998 return(getFirstChild(nodeHandle) != NULL); 999 } 1000 1001 1009 public int getFirstChild(int nodeHandle) { 1010 1011 nodeHandle &= NODEHANDLE_MASK; 1013 nodes.readSlot(nodeHandle, gotslot); 1015 1016 short type = (short) (gotslot[0] & 0xFFFF); 1018 1019 if ((type == ELEMENT_NODE) || (type == DOCUMENT_NODE) || 1021 (type == ENTITY_REFERENCE_NODE)) { 1022 1023 1030 int kid = nodeHandle + 1; 1031 nodes.readSlot(kid, gotslot); 1032 while (ATTRIBUTE_NODE == (gotslot[0] & 0xFFFF)) { 1033 kid = gotslot[2]; 1035 if (kid == NULL) return NULL; 1037 nodes.readSlot(kid, gotslot); 1038 } 1039 if (gotslot[1] == nodeHandle) 1041 { 1042 int firstChild = kid | m_docHandle; 1043 1044 return firstChild; 1045 } 1046 } 1047 1049 return NULL; 1050 } 1051 1052 1061 public int getLastChild(int nodeHandle) { 1062 nodeHandle &= NODEHANDLE_MASK; 1064 int lastChild = NULL; 1066 for (int nextkid = getFirstChild(nodeHandle); nextkid != NULL; 1067 nextkid = getNextSibling(nextkid)) { 1068 lastChild = nextkid; 1069 } 1070 return lastChild | m_docHandle; 1071 } 1072 1073 1085 public int getAttributeNode(int nodeHandle, String namespaceURI, String name) { 1086 int nsIndex = m_nsNames.stringToIndex(namespaceURI), 1087 nameIndex = m_localNames.stringToIndex(name); 1088 nodeHandle &= NODEHANDLE_MASK; 1089 nodes.readSlot(nodeHandle, gotslot); 1090 short type = (short) (gotslot[0] & 0xFFFF); 1091 if (type == ELEMENT_NODE) 1093 nodeHandle++; 1094 while (type == ATTRIBUTE_NODE) { 1096 if ((nsIndex == (gotslot[0] << 16)) && (gotslot[3] == nameIndex)) 1097 return nodeHandle | m_docHandle; 1098 nodeHandle = gotslot[2]; 1100 nodes.readSlot(nodeHandle, gotslot); 1101 } 1102 return NULL; 1103 } 1104 1105 1111 public int getFirstAttribute(int nodeHandle) { 1112 nodeHandle &= NODEHANDLE_MASK; 1113 1114 1119 if (ELEMENT_NODE != (nodes.readEntry(nodeHandle, 0) & 0xFFFF)) 1121 return NULL; 1122 nodeHandle++; 1124 return(ATTRIBUTE_NODE == (nodes.readEntry(nodeHandle, 0) & 0xFFFF)) ? 1125 nodeHandle | m_docHandle : NULL; 1126 } 1127 1128 1141 public int getFirstNamespaceNode(int nodeHandle, boolean inScope) { 1142 1143 return NULL; 1144 } 1145 1146 1163 public int getNextSibling(int nodeHandle) { 1164 nodeHandle &= NODEHANDLE_MASK; 1165 if (nodeHandle == 0) 1167 return NULL; 1168 1169 short type = (short) (nodes.readEntry(nodeHandle, 0) & 0xFFFF); 1170 if ((type == ELEMENT_NODE) || (type == ATTRIBUTE_NODE) || 1171 (type == ENTITY_REFERENCE_NODE)) { 1172 int nextSib = nodes.readEntry(nodeHandle, 2); 1173 if (nextSib == NULL) 1174 return NULL; 1175 if (nextSib != 0) 1176 return (m_docHandle | nextSib); 1177 } 1179 int thisParent = nodes.readEntry(nodeHandle, 1); 1181 1182 if (nodes.readEntry(++nodeHandle, 1) == thisParent) 1183 return (m_docHandle | nodeHandle); 1184 1185 return NULL; 1186 } 1187 1188 1197 public int getPreviousSibling(int nodeHandle) { 1198 nodeHandle &= NODEHANDLE_MASK; 1199 if (nodeHandle == 0) 1201 return NULL; 1202 1203 int parent = nodes.readEntry(nodeHandle, 1); 1204 int kid = NULL; 1205 for (int nextkid = getFirstChild(parent); nextkid != nodeHandle; 1206 nextkid = getNextSibling(nextkid)) { 1207 kid = nextkid; 1208 } 1209 return kid | m_docHandle; 1210 } 1211 1212 1221 public int getNextAttribute(int nodeHandle) { 1222 nodeHandle &= NODEHANDLE_MASK; 1223 nodes.readSlot(nodeHandle, gotslot); 1224 1225 short type = (short) (gotslot[0] & 0xFFFF); 1230 1231 if (type == ELEMENT_NODE) { 1232 return getFirstAttribute(nodeHandle); 1233 } else if (type == ATTRIBUTE_NODE) { 1234 if (gotslot[2] != NULL) 1235 return (m_docHandle | gotslot[2]); 1236 } 1237 return NULL; 1238 } 1239 1240 1250 public int getNextNamespaceNode(int baseHandle,int namespaceHandle, boolean inScope) { 1251 return NULL; 1253 } 1254 1255 1265 public int getNextDescendant(int subtreeRootHandle, int nodeHandle) { 1266 subtreeRootHandle &= NODEHANDLE_MASK; 1267 nodeHandle &= NODEHANDLE_MASK; 1268 if (nodeHandle == 0) 1270 return NULL; 1271 while (!m_isError) { 1272 if (done && (nodeHandle > nodes.slotsUsed())) 1274 break; 1275 if (nodeHandle > subtreeRootHandle) { 1276 nodes.readSlot(nodeHandle+1, gotslot); 1277 if (gotslot[2] != 0) { 1278 short type = (short) (gotslot[0] & 0xFFFF); 1279 if (type == ATTRIBUTE_NODE) { 1280 nodeHandle +=2; 1281 } else { 1282 int nextParentPos = gotslot[1]; 1283 if (nextParentPos >= subtreeRootHandle) 1284 return (m_docHandle | (nodeHandle+1)); 1285 else 1286 break; 1287 } 1288 } else if (!done) { 1289 } else 1291 break; 1292 } else { 1293 nodeHandle++; 1294 } 1295 } 1296 return NULL; 1298 } 1299 1300 1308 public int getNextFollowing(int axisContextHandle, int nodeHandle) { 1309 return NULL; 1311 } 1312 1313 1321 public int getNextPreceding(int axisContextHandle, int nodeHandle) { 1322 nodeHandle &= NODEHANDLE_MASK; 1324 while (nodeHandle > 1) { 1325 nodeHandle--; 1326 if (ATTRIBUTE_NODE == (nodes.readEntry(nodeHandle, 0) & 0xFFFF)) 1327 continue; 1328 1329 1333 1337 return (m_docHandle | nodes.specialFind(axisContextHandle, nodeHandle)); 1338 } 1339 return NULL; 1340 } 1341 1342 1349 public int getParent(int nodeHandle) { 1350 1352 return (m_docHandle | nodes.readEntry(nodeHandle, 1)); 1354 } 1355 1356 1360 public int getDocumentRoot() { 1361 return (m_docHandle | m_docElement); 1362 } 1363 1364 1370 public int getDocument() { 1371 return m_docHandle; 1372 } 1373 1374 1387 public int getOwnerDocument(int nodeHandle) { 1388 if ((nodeHandle & NODEHANDLE_MASK) == 0) 1390 return NULL; 1391 return (nodeHandle & DOCHANDLE_MASK); 1392 } 1393 1394 1406 public int getDocumentRoot(int nodeHandle) { 1407 if ((nodeHandle & NODEHANDLE_MASK) == 0) 1409 return NULL; 1410 return (nodeHandle & DOCHANDLE_MASK); 1411 } 1412 1413 1422 public XMLString getStringValue(int nodeHandle) { 1423 nodes.readSlot(nodeHandle, gotslot); 1425 int nodetype=gotslot[0] & 0xFF; 1426 String value=null; 1427 1428 switch (nodetype) { 1429 case TEXT_NODE: 1430 case COMMENT_NODE: 1431 case CDATA_SECTION_NODE: 1432 value= m_char.getString(gotslot[2], gotslot[3]); 1433 break; 1434 case PROCESSING_INSTRUCTION_NODE: 1435 case ATTRIBUTE_NODE: 1436 case ELEMENT_NODE: 1437 case ENTITY_REFERENCE_NODE: 1438 default: 1439 break; 1440 } 1441 return m_xsf.newstr( value ); 1442 1443 } 1444 1445 1468 public int getStringValueChunkCount(int nodeHandle) 1470 { 1471 return 0; 1473 } 1474 1475 1499 public char[] getStringValueChunk(int nodeHandle, int chunkIndex, 1501 int[] startAndLen) {return new char[0];} 1502 1503 1510 public int getExpandedTypeID(int nodeHandle) { 1511 nodes.readSlot(nodeHandle, gotslot); 1512 String qName = m_localNames.indexToString(gotslot[3]); 1513 int colonpos = qName.indexOf(":"); 1516 String localName = qName.substring(colonpos+1); 1517 String namespace = m_nsNames.indexToString(gotslot[0] << 16); 1519 String expandedName = namespace + ":" + localName; 1521 int expandedNameID = m_nsNames.stringToIndex(expandedName); 1522 1523 return expandedNameID; 1524 } 1525 1526 1527 1537 public int getExpandedTypeID(String namespace, String localName, int type) { 1538 String expandedName = namespace + ":" + localName; 1544 int expandedNameID = m_nsNames.stringToIndex(expandedName); 1545 1546 return expandedNameID; 1547 } 1548 1549 1550 1556 public String getLocalNameFromExpandedNameID(int ExpandedNameID) { 1557 1558 String expandedName = m_localNames.indexToString(ExpandedNameID); 1560 int colonpos = expandedName.indexOf(":"); 1562 String localName = expandedName.substring(colonpos+1); 1563 return localName; 1564 } 1565 1566 1567 1574 public String getNamespaceFromExpandedNameID(int ExpandedNameID) { 1575 1576 String expandedName = m_localNames.indexToString(ExpandedNameID); 1577 int colonpos = expandedName.indexOf(":"); 1579 String nsName = expandedName.substring(0, colonpos); 1580 1581 return nsName; 1582 } 1583 1584 1585 1588 static final String [] fixednames= 1589 { 1590 null,null, null,"#text", "#cdata_section",null, null,null, "#comment","#document", null,"#document-fragment", null}; 1598 1606 public String getNodeName(int nodeHandle) { 1607 nodes.readSlot(nodeHandle, gotslot); 1608 short type = (short) (gotslot[0] & 0xFFFF); 1609 String name = fixednames[type]; 1610 if (null == name) { 1611 int i=gotslot[3]; 1612 System.out.println("got i="+i+" "+(i>>16)+"/"+(i&0xffff)); 1613 1614 name=m_localNames.indexToString(i & 0xFFFF); 1615 String prefix=m_prefixNames.indexToString(i >>16); 1616 if(prefix!=null && prefix.length()>0) 1617 name=prefix+":"+name; 1618 } 1619 return name; 1620 } 1621 1622 1630 public String getNodeNameX(int nodeHandle) {return null;} 1631 1632 1643 public String getLocalName(int nodeHandle) { 1644 nodes.readSlot(nodeHandle, gotslot); 1645 short type = (short) (gotslot[0] & 0xFFFF); 1646 String name = ""; 1647 if ((type==ELEMENT_NODE) || (type==ATTRIBUTE_NODE)) { 1648 int i=gotslot[3]; 1649 name=m_localNames.indexToString(i & 0xFFFF); 1650 if(name==null) name=""; 1651 } 1652 return name; 1653 } 1654 1655 1669 public String getPrefix(int nodeHandle) { 1670 nodes.readSlot(nodeHandle, gotslot); 1671 short type = (short) (gotslot[0] & 0xFFFF); 1672 String name = ""; 1673 if((type==ELEMENT_NODE) || (type==ATTRIBUTE_NODE)) { 1674 int i=gotslot[3]; 1675 name=m_prefixNames.indexToString(i >>16); 1676 if(name==null) name=""; 1677 } 1678 return name; 1679 } 1680 1681 1690 public String getNamespaceURI(int nodeHandle) {return null;} 1691 1692 1701 public String getNodeValue(int nodeHandle) 1702 { 1703 nodes.readSlot(nodeHandle, gotslot); 1704 int nodetype=gotslot[0] & 0xFF; String value=null; 1706 1707 switch (nodetype) { case ATTRIBUTE_NODE: 1709 nodes.readSlot(nodeHandle+1, gotslot); 1710 case TEXT_NODE: 1711 case COMMENT_NODE: 1712 case CDATA_SECTION_NODE: 1713 value=m_char.getString(gotslot[2], gotslot[3]); break; 1715 case PROCESSING_INSTRUCTION_NODE: 1716 case ELEMENT_NODE: 1717 case ENTITY_REFERENCE_NODE: 1718 default: 1719 break; 1720 } 1721 return value; 1722 } 1723 1724 1732 public short getNodeType(int nodeHandle) { 1733 return(short) (nodes.readEntry(nodeHandle, 0) & 0xFFFF); 1734 } 1735 1736 1744 public short getLevel(int nodeHandle) { 1745 short count = 0; 1746 while (nodeHandle != 0) { 1747 count++; 1748 nodeHandle = nodes.readEntry(nodeHandle, 1); 1749 } 1750 return count; 1751 } 1752 1753 1755 1767 public boolean isSupported(String feature, String version) {return false;} 1768 1769 1776 public String getDocumentBaseURI() 1777 { 1778 1779 return m_documentBaseURI; 1780 } 1781 1782 1787 public void setDocumentBaseURI(String baseURI) 1788 { 1789 1790 m_documentBaseURI = baseURI; 1791 } 1792 1793 1800 public String getDocumentSystemIdentifier(int nodeHandle) {return null;} 1801 1802 1809 public String getDocumentEncoding(int nodeHandle) {return null;} 1810 1811 1821 public String getDocumentStandalone(int nodeHandle) {return null;} 1822 1823 1833 public String getDocumentVersion(int documentHandle) {return null;} 1834 1835 1845 public boolean getDocumentAllDeclarationsProcessed() {return false;} 1846 1847 1855 public String getDocumentTypeDeclarationSystemIdentifier() {return null;} 1856 1857 1867 public String getDocumentTypeDeclarationPublicIdentifier() {return null;} 1868 1869 1886 public int getElementById(String elementId) {return 0;} 1887 1888 1922 public String getUnparsedEntityURI(String name) {return null;} 1923 1924 1925 1927 1934 public boolean supportsPreStripping() {return false;} 1935 1936 1954 public boolean isNodeAfter(int nodeHandle1, int nodeHandle2) {return false;} 1955 1956 1972 public boolean isCharacterElementContentWhitespace(int nodeHandle) {return false;} 1973 1974 1988 public boolean isDocumentAllDeclarationsProcessed(int documentHandle) {return false;} 1989 1990 2001 public boolean isAttributeSpecified(int attributeHandle) {return false;} 2002 2003 2005 2018 public void dispatchCharactersEvents( 2019 int nodeHandle, org.xml.sax.ContentHandler ch, boolean normalize) 2020 throws org.xml.sax.SAXException {} 2021 2022 2030 2031 public void dispatchToEvents(int nodeHandle, org.xml.sax.ContentHandler ch) 2032 throws org.xml.sax.SAXException {} 2033 2034 2041 public org.w3c.dom.Node getNode(int nodeHandle) 2042 { 2043 return null; 2044 } 2045 2046 2051 2063 public void appendChild(int newChild, boolean clone, boolean cloneDepth) { 2064 boolean sameDoc = ((newChild & DOCHANDLE_MASK) == m_docHandle); 2065 if (clone || !sameDoc) { 2066 2067 } else { 2068 2069 } 2070 } 2071 2072 2081 public void appendTextChild(String str) { 2082 } 2085 2086 2087 2092 2099 void appendTextChild(int m_char_current_start,int contentLength) 2100 { 2101 int w0 = TEXT_NODE; 2104 int w1 = currentParent; 2106 int w2 = m_char_current_start; 2108 int w3 = contentLength; 2110 2111 int ourslot = appendNode(w0, w1, w2, w3); 2112 previousSibling = ourslot; 2113 } 2114 2115 2122 void appendComment(int m_char_current_start,int contentLength) 2123 { 2124 int w0 = COMMENT_NODE; 2127 int w1 = currentParent; 2129 int w2 = m_char_current_start; 2131 int w3 = contentLength; 2133 2134 int ourslot = appendNode(w0, w1, w2, w3); 2135 previousSibling = ourslot; 2136 } 2137 2138 2139 2154 void appendStartElement(int namespaceIndex,int localNameIndex, int prefixIndex) 2155 { 2156 2161 int w0 = (namespaceIndex << 16) | ELEMENT_NODE; 2163 int w1 = currentParent; 2165 int w2 = 0; 2167 int w3 = localNameIndex | prefixIndex<<16; 2169 System.out.println("set w3="+w3+" "+(w3>>16)+"/"+(w3&0xffff)); 2170 2171 int ourslot = appendNode(w0, w1, w2, w3); 2173 currentParent = ourslot; 2174 previousSibling = 0; 2175 2176 if (m_docElement == NULL) 2178 m_docElement = ourslot; 2179 } 2180 2181 2192 void appendNSDeclaration(int prefixIndex, int namespaceIndex, 2193 boolean isID) 2194 { 2195 2200 2203 2205 final int namespaceForNamespaces=m_nsNames.stringToIndex("http://www.w3.org/2000/xmlns/"); 2206 2207 int w0 = NAMESPACE_NODE | (m_nsNames.stringToIndex("http://www.w3.org/2000/xmlns/")<<16); 2209 2210 int w1 = currentParent; 2212 int w2 = 0; 2214 int w3 = namespaceIndex; 2216 int ourslot = appendNode(w0, w1, w2, w3); 2218 previousSibling = ourslot; previousSiblingWasParent = false; 2220 return ; } 2222 2223 2238 void appendAttribute(int namespaceIndex, int localNameIndex, int prefixIndex, 2239 boolean isID, 2240 int m_char_current_start, int contentLength) 2241 { 2242 2244 int w0 = ATTRIBUTE_NODE | namespaceIndex<<16; 2246 2247 int w1 = currentParent; 2249 int w2 = 0; 2251 int w3 = localNameIndex | prefixIndex<<16; 2253 System.out.println("set w3="+w3+" "+(w3>>16)+"/"+(w3&0xffff)); 2254 int ourslot = appendNode(w0, w1, w2, w3); 2256 previousSibling = ourslot; 2258 2260 w0 = TEXT_NODE; 2262 w1 = ourslot; 2264 w2 = m_char_current_start; 2266 w3 = contentLength; 2268 appendNode(w0, w1, w2, w3); 2269 2270 previousSiblingWasParent = true; 2272 return ; } 2274 2275 2283 public DTMAxisTraverser getAxisTraverser(final int axis) 2284 { 2285 return null; 2286 } 2287 2288 2298 public DTMAxisIterator getAxisIterator(final int axis) 2299 { 2300 return null; 2302 } 2303 2304 2314 public DTMAxisIterator getTypedAxisIterator(final int axis, final int type) 2315 { 2316 return null; 2318 } 2319 2320 2321 2324 void appendEndElement() 2325 { 2326 2328 if (previousSiblingWasParent) 2329 nodes.writeEntry(previousSibling, 2, NULL); 2330 2331 previousSibling = currentParent; 2333 nodes.readSlot(currentParent, gotslot); 2334 currentParent = gotslot[1] & 0xFFFF; 2335 2336 previousSiblingWasParent = true; 2339 2340 } 2343 2344 2347 void appendStartDocument() 2348 { 2349 2350 m_docElement = NULL; initDocument(0); 2354 } 2355 2356 2359 void appendEndDocument() 2360 { 2361 done = true; 2362 } 2365 2366 2373 public void setProperty(String property, Object value) 2374 { 2375 } 2376 2377 2384 public SourceLocator getSourceLocatorFor(int node) 2385 { 2386 return null; 2387 } 2388 2389 2390 2395 public void documentRegistration() 2396 { 2397 } 2398 2399 2404 public void documentRelease() 2405 { 2406 } 2407 2408 2415 public void migrateTo(DTMManager manager) 2416 { 2417 } 2418 2419} 2420 | Popular Tags |