| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.tree.tiny; |
| 9 |
|
| 10 |
import net.sf.saxon.Configuration; |
| 11 |
import net.sf.saxon.event.ReceiverOptions; |
| 12 |
import net.sf.saxon.lib.Feature; |
| 13 |
import net.sf.saxon.lib.FeatureKeys; |
| 14 |
import net.sf.saxon.om.*; |
| 15 |
import net.sf.saxon.trans.XPathException; |
| 16 |
import net.sf.saxon.tree.linked.SystemIdMap; |
| 17 |
import net.sf.saxon.tree.util.FastStringBuffer; |
| 18 |
import net.sf.saxon.type.*; |
| 19 |
import net.sf.saxon.value.*; |
| 20 |
import net.sf.saxon.z.IntArraySet; |
| 21 |
import net.sf.saxon.z.IntHashMap; |
| 22 |
import net.sf.saxon.z.IntHashSet; |
| 23 |
import net.sf.saxon.z.IntSet; |
| 24 |
|
| 25 |
import java.util.*; |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
public final class TinyTree extends GenericTreeInfo implements NodeVectorTree { |
| 41 |
|
| 42 |
|
| 43 |
private static final String[] EMPTY_STRING_ARRAY = new String[0]; |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
protected AppendableCharSequence charBuffer; |
| 48 |
|
| 49 |
protected FastStringBuffer commentBuffer = null; |
| 50 |
|
| 51 |
protected int numberOfNodes = 0; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
public byte[] nodeKind; |
| 58 |
|
| 59 |
|
| 60 |
protected short[] depth; |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
protected int[] next; |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
protected int[] alpha; |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
protected int[] beta; |
| 77 |
|
| 78 |
|
| 79 |
protected int[] nameCode; |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
protected int[] prior = null; |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
protected SchemaType[] typeArray = null; |
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
protected AtomicSequence[] typedValueArray = null; |
| 96 |
|
| 97 |
|
| 98 |
protected IntSet idRefElements = null; |
| 99 |
|
| 100 |
|
| 101 |
protected IntSet idRefAttributes = null; |
| 102 |
|
| 103 |
|
| 104 |
protected IntSet nilledElements = null; |
| 105 |
|
| 106 |
|
| 107 |
protected IntSet defaultedAttributes = null; |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
protected IntSet topWithinEntity = null; |
| 112 |
|
| 113 |
|
| 114 |
private boolean allowTypedValueCache = true; |
| 115 |
|
| 116 |
public static final int TYPECODE_IDREF = 1 << 29; |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
protected int numberOfAttributes = 0; |
| 124 |
|
| 125 |
|
| 126 |
protected int[] attParent; |
| 127 |
|
| 128 |
|
| 129 |
protected int[] attCode; |
| 130 |
|
| 131 |
|
| 132 |
protected CharSequence[] attValue; |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
protected AtomicSequence[] attTypedValue; |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
protected SimpleType[] attType; |
| 143 |
|
| 144 |
|
| 145 |
protected int numberOfNamespaces = 0; |
| 146 |
|
| 147 |
|
| 148 |
protected int[] namespaceParent; |
| 149 |
|
| 150 |
|
| 151 |
protected NamespaceBinding[] namespaceBinding; |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
private int[] lineNumbers = null; |
| 160 |
|
| 161 |
private int[] columnNumbers = null; |
| 162 |
|
| 163 |
private SystemIdMap systemIdMap = null; |
| 164 |
|
| 165 |
|
| 166 |
protected boolean usesNamespaces = false; |
| 167 |
|
| 168 |
protected PrefixPool prefixPool = new PrefixPool(); |
| 169 |
|
| 170 |
private TinyDocumentImpl root; |
| 171 |
private HashMap<String, NodeInfo> idTable; |
| 172 |
protected HashMap<String, String[]> entityTable; |
| 173 |
|
| 174 |
private NodeInfo copiedFrom; |
| 175 |
|
| 176 |
protected List<GraftedElement> externalNodes; |
| 177 |
|
| 178 |
protected IntHashMap<String> knownBaseUris; |
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
public final static boolean useBulkCopy = true; |
| 186 |
public static boolean useGraft = false; |
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
public TinyTree( Configuration config, Statistics statistics) { |
| 197 |
super(config); |
| 198 |
|
| 199 |
|
| 200 |
int nodes = (int) statistics.getAverageNodes() + 1; |
| 201 |
int attributes = (int) statistics.getAverageAttributes() + 1; |
| 202 |
int namespaces = (int) statistics.getAverageNamespaces() + 1; |
| 203 |
int characters = (int) statistics.getAverageCharacters() + 1; |
| 204 |
|
| 205 |
nodeKind = new byte[nodes]; |
| 206 |
depth = new short[nodes]; |
| 207 |
next = new int[nodes]; |
| 208 |
alpha = new int[nodes]; |
| 209 |
beta = new int[nodes]; |
| 210 |
nameCode = new int[nodes]; |
| 211 |
|
| 212 |
numberOfAttributes = 0; |
| 213 |
attParent = new int[attributes]; |
| 214 |
attCode = new int[attributes]; |
| 215 |
attValue = new String[attributes]; |
| 216 |
|
| 217 |
numberOfNamespaces = 0; |
| 218 |
namespaceParent = new int[namespaces]; |
| 219 |
namespaceBinding = new NamespaceBinding[namespaces]; |
| 220 |
|
| 221 |
|
| 222 |
charBuffer = characters > 65000 ? new LargeStringBuffer() : new FastStringBuffer(characters); |
| 223 |
|
| 224 |
setConfiguration(config); |
| 225 |
} |
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
public void setConfiguration( Configuration config) { |
| 234 |
super.setConfiguration(config); |
| 235 |
allowTypedValueCache = config.isLicensedFeature(Configuration.LicenseFeature.SCHEMA_VALIDATION) && |
| 236 |
config.getBooleanProperty(Feature.USE_TYPED_VALUE_CACHE); |
| 237 |
addNamespace(0, NamespaceBinding.XML); |
| 238 |
} |
| 239 |
|
| 240 |
private void ensureNodeCapacity(short kind, int needed) { |
| 241 |
if (nodeKind.length < numberOfNodes + needed) { |
| 242 |
|
| 243 |
int k = kind == Type.STOPPER ? numberOfNodes + 1 : Math.max(numberOfNodes * 2, numberOfNodes + needed); |
| 244 |
|
| 245 |
nodeKind = Arrays.copyOf(nodeKind, k); |
| 246 |
next = Arrays.copyOf(next, k); |
| 247 |
depth = Arrays.copyOf(depth, k); |
| 248 |
alpha = Arrays.copyOf(alpha, k); |
| 249 |
beta = Arrays.copyOf(beta, k); |
| 250 |
nameCode = Arrays.copyOf(nameCode, k); |
| 251 |
|
| 252 |
if (typeArray != null) { |
| 253 |
typeArray = Arrays.copyOf(typeArray, k); |
| 254 |
} |
| 255 |
|
| 256 |
if (typedValueArray != null) { |
| 257 |
typedValueArray = Arrays.copyOf(typedValueArray, k); |
| 258 |
} |
| 259 |
|
| 260 |
if (lineNumbers != null) { |
| 261 |
lineNumbers = Arrays.copyOf(lineNumbers, k); |
| 262 |
columnNumbers = Arrays.copyOf(columnNumbers, k); |
| 263 |
} |
| 264 |
} |
| 265 |
} |
| 266 |
|
| 267 |
private void ensureAttributeCapacity(int needed) { |
| 268 |
if (attParent.length < numberOfAttributes + needed) { |
| 269 |
int k = Math.max(numberOfAttributes + needed, numberOfAttributes * 2); |
| 270 |
if (k == 0) { |
| 271 |
k = 10 + needed; |
| 272 |
} |
| 273 |
|
| 274 |
attParent = Arrays.copyOf(attParent, k); |
| 275 |
attCode = Arrays.copyOf(attCode, k); |
| 276 |
attValue = Arrays.copyOf(attValue, k); |
| 277 |
|
| 278 |
if (attType != null) { |
| 279 |
attType = Arrays.copyOf(attType, k); |
| 280 |
} |
| 281 |
|
| 282 |
if (attTypedValue != null) { |
| 283 |
attTypedValue = Arrays.copyOf(attTypedValue, k); |
| 284 |
} |
| 285 |
} |
| 286 |
} |
| 287 |
|
| 288 |
private void ensureNamespaceCapacity(int needed) { |
| 289 |
if (namespaceParent.length < numberOfNamespaces + needed) { |
| 290 |
int k = Math.max(numberOfNamespaces * 2, numberOfNamespaces + needed); |
| 291 |
if (k == 0) { |
| 292 |
k = 10; |
| 293 |
} |
| 294 |
namespaceParent = Arrays.copyOf(namespaceParent, k); |
| 295 |
namespaceBinding = Arrays.copyOf(namespaceBinding, k); |
| 296 |
} |
| 297 |
} |
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
public PrefixPool getPrefixPool() { |
| 306 |
return prefixPool; |
| 307 |
} |
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
public void setCopiedFrom(NodeInfo copiedFrom) { |
| 317 |
this.copiedFrom = copiedFrom; |
| 318 |
} |
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
|
| 328 |
public NodeInfo getCopiedFrom() { |
| 329 |
return this.copiedFrom; |
| 330 |
} |
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
int addDocumentNode(TinyDocumentImpl doc) { |
| 341 |
setRootNode(doc); |
| 342 |
return addNode(Type.DOCUMENT, 0, 0, 0, -1); |
| 343 |
} |
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
int addNode(short kind, int depth, int alpha, int beta, int nameCode) { |
| 357 |
|
| 358 |
ensureNodeCapacity(kind, 1); |
| 359 |
nodeKind[numberOfNodes] = (byte) kind; |
| 360 |
this.depth[numberOfNodes] = (short) depth; |
| 361 |
this.alpha[numberOfNodes] = alpha; |
| 362 |
this.beta[numberOfNodes] = beta; |
| 363 |
this.nameCode[numberOfNodes] = nameCode; |
| 364 |
next[numberOfNodes] = -1; |
| 365 |
|
| 366 |
if (typeArray != null) { |
| 367 |
typeArray[numberOfNodes] = Untyped.getInstance(); |
| 368 |
} |
| 369 |
|
| 370 |
if (numberOfNodes == 0) { |
| 371 |
setDocumentNumber(getConfiguration().getDocumentNumberAllocator().allocateDocumentNumber()); |
| 372 |
} |
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
return numberOfNodes++; |
| 383 |
} |
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
void appendChars(CharSequence chars) { |
| 392 |
if (charBuffer instanceof FastStringBuffer && charBuffer.length() > 65000) { |
| 393 |
LargeStringBuffer lsb = new LargeStringBuffer(); |
| 394 |
lsb.append(charBuffer); |
| 395 |
charBuffer = lsb; |
| 396 |
} |
| 397 |
charBuffer.append(chars); |
| 398 |
} |
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
public int addTextNodeCopy(int depth, int existingNodeNr) { |
| 409 |
return addNode(Type.TEXT, depth, alpha[existingNodeNr], beta[existingNodeNr], -1); |
| 410 |
} |
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
void condense(Statistics statistics) { |
| 422 |
|
| 423 |
|
| 424 |
if (numberOfNodes * 3 < nodeKind.length || |
| 425 |
(nodeKind.length - numberOfNodes > 20000)) { |
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
nodeKind = Arrays.copyOf(nodeKind, numberOfNodes); |
| 430 |
next = Arrays.copyOf(next, numberOfNodes); |
| 431 |
depth = Arrays.copyOf(depth, numberOfNodes); |
| 432 |
alpha = Arrays.copyOf(alpha, numberOfNodes); |
| 433 |
beta = Arrays.copyOf(beta, numberOfNodes); |
| 434 |
nameCode = Arrays.copyOf(nameCode, numberOfNodes); |
| 435 |
|
| 436 |
if (typeArray != null) { |
| 437 |
typeArray = Arrays.copyOf(typeArray, numberOfNodes); |
| 438 |
} |
| 439 |
if (lineNumbers != null) { |
| 440 |
lineNumbers = Arrays.copyOf(lineNumbers, numberOfNodes); |
| 441 |
columnNumbers = Arrays.copyOf(columnNumbers, numberOfNodes); |
| 442 |
} |
| 443 |
|
| 444 |
} |
| 445 |
|
| 446 |
if ((numberOfAttributes * 3 < attParent.length) || |
| 447 |
(attParent.length - numberOfAttributes > 1000)) { |
| 448 |
int k = numberOfAttributes; |
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
if (k == 0) { |
| 453 |
attParent = IntArraySet.EMPTY_INT_ARRAY; |
| 454 |
attCode = IntArraySet.EMPTY_INT_ARRAY; |
| 455 |
attValue = EMPTY_STRING_ARRAY; |
| 456 |
attType = null; |
| 457 |
} else { |
| 458 |
attParent = Arrays.copyOf(attParent, numberOfAttributes); |
| 459 |
attCode = Arrays.copyOf(attCode, numberOfAttributes); |
| 460 |
attValue = Arrays.copyOf(attValue, numberOfAttributes); |
| 461 |
} |
| 462 |
|
| 463 |
if (attType != null) { |
| 464 |
attType = Arrays.copyOf(attType, numberOfAttributes); |
| 465 |
} |
| 466 |
} |
| 467 |
|
| 468 |
if (numberOfNamespaces * 3 < namespaceParent.length) { |
| 469 |
namespaceParent = Arrays.copyOf(namespaceParent, numberOfNamespaces); |
| 470 |
namespaceBinding = Arrays.copyOf(namespaceBinding, numberOfNamespaces); |
| 471 |
} |
| 472 |
|
| 473 |
prefixPool.condense(); |
| 474 |
|
| 475 |
statistics.updateStatistics(numberOfNodes, numberOfAttributes, numberOfNamespaces, charBuffer.length()); |
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
} |
| 486 |
|
| 487 |
|
| 488 |
|
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
void setElementAnnotation(int nodeNr, SchemaType type) { |
| 495 |
if (!type.equals(Untyped.getInstance())) { |
| 496 |
if (typeArray == null) { |
| 497 |
typeArray = new SchemaType[nodeKind.length]; |
| 498 |
Arrays.fill(typeArray, 0, nodeKind.length, Untyped.getInstance()); |
| 499 |
} |
| 500 |
assert typeArray != null; |
| 501 |
typeArray[nodeNr] = type; |
| 502 |
} |
| 503 |
} |
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
public int getTypeAnnotation(int nodeNr) { |
| 514 |
if (typeArray == null) { |
| 515 |
return StandardNames.XS_UNTYPED; |
| 516 |
} |
| 517 |
return typeArray[nodeNr].getFingerprint(); |
| 518 |
} |
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
public SchemaType getSchemaType(int nodeNr) { |
| 529 |
if (typeArray == null) { |
| 530 |
return Untyped.getInstance(); |
| 531 |
} |
| 532 |
return typeArray[nodeNr]; |
| 533 |
} |
| 534 |
|
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
public AtomicSequence getTypedValueOfElement( TinyElementImpl element) throws XPathException { |
| 546 |
int nodeNr = element.nodeNr; |
| 547 |
if (typedValueArray == null || typedValueArray[nodeNr] == null) { |
| 548 |
SchemaType stype = getSchemaType(nodeNr); |
| 549 |
int annotation = stype.getFingerprint(); |
| 550 |
if (annotation == StandardNames.XS_UNTYPED || annotation == StandardNames.XS_UNTYPED_ATOMIC || |
| 551 |
annotation == StandardNames.XS_ANY_TYPE) { |
| 552 |
CharSequence stringValue = TinyParentNodeImpl.getStringValueCS(this, nodeNr); |
| 553 |
return new UntypedAtomicValue(stringValue); |
| 554 |
} else if (annotation == StandardNames.XS_STRING) { |
| 555 |
CharSequence stringValue = TinyParentNodeImpl.getStringValueCS(this, nodeNr); |
| 556 |
return new StringValue(stringValue); |
| 557 |
} else if (annotation == StandardNames.XS_ANY_URI) { |
| 558 |
CharSequence stringValue = TinyParentNodeImpl.getStringValueCS(this, nodeNr); |
| 559 |
return new AnyURIValue(stringValue); |
| 560 |
} else { |
| 561 |
AtomicSequence value = stype.atomize(element); |
| 562 |
if (allowTypedValueCache) { |
| 563 |
if (typedValueArray == null) { |
| 564 |
|
| 565 |
typedValueArray = new AtomicSequence[nodeKind.length]; |
| 566 |
} |
| 567 |
typedValueArray[nodeNr] = value; |
| 568 |
} |
| 569 |
return value; |
| 570 |
} |
| 571 |
} else { |
| 572 |
return typedValueArray[nodeNr]; |
| 573 |
} |
| 574 |
} |
| 575 |
|
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
public AtomicSequence getTypedValueOfElement(int nodeNr) throws XPathException { |
| 586 |
if (typedValueArray == null || typedValueArray[nodeNr] == null) { |
| 587 |
SchemaType stype = getSchemaType(nodeNr); |
| 588 |
int annotation = stype.getFingerprint(); |
| 589 |
if (annotation == StandardNames.XS_UNTYPED_ATOMIC || annotation == StandardNames.XS_UNTYPED) { |
| 590 |
CharSequence stringValue = TinyParentNodeImpl.getStringValueCS(this, nodeNr); |
| 591 |
return new UntypedAtomicValue(stringValue); |
| 592 |
} else if (annotation == StandardNames.XS_STRING) { |
| 593 |
CharSequence stringValue = TinyParentNodeImpl.getStringValueCS(this, nodeNr); |
| 594 |
return new StringValue(stringValue); |
| 595 |
} else if (annotation == StandardNames.XS_ANY_URI) { |
| 596 |
CharSequence stringValue = TinyParentNodeImpl.getStringValueCS(this, nodeNr); |
| 597 |
return new AnyURIValue(stringValue); |
| 598 |
} else if (annotation == StandardNames.XS_ID) { |
| 599 |
CharSequence stringValue = TinyParentNodeImpl.getStringValueCS(this, nodeNr); |
| 600 |
return new StringValue(stringValue, BuiltInAtomicType.ID); |
| 601 |
} else { |
| 602 |
TinyNodeImpl element = getNode(nodeNr); |
| 603 |
AtomicSequence value = stype.atomize(element); |
| 604 |
if (allowTypedValueCache) { |
| 605 |
if (typedValueArray == null) { |
| 606 |
|
| 607 |
typedValueArray = new AtomicSequence[nodeKind.length]; |
| 608 |
} |
| 609 |
typedValueArray[nodeNr] = value; |
| 610 |
} |
| 611 |
return value; |
| 612 |
} |
| 613 |
} else { |
| 614 |
return typedValueArray[nodeNr]; |
| 615 |
} |
| 616 |
} |
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
|
| 628 |
|
| 629 |
|
| 630 |
public AtomicSequence getTypedValueOfAttribute( TinyAttributeImpl att, int nodeNr) throws XPathException { |
| 631 |
if (attType == null) { |
| 632 |
|
| 633 |
return new UntypedAtomicValue(attValue[nodeNr]); |
| 634 |
} |
| 635 |
if (attTypedValue == null || attTypedValue[nodeNr] == null) { |
| 636 |
SimpleType type = getAttributeType(nodeNr); |
| 637 |
if (type.equals(BuiltInAtomicType.UNTYPED_ATOMIC)) { |
| 638 |
return new UntypedAtomicValue(attValue[nodeNr]); |
| 639 |
} else if (type.equals(BuiltInAtomicType.STRING)) { |
| 640 |
return new StringValue(attValue[nodeNr]); |
| 641 |
} else if (type.equals(BuiltInAtomicType.ANY_URI)) { |
| 642 |
return new AnyURIValue(attValue[nodeNr]); |
| 643 |
} else { |
| 644 |
if (att == null) { |
| 645 |
att = new TinyAttributeImpl(this, nodeNr); |
| 646 |
} |
| 647 |
AtomicSequence value = type.atomize(att); |
| 648 |
if (allowTypedValueCache) { |
| 649 |
if (attTypedValue == null) { |
| 650 |
|
| 651 |
attTypedValue = new AtomicSequence[attParent.length]; |
| 652 |
} |
| 653 |
attTypedValue[nodeNr] = value; |
| 654 |
} |
| 655 |
return value; |
| 656 |
|
| 657 |
} |
| 658 |
} else { |
| 659 |
return attTypedValue[nodeNr]; |
| 660 |
} |
| 661 |
} |
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
|
| 671 |
|
| 672 |
public int getNodeKind(int nodeNr) { |
| 673 |
int kind = nodeKind[nodeNr]; |
| 674 |
return kind == Type.WHITESPACE_TEXT ? Type.TEXT : kind; |
| 675 |
} |
| 676 |
|
| 677 |
|
| 678 |
|
| 679 |
|
| 680 |
|
| 681 |
|
| 682 |
|
| 683 |
|
| 684 |
|
| 685 |
public int getNameCode(int nodeNr) { |
| 686 |
return nameCode[nodeNr]; |
| 687 |
} |
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
public int getFingerprint(int nodeNr) { |
| 698 |
int nc = nameCode[nodeNr]; |
| 699 |
return nc == -1 ? -1 : nc & NamePool.FP_MASK; |
| 700 |
} |
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
|
| 708 |
|
| 709 |
|
| 710 |
|
| 711 |
public String getPrefix(int nodeNr) { |
| 712 |
int code = nameCode[nodeNr] >> 20; |
| 713 |
if (code <= 0) { |
| 714 |
return code == 0 ? "" : null; |
| 715 |
} |
| 716 |
return prefixPool.getPrefix(code); |
| 717 |
} |
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
|
| 722 |
|
| 723 |
void ensurePriorIndex() { |
| 724 |
if (prior == null || prior.length < numberOfNodes) { |
| 725 |
makePriorIndex(); |
| 726 |
} |
| 727 |
} |
| 728 |
|
| 729 |
private synchronized void makePriorIndex() { |
| 730 |
int[] p = new int[numberOfNodes]; |
| 731 |
Arrays.fill(p, 0, numberOfNodes, -1); |
| 732 |
for (int i = 0; i < numberOfNodes; i++) { |
| 733 |
int nextNode = next[i]; |
| 734 |
if (nextNode > i) { |
| 735 |
p[nextNode] = i; |
| 736 |
} |
| 737 |
} |
| 738 |
prior = p; |
| 739 |
} |
| 740 |
|
| 741 |
|
| 742 |
|
| 743 |
|
| 744 |
|
| 745 |
|
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
|
| 750 |
|
| 751 |
|
| 752 |
|
| 753 |
void addAttribute( NodeInfo root, int parent, int nameCode, SimpleType type, CharSequence attValue, int properties) { |
| 754 |
ensureAttributeCapacity(1); |
| 755 |
attParent[numberOfAttributes] = parent; |
| 756 |
attCode[numberOfAttributes] = nameCode; |
| 757 |
this.attValue[numberOfAttributes] = attValue.toString(); |
| 758 |
|
| 759 |
if (!type.equals(BuiltInAtomicType.UNTYPED_ATOMIC)) { |
| 760 |
initializeAttributeTypeCodes(); |
| 761 |
} |
| 762 |
|
| 763 |
if (attType != null) { |
| 764 |
attType[numberOfAttributes] = type; |
| 765 |
} |
| 766 |
|
| 767 |
if (alpha[parent] == -1) { |
| 768 |
alpha[parent] = numberOfAttributes; |
| 769 |
} |
| 770 |
|
| 771 |
if (root instanceof TinyDocumentImpl) { |
| 772 |
boolean isID = false; |
| 773 |
try { |
| 774 |
if ((properties & ReceiverOptions.IS_ID) != 0) { |
| 775 |
isID = true; |
| 776 |
} else if ((nameCode & NamePool.FP_MASK) == StandardNames.XML_ID) { |
| 777 |
isID = true; |
| 778 |
} else if (type.isIdType()) { |
| 779 |
isID = true; |
| 780 |
} |
| 781 |
} catch (MissingComponentException e) { |
| 782 |
|
| 783 |
} |
| 784 |
if (isID) { |
| 785 |
|
| 786 |
|
| 787 |
|
| 788 |
|
| 789 |
|
| 790 |
String id = Whitespace.trim(attValue); |
| 791 |
|
| 792 |
|
| 793 |
|
| 794 |
this.attValue[numberOfAttributes] = id; |
| 795 |
|
| 796 |
if (NameChecker.isValidNCName(id)) { |
| 797 |
NodeInfo e = getNode(parent); |
| 798 |
registerID(e, id); |
| 799 |
} else if (attType != null) { |
| 800 |
attType[numberOfAttributes] = BuiltInAtomicType.UNTYPED_ATOMIC; |
| 801 |
} |
| 802 |
} |
| 803 |
boolean isIDREF = false; |
| 804 |
try { |
| 805 |
if ((properties & ReceiverOptions.IS_IDREF) != 0) { |
| 806 |
isIDREF = true; |
| 807 |
} else if (type == BuiltInAtomicType.IDREF || type == BuiltInListType.IDREFS) { |
| 808 |
isIDREF = true; |
| 809 |
} else if (type.isIdRefType()) { |
| 810 |
|
| 811 |
|
| 812 |
try { |
| 813 |
AtomicSequence as = type.getTypedValue(attValue, null, getConfiguration().getConversionRules()); |
| 814 |
for (AtomicValue v : as) { |
| 815 |
if (v.getItemType().isIdRefType()) { |
| 816 |
isIDREF = true; |
| 817 |
break; |
| 818 |
} |
| 819 |
} |
| 820 |
} catch (ValidationException ve) { |
| 821 |
|
| 822 |
} |
| 823 |
} |
| 824 |
} catch (MissingComponentException e) { |
| 825 |
|
| 826 |
} |
| 827 |
if (isIDREF) { |
| 828 |
if (idRefAttributes == null) { |
| 829 |
idRefAttributes = new IntHashSet(); |
| 830 |
} |
| 831 |
idRefAttributes.add(numberOfAttributes); |
| 832 |
} |
| 833 |
} |
| 834 |
|
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
|
| 839 |
|
| 840 |
numberOfAttributes++; |
| 841 |
} |
| 842 |
|
| 843 |
private void initializeAttributeTypeCodes() { |
| 844 |
if (attType == null) { |
| 845 |
|
| 846 |
|
| 847 |
attType = new SimpleType[attParent.length]; |
| 848 |
Arrays.fill(attType, 0, numberOfAttributes, BuiltInAtomicType.UNTYPED_ATOMIC); |
| 849 |
|
| 850 |
|
| 851 |
|
| 852 |
} |
| 853 |
} |
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
public void markDefaultedAttribute(int attNr) { |
| 862 |
if (defaultedAttributes == null) { |
| 863 |
defaultedAttributes = new IntHashSet(); |
| 864 |
} |
| 865 |
defaultedAttributes.add(attNr); |
| 866 |
} |
| 867 |
|
| 868 |
|
| 869 |
|
| 870 |
|
| 871 |
|
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
|
| 877 |
|
| 878 |
public boolean isDefaultedAttribute(int attNr) { |
| 879 |
return defaultedAttributes != null && defaultedAttributes.contains(attNr); |
| 880 |
} |
| 881 |
|
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
|
| 887 |
|
| 888 |
|
| 889 |
public void indexIDElement( NodeInfo root, int nodeNr) { |
| 890 |
String id = Whitespace.trim(TinyParentNodeImpl.getStringValueCS(this, nodeNr)); |
| 891 |
if (root.getNodeKind() == Type.DOCUMENT && NameChecker.isValidNCName(id)) { |
| 892 |
NodeInfo e = getNode(nodeNr); |
| 893 |
registerID(e, id); |
| 894 |
} |
| 895 |
} |
| 896 |
|
| 897 |
|
| 898 |
|
| 899 |
|
| 900 |
|
| 901 |
|
| 902 |
|
| 903 |
public boolean hasXmlSpacePreserveAttribute() { |
| 904 |
for (int i = 0; i < numberOfAttributes; i++) { |
| 905 |
if ((attCode[i] & NamePool.FP_MASK) == StandardNames.XML_SPACE && "preserve".equals(attValue[i].toString())) { |
| 906 |
return true; |
| 907 |
} |
| 908 |
} |
| 909 |
return false; |
| 910 |
} |
| 911 |
|
| 912 |
|
| 913 |
|
| 914 |
|
| 915 |
|
| 916 |
|
| 917 |
|
| 918 |
void addNamespace(int parent, NamespaceBinding binding) { |
| 919 |
|
| 920 |
ensureNamespaceCapacity(1); |
| 921 |
namespaceParent[numberOfNamespaces] = parent; |
| 922 |
namespaceBinding[numberOfNamespaces] = binding; |
| 923 |
|
| 924 |
if (beta[parent] == -1) { |
| 925 |
beta[parent] = numberOfNamespaces; |
| 926 |
} |
| 927 |
numberOfNamespaces++; |
| 928 |
if (!binding.isXmlNamespace()) { |
| 929 |
usesNamespaces = true; |
| 930 |
} |
| 931 |
} |
| 932 |
|
| 933 |
|
| 934 |
|
| 935 |
|
| 936 |
|
| 937 |
|
| 938 |
|
| 939 |
|
| 940 |
public final TinyNodeImpl getNode(int nr) { |
| 941 |
switch (nodeKind[nr]) { |
| 942 |
case Type.DOCUMENT: |
| 943 |
return (TinyDocumentImpl) getRootNode(); |
| 944 |
case Type.ELEMENT: |
| 945 |
return new TinyElementImpl(this, nr); |
| 946 |
case Type.TEXTUAL_ELEMENT: |
| 947 |
return new TinyTextualElement(this, nr); |
| 948 |
case Type.EXTERNAL_NODE_REFERENCE: |
| 949 |
return externalNodes.get(alpha[nr]); |
| 950 |
case Type.TEXT: |
| 951 |
return new TinyTextImpl(this, nr); |
| 952 |
case Type.WHITESPACE_TEXT: |
| 953 |
return new WhitespaceTextImpl(this, nr); |
| 954 |
case Type.COMMENT: |
| 955 |
return new TinyCommentImpl(this, nr); |
| 956 |
case Type.PROCESSING_INSTRUCTION: |
| 957 |
return new TinyProcInstImpl(this, nr); |
| 958 |
case Type.PARENT_POINTER: |
| 959 |
throw new IllegalArgumentException("Attempting to treat a parent pointer as a node"); |
| 960 |
case Type.STOPPER: |
| 961 |
throw new IllegalArgumentException("Attempting to treat a stopper entry as a node"); |
| 962 |
default: |
| 963 |
throw new IllegalStateException("Unknown node kind " + nodeKind[nr]); |
| 964 |
} |
| 965 |
} |
| 966 |
|
| 967 |
|
| 968 |
|
| 969 |
|
| 970 |
|
| 971 |
|
| 972 |
|
| 973 |
|
| 974 |
|
| 975 |
|
| 976 |
|
| 977 |
|
| 978 |
|
| 979 |
AtomicValue getAtomizedValueOfUntypedNode(int nodeNr) { |
| 980 |
switch (nodeKind[nodeNr]) { |
| 981 |
case Type.ELEMENT: |
| 982 |
case Type.DOCUMENT: |
| 983 |
int level = depth[nodeNr]; |
| 984 |
int next = nodeNr + 1; |
| 985 |
|
| 986 |
|
| 987 |
|
| 988 |
|
| 989 |
if (depth[next] <= level) { |
| 990 |
return UntypedAtomicValue.ZERO_LENGTH_UNTYPED; |
| 991 |
} else if (nodeKind[next] == Type.TEXT && depth[next + 1] <= level) { |
| 992 |
int length = beta[next]; |
| 993 |
int start = alpha[next]; |
| 994 |
return new UntypedAtomicValue(charBuffer.subSequence(start, start + length)); |
| 995 |
} else if (nodeKind[next] == Type.WHITESPACE_TEXT && depth[next + 1] <= level) { |
| 996 |
return new UntypedAtomicValue(WhitespaceTextImpl.getStringValueCS(this, next)); |
| 997 |
} |
| 998 |
|
| 999 |
|
| 1000 |
|
| 1001 |
FastStringBuffer sb = null; |
| 1002 |
while (next < numberOfNodes && depth[next] > level) { |
| 1003 |
if (nodeKind[next] == Type.TEXT) { |
| 1004 |
if (sb == null) { |
| 1005 |
sb = new FastStringBuffer(FastStringBuffer.C256); |
| 1006 |
} |
| 1007 |
sb.append(TinyTextImpl.getStringValue(this, next)); |
| 1008 |
} else if (nodeKind[next] == Type.WHITESPACE_TEXT) { |
| 1009 |
if (sb == null) { |
| 1010 |
sb = new FastStringBuffer(FastStringBuffer.C256); |
| 1011 |
} |
| 1012 |
WhitespaceTextImpl.appendStringValue(this, next, sb); |
| 1013 |
} |
| 1014 |
next++; |
| 1015 |
} |
| 1016 |
if (sb == null) { |
| 1017 |
return UntypedAtomicValue.ZERO_LENGTH_UNTYPED; |
| 1018 |
} else { |
| 1019 |
return new UntypedAtomicValue(sb.condense()); |
| 1020 |
} |
| 1021 |
|
| 1022 |
case Type.TEXT: |
| 1023 |
return new UntypedAtomicValue(TinyTextImpl.getStringValue(this, nodeNr)); |
| 1024 |
case Type.WHITESPACE_TEXT: |
| 1025 |
return new UntypedAtomicValue(WhitespaceTextImpl.getStringValueCS(this, nodeNr)); |
| 1026 |
case Type.COMMENT: |
| 1027 |
case Type.PROCESSING_INSTRUCTION: |
| 1028 |
int start2 = alpha[nodeNr]; |
| 1029 |
int len2 = beta[nodeNr]; |
| 1030 |
if (len2 == 0) { |
| 1031 |
return UntypedAtomicValue.ZERO_LENGTH_UNTYPED; |
| 1032 |
} |
| 1033 |
char[] dest = new char[len2]; |
| 1034 |
assert commentBuffer != null; |
| 1035 |
commentBuffer.getChars(start2, start2 + len2, dest, 0); |
| 1036 |
return new StringValue(new CharSlice(dest, 0, len2)); |
| 1037 |
default: |
| 1038 |
throw new IllegalStateException("Unknown node kind"); |
| 1039 |
} |
| 1040 |
} |
| 1041 |
|
| 1042 |
|
| 1043 |
|
| 1044 |
|
| 1045 |
|
| 1046 |
|
| 1047 |
|
| 1048 |
|
| 1049 |
TinyAttributeImpl getAttributeNode(int nr) { |
| 1050 |
return new TinyAttributeImpl(this, nr); |
| 1051 |
} |
| 1052 |
|
| 1053 |
|
| 1054 |
|
| 1055 |
|
| 1056 |
|
| 1057 |
|
| 1058 |
|
| 1059 |
|
| 1060 |
int getAttributeAnnotation(int nr) { |
| 1061 |
if (attType == null) { |
| 1062 |
return StandardNames.XS_UNTYPED_ATOMIC; |
| 1063 |
} else { |
| 1064 |
return attType[nr].getFingerprint(); |
| 1065 |
} |
| 1066 |
} |
| 1067 |
|
| 1068 |
|
| 1069 |
|
| 1070 |
|
| 1071 |
|
| 1072 |
|
| 1073 |
|
| 1074 |
|
| 1075 |
SimpleType getAttributeType(int nr) { |
| 1076 |
if (attType == null) { |
| 1077 |
return BuiltInAtomicType.UNTYPED_ATOMIC; |
| 1078 |
} else { |
| 1079 |
return attType[nr]; |
| 1080 |
} |
| 1081 |
} |
| 1082 |
|
| 1083 |
|
| 1084 |
|
| 1085 |
|
| 1086 |
|
| 1087 |
|
| 1088 |
|
| 1089 |
|
| 1090 |
|
| 1091 |
public boolean isIdAttribute(int nr) { |
| 1092 |
try { |
| 1093 |
return attType != null && getAttributeType(nr).isIdType(); |
| 1094 |
} catch (MissingComponentException e) { |
| 1095 |
return false; |
| 1096 |
} |
| 1097 |
} |
| 1098 |
|
| 1099 |
|
| 1100 |
|
| 1101 |
|
| 1102 |
|
| 1103 |
|
| 1104 |
|
| 1105 |
|
| 1106 |
|
| 1107 |
|
| 1108 |
public boolean isIdrefAttribute(int nr) { |
| 1109 |
return idRefAttributes != null && idRefAttributes.contains(nr); |
| 1110 |
} |
| 1111 |
|
| 1112 |
|
| 1113 |
|
| 1114 |
|
| 1115 |
|
| 1116 |
|
| 1117 |
|
| 1118 |
|
| 1119 |
|
| 1120 |
public boolean isIdElement(int nr) { |
| 1121 |
try { |
| 1122 |
return getSchemaType(nr).isIdType() && getTypedValueOfElement(nr).getLength() == 1; |
| 1123 |
} catch (XPathException e) { |
| 1124 |
return false; |
| 1125 |
} |
| 1126 |
} |
| 1127 |
|
| 1128 |
|
| 1129 |
|
| 1130 |
|
| 1131 |
|
| 1132 |
|
| 1133 |
|
| 1134 |
|
| 1135 |
|
| 1136 |
public boolean isIdrefElement(int nr) { |
| 1137 |
SchemaType type = getSchemaType(nr); |
| 1138 |
try { |
| 1139 |
if (type.isIdRefType()) { |
| 1140 |
if (type == BuiltInAtomicType.IDREF || type == BuiltInListType.IDREFS) { |
| 1141 |
return true; |
| 1142 |
} |
| 1143 |
try { |
| 1144 |
for (AtomicValue av : getTypedValueOfElement(nr)) { |
| 1145 |
if (av.getItemType().isIdRefType()) { |
| 1146 |
return true; |
| 1147 |
} |
| 1148 |
} |
| 1149 |
} catch (XPathException err) { |
| 1150 |
|
| 1151 |
} |
| 1152 |
} |
| 1153 |
} catch (MissingComponentException e) { |
| 1154 |
return false; |
| 1155 |
} |
| 1156 |
return false; |
| 1157 |
} |
| 1158 |
|
| 1159 |
|
| 1160 |
|
| 1161 |
|
| 1162 |
|
| 1163 |
|
| 1164 |
|
| 1165 |
|
| 1166 |
|
| 1167 |
|
| 1168 |
void setSystemId(int seq, String uri) { |
| 1169 |
if (uri == null) { |
| 1170 |
uri = ""; |
| 1171 |
} |
| 1172 |
if (systemIdMap == null) { |
| 1173 |
systemIdMap = new SystemIdMap(); |
| 1174 |
} |
| 1175 |
systemIdMap.setSystemId(seq, uri); |
| 1176 |
} |
| 1177 |
|
| 1178 |
|
| 1179 |
|
| 1180 |
|
| 1181 |
|
| 1182 |
|
| 1183 |
|
| 1184 |
|
| 1185 |
|
| 1186 |
|
| 1187 |
public String getSystemId(int seq) { |
| 1188 |
if (systemIdMap == null) { |
| 1189 |
return null; |
| 1190 |
} |
| 1191 |
return systemIdMap.getSystemId(seq); |
| 1192 |
} |
| 1193 |
|
| 1194 |
|
| 1195 |
public NodeInfo getRootNode() { |
| 1196 |
if (getNodeKind(0) == Type.DOCUMENT) { |
| 1197 |
if (root != null) { |
| 1198 |
return root; |
| 1199 |
} else { |
| 1200 |
root = new TinyDocumentImpl(this); |
| 1201 |
return root; |
| 1202 |
} |
| 1203 |
} else { |
| 1204 |
return getNode(0); |
| 1205 |
} |
| 1206 |
} |
| 1207 |
|
| 1208 |
|
| 1209 |
|
| 1210 |
|
| 1211 |
|
| 1212 |
public void setLineNumbering() { |
| 1213 |
lineNumbers = new int[nodeKind.length]; |
| 1214 |
Arrays.fill(lineNumbers, -1); |
| 1215 |
columnNumbers = new int[nodeKind.length]; |
| 1216 |
Arrays.fill(columnNumbers, -1); |
| 1217 |
} |
| 1218 |
|
| 1219 |
|
| 1220 |
|
| 1221 |
|
| 1222 |
|
| 1223 |
|
| 1224 |
|
| 1225 |
|
| 1226 |
|
| 1227 |
void setLineNumber(int sequence, int line, int column) { |
| 1228 |
if (lineNumbers != null) { |
| 1229 |
assert columnNumbers != null; |
| 1230 |
lineNumbers[sequence] = line; |
| 1231 |
columnNumbers[sequence] = column; |
| 1232 |
} |
| 1233 |
} |
| 1234 |
|
| 1235 |
|
| 1236 |
|
| 1237 |
|
| 1238 |
|
| 1239 |
|
| 1240 |
|
| 1241 |
|
| 1242 |
public int getLineNumber(int sequence) { |
| 1243 |
if (lineNumbers != null) { |
| 1244 |
|
| 1245 |
for (int i = sequence; i >= 0; i--) { |
| 1246 |
int c = lineNumbers[i]; |
| 1247 |
if (c > 0) { |
| 1248 |
return c; |
| 1249 |
} |
| 1250 |
} |
| 1251 |
} |
| 1252 |
return -1; |
| 1253 |
} |
| 1254 |
|
| 1255 |
|
| 1256 |
|
| 1257 |
|
| 1258 |
|
| 1259 |
|
| 1260 |
|
| 1261 |
|
| 1262 |
public int getColumnNumber(int sequence) { |
| 1263 |
if (columnNumbers != null) { |
| 1264 |
|
| 1265 |
for (int i = sequence; i >= 0; i--) { |
| 1266 |
int c = columnNumbers[i]; |
| 1267 |
if (c > 0) { |
| 1268 |
return c; |
| 1269 |
} |
| 1270 |
} |
| 1271 |
} |
| 1272 |
return -1; |
| 1273 |
} |
| 1274 |
|
| 1275 |
|
| 1276 |
|
| 1277 |
|
| 1278 |
|
| 1279 |
|
| 1280 |
|
| 1281 |
public void setNilled(int nodeNr) { |
| 1282 |
if (nilledElements == null) { |
| 1283 |
nilledElements = new IntHashSet(); |
| 1284 |
} |
| 1285 |
nilledElements.add(nodeNr); |
| 1286 |
} |
| 1287 |
|
| 1288 |
|
| 1289 |
|
| 1290 |
|
| 1291 |
|
| 1292 |
|
| 1293 |
|
| 1294 |
|
| 1295 |
public boolean isNilled(int nodeNr) { |
| 1296 |
return nilledElements != null && nilledElements.contains(nodeNr); |
| 1297 |
} |
| 1298 |
|
| 1299 |
|
| 1300 |
|
| 1301 |
|
| 1302 |
|
| 1303 |
|
| 1304 |
|
| 1305 |
|
| 1306 |
|
| 1307 |
void registerID(NodeInfo e, String id) { |
| 1308 |
if (idTable == null) { |
| 1309 |
idTable = new HashMap<>(256); |
| 1310 |
} |
| 1311 |
|
| 1312 |
|
| 1313 |
idTable.putIfAbsent(id, e); |
| 1314 |
|
| 1315 |
} |
| 1316 |
|
| 1317 |
|
| 1318 |
|
| 1319 |
|
| 1320 |
|
| 1321 |
|
| 1322 |
|
| 1323 |
|
| 1324 |
|
| 1325 |
|
| 1326 |
|
| 1327 |
public NodeInfo selectID(String id, boolean getParent) { |
| 1328 |
if (idTable == null) { |
| 1329 |
return null; |
| 1330 |
} |
| 1331 |
NodeInfo node = idTable.get(id); |
| 1332 |
if (node != null && getParent && node.isId() && node.getStringValue().equals(id)) { |
| 1333 |
node = node.getParent(); |
| 1334 |
} |
| 1335 |
return node; |
| 1336 |
} |
| 1337 |
|
| 1338 |
|
| 1339 |
|
| 1340 |
|
| 1341 |
|
| 1342 |
|
| 1343 |
|
| 1344 |
|
| 1345 |
|
| 1346 |
|
| 1347 |
|
| 1348 |
void setUnparsedEntity(String name, String uri, String publicId) { |
| 1349 |
if (entityTable == null) { |
| 1350 |
entityTable = new HashMap<>(20); |
| 1351 |
} |
| 1352 |
String[] ids = new String[2]; |
| 1353 |
ids[0] = uri; |
| 1354 |
ids[1] = publicId; |
| 1355 |
entityTable.put(name, ids); |
| 1356 |
} |
| 1357 |
|
| 1358 |
|
| 1359 |
|
| 1360 |
|
| 1361 |
|
| 1362 |
|
| 1363 |
|
| 1364 |
|
| 1365 |
|
| 1366 |
public Iterator<String> getUnparsedEntityNames() { |
| 1367 |
if (entityTable == null) { |
| 1368 |
List<String> emptyList = Collections.emptyList(); |
| 1369 |
return emptyList.iterator(); |
| 1370 |
} else { |
| 1371 |
return entityTable.keySet().iterator(); |
| 1372 |
} |
| 1373 |
} |
| 1374 |
|
| 1375 |
|
| 1376 |
|
| 1377 |
|
| 1378 |
|
| 1379 |
|
| 1380 |
|
| 1381 |
|
| 1382 |
|
| 1383 |
|
| 1384 |
|
| 1385 |
public String[] getUnparsedEntity(String name) { |
| 1386 |
if (entityTable == null) { |
| 1387 |
return null; |
| 1388 |
} |
| 1389 |
return entityTable.get(name); |
| 1390 |
} |
| 1391 |
|
| 1392 |
public NamePool getNamePool() { |
| 1393 |
return getConfiguration().getNamePool(); |
| 1394 |
} |
| 1395 |
|
| 1396 |
public void markTopWithinEntity(int nodeNr) { |
| 1397 |
if (topWithinEntity == null) { |
| 1398 |
topWithinEntity = new IntHashSet(); |
| 1399 |
} |
| 1400 |
topWithinEntity.add(nodeNr); |
| 1401 |
} |
| 1402 |
|
| 1403 |
public boolean isTopWithinEntity(int nodeNr) { |
| 1404 |
return topWithinEntity != null && topWithinEntity.contains(nodeNr); |
| 1405 |
} |
| 1406 |
|
| 1407 |
|
| 1408 |
|
| 1409 |
|
| 1410 |
|
| 1411 |
|
| 1412 |
@SuppressWarnings("UseOfSystemOutOrSystemErr") |
| 1413 |
public void diagnosticDump() { |
| 1414 |
NamePool pool = getNamePool(); |
| 1415 |
System.err.println(" node kind depth next alpha beta name type"); |
| 1416 |
for (int i = 0; i < numberOfNodes; i++) { |
| 1417 |
String eqName = ""; |
| 1418 |
if (nameCode[i] != -1) { |
| 1419 |
try { |
| 1420 |
eqName = pool.getEQName(nameCode[i]); |
| 1421 |
} catch (Exception err) { |
| 1422 |
eqName = "#" + nameCode[1]; |
| 1423 |
} |
| 1424 |
} |
| 1425 |
System.err.println(n8(i) + n8(nodeKind[i]) + n8(depth[i]) + n8(next[i]) + |
| 1426 |
n8(alpha[i]) + n8(beta[i]) + n8(nameCode[i]) + |
| 1427 |
n8(getTypeAnnotation(i)) + " " + eqName); |
| 1428 |
} |
| 1429 |
System.err.println(" attr parent name value"); |
| 1430 |
for (int i = 0; i < numberOfAttributes; i++) { |
| 1431 |
System.err.println(n8(i) + n8(attParent[i]) + n8(attCode[i]) + " " + attValue[i]); |
| 1432 |
} |
| 1433 |
System.err.println(" ns parent prefix uri"); |
| 1434 |
for (int i = 0; i < numberOfNamespaces; i++) { |
| 1435 |
System.err.println(n8(i) + n8(namespaceParent[i]) + namespaceBinding[i].getPrefix() + "=" + namespaceBinding[i].getURI()); |
| 1436 |
} |
| 1437 |
} |
| 1438 |
|
| 1439 |
|
| 1440 |
|
| 1441 |
|
| 1442 |
|
| 1443 |
|
| 1444 |
|
| 1445 |
|
| 1446 |
public static synchronized void diagnosticDump( NodeInfo node) { |
| 1447 |
if (node instanceof TinyNodeImpl) { |
| 1448 |
TinyTree tree = ((TinyNodeImpl) node).tree; |
| 1449 |
System.err.println("Tree containing node " + ((TinyNodeImpl) node).nodeNr); |
| 1450 |
tree.diagnosticDump(); |
| 1451 |
} else { |
| 1452 |
System.err.println("Node is not in a TinyTree"); |
| 1453 |
} |
| 1454 |
} |
| 1455 |
|
| 1456 |
|
| 1457 |
|
| 1458 |
|
| 1459 |
|
| 1460 |
|
| 1461 |
|
| 1462 |
|
| 1463 |
private static String n8(int val) { |
| 1464 |
String s = " " + val; |
| 1465 |
return s.substring(s.length() - 8); |
| 1466 |
} |
| 1467 |
|
| 1468 |
|
| 1469 |
|
| 1470 |
|
| 1471 |
|
| 1472 |
public void showSize() { |
| 1473 |
System.err.println("Tree size: " + numberOfNodes + " nodes, " + charBuffer.length() + " characters, " + |
| 1474 |
numberOfAttributes + " attributes"); |
| 1475 |
} |
| 1476 |
|
| 1477 |
|
| 1478 |
|
| 1479 |
|
| 1480 |
|
| 1481 |
|
| 1482 |
|
| 1483 |
public boolean isTyped() { |
| 1484 |
return typeArray != null; |
| 1485 |
} |
| 1486 |
|
| 1487 |
|
| 1488 |
|
| 1489 |
|
| 1490 |
|
| 1491 |
|
| 1492 |
|
| 1493 |
public int getNumberOfNodes() { |
| 1494 |
return numberOfNodes; |
| 1495 |
} |
| 1496 |
|
| 1497 |
|
| 1498 |
|
| 1499 |
|
| 1500 |
|
| 1501 |
|
| 1502 |
|
| 1503 |
public int getNumberOfAttributes() { |
| 1504 |
return numberOfAttributes; |
| 1505 |
} |
| 1506 |
|
| 1507 |
|
| 1508 |
|
| 1509 |
|
| 1510 |
|
| 1511 |
|
| 1512 |
|
| 1513 |
public int getNumberOfNamespaces() { |
| 1514 |
return numberOfNamespaces; |
| 1515 |
} |
| 1516 |
|
| 1517 |
|
| 1518 |
|
| 1519 |
|
| 1520 |
|
| 1521 |
|
| 1522 |
|
| 1523 |
public byte[] getNodeKindArray() { |
| 1524 |
return nodeKind; |
| 1525 |
} |
| 1526 |
|
| 1527 |
|
| 1528 |
|
| 1529 |
|
| 1530 |
|
| 1531 |
|
| 1532 |
|
| 1533 |
public short[] getNodeDepthArray() { |
| 1534 |
return depth; |
| 1535 |
} |
| 1536 |
|
| 1537 |
|
| 1538 |
|
| 1539 |
|
| 1540 |
|
| 1541 |
|
| 1542 |
|
| 1543 |
public int[] getNameCodeArray() { |
| 1544 |
return nameCode; |
| 1545 |
} |
| 1546 |
|
| 1547 |
|
| 1548 |
|
| 1549 |
|
| 1550 |
|
| 1551 |
|
| 1552 |
|
| 1553 |
|
| 1554 |
public SchemaType[] getTypeArray() { |
| 1555 |
return typeArray; |
| 1556 |
} |
| 1557 |
|
| 1558 |
|
| 1559 |
|
| 1560 |
|
| 1561 |
|
| 1562 |
|
| 1563 |
|
| 1564 |
public int[] getNextPointerArray() { |
| 1565 |
return next; |
| 1566 |
} |
| 1567 |
|
| 1568 |
|
| 1569 |
|
| 1570 |
|
| 1571 |
|
| 1572 |
|
| 1573 |
|
| 1574 |
|
| 1575 |
public int[] getAlphaArray() { |
| 1576 |
return alpha; |
| 1577 |
} |
| 1578 |
|
| 1579 |
|
| 1580 |
|
| 1581 |
|
| 1582 |
|
| 1583 |
|
| 1584 |
|
| 1585 |
|
| 1586 |
public int[] getBetaArray() { |
| 1587 |
return beta; |
| 1588 |
} |
| 1589 |
|
| 1590 |
|
| 1591 |
|
| 1592 |
|
| 1593 |
|
| 1594 |
|
| 1595 |
|
| 1596 |
public AppendableCharSequence getCharacterBuffer() { |
| 1597 |
|
| 1598 |
return charBuffer; |
| 1599 |
} |
| 1600 |
|
| 1601 |
|
| 1602 |
|
| 1603 |
|
| 1604 |
|
| 1605 |
|
| 1606 |
|
| 1607 |
|
| 1608 |
public CharSequence getCommentBuffer() { |
| 1609 |
return commentBuffer; |
| 1610 |
} |
| 1611 |
|
| 1612 |
|
| 1613 |
|
| 1614 |
|
| 1615 |
|
| 1616 |
|
| 1617 |
|
| 1618 |
public int[] getAttributeNameCodeArray() { |
| 1619 |
return attCode; |
| 1620 |
} |
| 1621 |
|
| 1622 |
|
| 1623 |
|
| 1624 |
|
| 1625 |
|
| 1626 |
|
| 1627 |
|
| 1628 |
|
| 1629 |
public SimpleType[] getAttributeTypeArray() { |
| 1630 |
return attType; |
| 1631 |
} |
| 1632 |
|
| 1633 |
|
| 1634 |
|
| 1635 |
|
| 1636 |
|
| 1637 |
|
| 1638 |
|
| 1639 |
public int[] getAttributeParentArray() { |
| 1640 |
return attParent; |
| 1641 |
} |
| 1642 |
|
| 1643 |
|
| 1644 |
|
| 1645 |
|
| 1646 |
|
| 1647 |
|
| 1648 |
|
| 1649 |
public CharSequence[] getAttributeValueArray() { |
| 1650 |
return attValue; |
| 1651 |
} |
| 1652 |
|
| 1653 |
|
| 1654 |
|
| 1655 |
|
| 1656 |
|
| 1657 |
|
| 1658 |
|
| 1659 |
public NamespaceBinding[] getNamespaceBindings() { |
| 1660 |
return namespaceBinding; |
| 1661 |
} |
| 1662 |
|
| 1663 |
|
| 1664 |
|
| 1665 |
|
| 1666 |
|
| 1667 |
|
| 1668 |
|
| 1669 |
public int[] getNamespaceParentArray() { |
| 1670 |
return namespaceParent; |
| 1671 |
} |
| 1672 |
|
| 1673 |
|
| 1674 |
|
| 1675 |
|
| 1676 |
|
| 1677 |
|
| 1678 |
|
| 1679 |
|
| 1680 |
public boolean isUsesNamespaces() { |
| 1681 |
return usesNamespaces; |
| 1682 |
} |
| 1683 |
|
| 1684 |
|
| 1685 |
|
| 1686 |
|
| 1687 |
|
| 1688 |
|
| 1689 |
|
| 1690 |
|
| 1691 |
|
| 1692 |
|
| 1693 |
public void bulkCopy(TinyTree source, int nodeNr, int[] prevAtDepth, int currentDepth) { |
| 1694 |
|
| 1695 |
int end = source.next[nodeNr]; |
| 1696 |
while (end < nodeNr && end >= 0) { |
| 1697 |
end = source.next[end]; |
| 1698 |
} |
| 1699 |
if (end == -1) { |
| 1700 |
end = source.numberOfNodes; |
| 1701 |
if (end - 1 < source.nodeKind.length && source.nodeKind[end - 1] == Type.STOPPER) { |
| 1702 |
end--; |
| 1703 |
} |
| 1704 |
} |
| 1705 |
int length = end - nodeNr; |
| 1706 |
assert length > 0; |
| 1707 |
ensureNodeCapacity(Type.ELEMENT, length); |
| 1708 |
System.arraycopy(source.nodeKind, nodeNr, nodeKind, numberOfNodes, length); |
| 1709 |
int depthDiff = currentDepth - source.depth[nodeNr]; |
| 1710 |
for (int i = 0; i < length; i++) { |
| 1711 |
int from = nodeNr + i; |
| 1712 |
int to = numberOfNodes + i; |
| 1713 |
depth[to] = (short) (source.depth[from] + depthDiff); |
| 1714 |
next[to] = source.next[from] + (to - from); |
| 1715 |
switch (source.nodeKind[from]) { |
| 1716 |
case Type.ELEMENT: { |
| 1717 |
nameCode[to] = (source.nameCode[from] & NamePool.FP_MASK) | |
| 1718 |
(prefixPool.obtainPrefixCode(source.getPrefix(from)) << 20); |
| 1719 |
int firstAtt = source.alpha[from]; |
| 1720 |
if (firstAtt >= 0) { |
| 1721 |
int lastAtt = firstAtt; |
| 1722 |
while (lastAtt < source.numberOfAttributes && source.attParent[lastAtt] == from) { |
| 1723 |
lastAtt++; |
| 1724 |
} |
| 1725 |
int atts = lastAtt - firstAtt; |
| 1726 |
ensureAttributeCapacity(atts); |
| 1727 |
int aFrom = firstAtt; |
| 1728 |
int aTo = numberOfAttributes; |
| 1729 |
alpha[to] = aTo; |
| 1730 |
System.arraycopy(source.attValue, firstAtt, attValue, aTo, atts); |
| 1731 |
Arrays.fill(attParent, aTo, aTo + atts, to); |
| 1732 |
for (int a = 0; a < atts; a++, aFrom++, aTo++) { |
| 1733 |
int attNameCode = attCode[aTo] = source.attCode[aFrom]; |
| 1734 |
if (NamePool.isPrefixed(attNameCode)) { |
| 1735 |
String prefix = source.prefixPool.getPrefix(attNameCode >> 20); |
| 1736 |
attCode[aTo] = (attNameCode & 0xfffff) | (prefixPool.obtainPrefixCode(prefix) << 20); |
| 1737 |
} else { |
| 1738 |
attCode[aTo] = attNameCode; |
| 1739 |
} |
| 1740 |
if (source.isIdAttribute(aFrom)) { |
| 1741 |
registerID(getNode(to), source.attValue[aFrom].toString()); |
| 1742 |
} |
| 1743 |
if (source.isIdrefAttribute(aFrom)) { |
| 1744 |
if (idRefAttributes == null) { |
| 1745 |
idRefAttributes = new IntHashSet(); |
| 1746 |
} |
| 1747 |
idRefAttributes.add(aTo); |
| 1748 |
} |
| 1749 |
} |
| 1750 |
numberOfAttributes += atts; |
| 1751 |
} else { |
| 1752 |
alpha[to] = -1; |
| 1753 |
} |
| 1754 |
|
| 1755 |
|
| 1756 |
|
| 1757 |
|
| 1758 |
|
| 1759 |
if (i == 0) { |
| 1760 |
boolean foundDefaultNamespace = false; |
| 1761 |
Map<String, String> targetNamespaces = inScopeNamespaces(this, to, prevAtDepth, currentDepth); |
| 1762 |
List<NamespaceBinding> newNamespaces = new ArrayList<>(); |
| 1763 |
NamespaceBinding[] sourceBindings = source.namespaceBinding; |
| 1764 |
int anc = from; |
| 1765 |
while (anc != -1 && source.nodeKind[anc] == Type.ELEMENT) { |
| 1766 |
int sourceNS = source.beta[anc]; |
| 1767 |
while (sourceNS > 0 && sourceNS < source.numberOfNamespaces && source.namespaceParent[sourceNS] == anc) { |
| 1768 |
NamespaceBinding nb = sourceBindings[sourceNS]; |
| 1769 |
String prefix = nb.getPrefix(); |
| 1770 |
if (prefix.isEmpty()) { |
| 1771 |
foundDefaultNamespace = true; |
| 1772 |
} |
| 1773 |
String existing = targetNamespaces.get(prefix); |
| 1774 |
if (existing == null || !existing.equals(prefix)) { |
| 1775 |
newNamespaces.add(nb); |
| 1776 |
} |
| 1777 |
sourceNS++; |
| 1778 |
} |
| 1779 |
anc = TinyNodeImpl.getParentNodeNr(source, anc); |
| 1780 |
} |
| 1781 |
if (!foundDefaultNamespace && targetNamespaces.get("") != null) { |
| 1782 |
newNamespaces.add(NamespaceBinding.DEFAULT_UNDECLARATION); |
| 1783 |
} |
| 1784 |
|
| 1785 |
int nTo = numberOfNamespaces; |
| 1786 |
ensureNamespaceCapacity(newNamespaces.size()); |
| 1787 |
beta[to] = nTo; |
| 1788 |
for (NamespaceBinding nb : newNamespaces) { |
| 1789 |
namespaceBinding[nTo++] = nb; |
| 1790 |
} |
| 1791 |
Arrays.fill(namespaceParent, numberOfNamespaces, nTo, to); |
| 1792 |
numberOfNamespaces = nTo; |
| 1793 |
|
| 1794 |
} else { |
| 1795 |
int firstNS = source.beta[from]; |
| 1796 |
if (firstNS >= 0) { |
| 1797 |
int lastNS = firstNS; |
| 1798 |
while (lastNS < source.numberOfNamespaces && source.namespaceParent[lastNS] == from) { |
| 1799 |
lastNS++; |
| 1800 |
} |
| 1801 |
int nrOfNamespaces = lastNS - firstNS; |
| 1802 |
ensureNamespaceCapacity(nrOfNamespaces); |
| 1803 |
int nTo = numberOfNamespaces; |
| 1804 |
beta[to] = nTo; |
| 1805 |
System.arraycopy(source.namespaceBinding, firstNS, namespaceBinding, nTo, nrOfNamespaces); |
| 1806 |
Arrays.fill(namespaceParent, nTo, nTo + nrOfNamespaces, to); |
| 1807 |
numberOfNamespaces += nrOfNamespaces; |
| 1808 |
} else { |
| 1809 |
beta[to] = -1; |
| 1810 |
} |
| 1811 |
} |
| 1812 |
break; |
| 1813 |
} |
| 1814 |
case Type.TEXTUAL_ELEMENT: { |
| 1815 |
int start = source.alpha[from]; |
| 1816 |
int len = source.beta[from]; |
| 1817 |
nameCode[to] = (source.nameCode[from] & NamePool.FP_MASK) | |
| 1818 |
(prefixPool.obtainPrefixCode(source.getPrefix(from)) << 20); |
| 1819 |
alpha[to] = charBuffer.length(); |
| 1820 |
appendChars(source.charBuffer.subSequence(start, start + len)); |
| 1821 |
beta[to] = len; |
| 1822 |
break; |
| 1823 |
} |
| 1824 |
case Type.TEXT: { |
| 1825 |
int start = source.alpha[from]; |
| 1826 |
int len = source.beta[from]; |
| 1827 |
nameCode[to] = -1; |
| 1828 |
alpha[to] = charBuffer.length(); |
| 1829 |
appendChars(source.charBuffer.subSequence(start, start + len)); |
| 1830 |
beta[to] = len; |
| 1831 |
break; |
| 1832 |
} |
| 1833 |
case Type.WHITESPACE_TEXT: { |
| 1834 |
nameCode[to] = -1; |
| 1835 |
alpha[to] = source.alpha[from]; |
| 1836 |
beta[to] = source.beta[from]; |
| 1837 |
break; |
| 1838 |
} |
| 1839 |
case Type.COMMENT: { |
| 1840 |
int start = source.alpha[from]; |
| 1841 |
int len = source.beta[from]; |
| 1842 |
nameCode[to] = -1; |
| 1843 |
CharSequence text = source.commentBuffer.subSequence(start, start + len); |
| 1844 |
if (commentBuffer == null) { |
| 1845 |
commentBuffer = new FastStringBuffer(FastStringBuffer.C256); |
| 1846 |
} |
| 1847 |
alpha[to] = commentBuffer.length(); |
| 1848 |
commentBuffer.append(text); |
| 1849 |
beta[to] = len; |
| 1850 |
break; |
| 1851 |
} |
| 1852 |
case Type.PROCESSING_INSTRUCTION: |
| 1853 |
int start = source.alpha[from]; |
| 1854 |
int len = source.beta[from]; |
| 1855 |
nameCode[to] = source.nameCode[from]; |
| 1856 |
CharSequence text = source.commentBuffer.subSequence(start, start + len); |
| 1857 |
if (commentBuffer == null) { |
| 1858 |
commentBuffer = new FastStringBuffer(FastStringBuffer.C256); |
| 1859 |
} |
| 1860 |
alpha[to] = commentBuffer.length(); |
| 1861 |
commentBuffer.append(text); |
| 1862 |
beta[to] = len; |
| 1863 |
break; |
| 1864 |
|
| 1865 |
case Type.PARENT_POINTER: |
| 1866 |
nameCode[to] = -1; |
| 1867 |
alpha[to] = source.alpha[from] + (to - from); |
| 1868 |
beta[to] = -1; |
| 1869 |
break; |
| 1870 |
default: |
| 1871 |
break; |
| 1872 |
} |
| 1873 |
} |
| 1874 |
numberOfNodes += length; |
| 1875 |
} |
| 1876 |
|
| 1877 |
|
| 1878 |
|
| 1879 |
|
| 1880 |
|
| 1881 |
|
| 1882 |
|
| 1883 |
|
| 1884 |
|
| 1885 |
|
| 1886 |
|
| 1887 |
private static Map<String, String> inScopeNamespaces(TinyTree tree, int nodeNr, int[] prevAtDepth, int currentDepth) { |
| 1888 |
assert tree.nodeKind[nodeNr] == Type.ELEMENT; |
| 1889 |
Map<String, String> result = new HashMap<>(); |
| 1890 |
int depth = currentDepth - 1; |
| 1891 |
while (depth >= 0) { |
| 1892 |
int parent = prevAtDepth[depth]; |
| 1893 |
if (parent >= 0 && tree.nodeKind[parent] == Type.ELEMENT) { |
| 1894 |
int ns = tree.beta[parent]; |
| 1895 |
if (ns >= 0) { |
| 1896 |
while (ns < tree.numberOfNamespaces && tree.namespaceParent[ns] == parent) { |
| 1897 |
NamespaceBinding sourceNs = tree.namespaceBinding[ns]; |
| 1898 |
String prefix = sourceNs.getPrefix(); |
| 1899 |
result.computeIfAbsent(prefix, k -> sourceNs.getURI()); |
| 1900 |
ns++; |
| 1901 |
} |
| 1902 |
} |
| 1903 |
} |
| 1904 |
depth--; |
| 1905 |
} |
| 1906 |
return result; |
| 1907 |
} |
| 1908 |
|
| 1909 |
|
| 1910 |
|
| 1911 |
|
| 1912 |
public void graft(NodeInfo externalNode, int nodeNr, int depth, boolean copyNamespaces) { |
| 1913 |
assert externalNode.getNodeKind() == Type.ELEMENT; |
| 1914 |
if (externalNodes == null) { |
| 1915 |
externalNodes = new ArrayList<>(); |
| 1916 |
} |
| 1917 |
int externalNodeNr = externalNodes.size(); |
| 1918 |
int fp = getNamePool().allocateFingerprint(externalNode.getURI(), externalNode.getLocalPart()); |
| 1919 |
int prefixCode = prefixPool.obtainPrefixCode(externalNode.getPrefix()); |
| 1920 |
int nameCode = (prefixCode << 20) | fp; |
| 1921 |
addNode(Type.EXTERNAL_NODE_REFERENCE, depth, externalNodeNr, -1, nameCode); |
| 1922 |
externalNodes.add(new GraftedElement(this, nodeNr, externalNode, copyNamespaces)); |
| 1923 |
|
| 1924 |
} |
| 1925 |
|
| 1926 |
|
| 1927 |
|
| 1928 |
|
| 1929 |
|
| 1930 |
|
| 1931 |
public boolean containsGraftedSubtrees() { |
| 1932 |
return externalNodes != null; |
| 1933 |
} |
| 1934 |
|
| 1935 |
} |
| 1936 |
|