예제 #1
0
파일: Data.java 프로젝트: JosuaKrause/basex
  /**
   * Updates (renames) an element, attribute or pi name.
   *
   * @param pre pre value
   * @param kind node kind
   * @param name new tag, attribute or pi name
   * @param uri uri
   */
  public final void update(final int pre, final int kind, final byte[] name, final byte[] uri) {

    meta.update();

    if (kind == PI) {
      updateText(pre, trim(concat(name, SPACE, atom(pre))), kind);
    } else {
      // update/set namespace reference
      final int ouri = nspaces.uri(name, pre, this);
      final boolean ne = ouri == 0 && uri.length != 0;
      final int npre = kind == ATTR ? parent(pre, kind) : pre;
      final int nuri =
          ne
              ? nspaces.add(npre, npre, prefix(name), uri, this)
              : ouri != 0 && eq(nspaces.uri(ouri), uri) ? ouri : 0;

      // write namespace uri reference
      table.write1(pre, kind == ELEM ? 3 : 11, nuri);
      // write name reference
      table.write2(
          pre,
          1,
          (nsFlag(pre) ? 1 << 15 : 0)
              | (kind == ELEM ? tagindex : atnindex).index(name, null, false));
      // write namespace flag
      table.write2(npre, 1, (ne || nsFlag(npre) ? 1 << 15 : 0) | name(npre));
    }
  }
예제 #2
0
파일: Data.java 프로젝트: JosuaKrause/basex
 /**
  * Sets the namespace flag. Should be only called for element nodes.
  *
  * @param pre pre value
  * @param ne namespace flag
  */
 public final void nsFlag(final int pre, final boolean ne) {
   table.write1(pre, 1, table.read1(pre, 1) & 0x7F | (ne ? 0x80 : 0));
 }
예제 #3
0
파일: Data.java 프로젝트: JosuaKrause/basex
 /**
  * Sets the attribute size.
  *
  * @param pre pre value
  * @param kind node kind
  * @param value value
  */
 private void attSize(final int pre, final int kind, final int value) {
   if (kind == ELEM) table.write1(pre, 0, value << 3 | ELEM);
 }
예제 #4
0
파일: Data.java 프로젝트: JosuaKrause/basex
 /**
  * Sets the distance.
  *
  * @param pre pre value
  * @param kind node kind
  * @param value value
  */
 public void dist(final int pre, final int kind, final int value) {
   if (kind == ATTR) table.write1(pre, 0, value << 3 | ATTR);
   else if (kind != DOC) table.write4(pre, kind == ELEM ? 4 : 8, value);
 }