Example usage for org.w3c.dom CDATASection getLength

List of usage examples for org.w3c.dom CDATASection getLength

Introduction

In this page you can find the example usage for org.w3c.dom CDATASection getLength.

Prototype

public int getLength();

Source Link

Document

The number of 16-bit units that are available through data and the substringData method below.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

    InputSource is = new InputSource();
    is.setCharacterStream(new StringReader(xmlRecords));

    Document doc = factory.newDocumentBuilder().parse(is);

    CDATASection cdataNode = doc.createCDATASection("");

    CharacterData cdata = cdataNode;

    cdata.appendData("from java2s.com");
    System.out.println(cdataNode.getLength());
}

From source file:TreeDumper2.java

private void dumpCDATASectionNode(CDATASection node, String indent) {
    System.out.println(indent + "CDATA SECTION length=" + node.getLength());
    System.out.println(indent + "\"" + node.getData() + "\"");
}