Package nu.xom

Examples of nu.xom.Text


  }
 
  // try to avoid XML reverification by caching repetitive Texts
  private Text readText(ArrayByteList src, int type) {
    int i = readSymbol(src, 4, type);
    Text text;
    if (i < textCache.length) {
      text = textCache[i];
      if (text != null) return new Text(text);
    }
    text = new Text(symbols[i]);
    if (i < textCache.length) textCache[i] = text;
    return text;
  }
View Full Code Here


    }
    return Attribute.Type.UNDECLARED;
  }
 
  private Text readText() {
    return new Text(reader.getText());
  }
View Full Code Here

        break;
      case Type.DOCUMENT:
        value = convertDocumentNodeInfo(node);
        break;
      case Type.TEXT:
        value = new Text(node.getStringValue());
        break;
      case Type.COMMENT:
        value = new Comment(node.getStringValue());
        break;
      case Type.PROCESSING_INSTRUCTION:
View Full Code Here

        log("", new ProcessingInstruction(target, data));
        return child.makeProcessingInstruction(target, data);
      }
     
      public Nodes makeText(String text) {
        log("", new Text(text));
        return child.makeText(text);
      }
 
      public Element makeRootElement(String name, String namespace) {
        log("startRoot", new Element(name, namespace));
View Full Code Here

      }
     
      public Nodes makeText(String text) {
        flush();
        try {
          serializer.write(new Text(text));
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
        return NONE;
      }
View Full Code Here

      while (k >= i) node.removeChild(k--);
     
      // replace run with compact merged Text node unless empty
      String norm = normalizeWhitespace(buf.toString());
      if (norm.length() > 0) {
        node.insertChild(new Text(norm), i);
     
    }
View Full Code Here

  /** Converts saxon's atomic value to XOM. */
  private Node convertAtomicValue(AtomicValue value) {
    if (DEBUG) System.err.println("atomicValue.getClass="+value.getClass().getName());
    Element elem = new Element(ATOMIC_VALUE)// copy to avoid reverification
    elem.getAttribute(0).setValue(getItemType(value)); // e.g. "xs:integer"
    Text text = ((Text)elem.getChild(0));
    text.setValue(value.getStringValue()); // e.g. "123"
    return elem;
  }
View Full Code Here

    public void testEmptyTextNodesDontCount() {
       
        Element parent = new Element("Test");
        Element child1 = new Element("child1");
        parent.appendChild(child1);
        parent.appendChild(new Text(""));
        parent.appendChild(new Text(""));
        Element child2 = new Element("child2");
        parent.appendChild(child2);
       
        Nodes result = parent.query("*");
        assertEquals(2, result.size());
View Full Code Here

   

    public void testEmptyTextNodesDontCount2() {
       
        Element parent = new Element("Test");
        parent.appendChild(new Text(""));
        Element child1 = new Element("child1");
        parent.appendChild(child1);
        Element child2 = new Element("child2");
        parent.appendChild(child2);
       
View Full Code Here

        Element parent = new Element("Test");
        Element child1 = new Element("child1");
        parent.appendChild(child1);
        Element child2 = new Element("child2");
        parent.appendChild(child2);
        parent.appendChild(new Text(""));
        parent.appendChild(new Text(""));
        parent.appendChild(new Text(""));
       
        Nodes result = parent.query("node()");
        assertEquals(2, result.size());
        assertEquals(child1, result.get(0));  
        assertEquals(child2, result.get(1));  
View Full Code Here

TOP

Related Classes of nu.xom.Text

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.