Example usage for org.jdom2 ProcessingInstruction getData

List of usage examples for org.jdom2 ProcessingInstruction getData

Introduction

In this page you can find the example usage for org.jdom2 ProcessingInstruction getData.

Prototype

public String getData() 

Source Link

Document

This will return the raw data from all instructions.

Usage

From source file:org.rascalmpl.library.lang.xml.DOM.java

License:Open Source License

private IConstructor convertContent(Content content, boolean trim) throws Skip {
    if (content instanceof Element) {
        return convertElement((Element) content, trim);
    }//  w w  w . j  a  va  2s  . c  o  m
    if (content instanceof CDATA) { // CDATA first (is subtype of Text)
        CDATA cdata = (CDATA) content;
        return vf.constructor(Factory.Node_cdata, getString(trim, cdata));
    }
    if (content instanceof Text) {
        Text text = (Text) content;
        return vf.constructor(Factory.Node_charData, getString(trim, text));
    }
    if (content instanceof Comment) {
        Comment comment = (Comment) content;
        IString data = vf.string(comment.getText());
        return vf.constructor(Factory.Node_comment, data);
    }
    if (content instanceof ProcessingInstruction) {
        ProcessingInstruction pi = (ProcessingInstruction) content;
        IString data = vf.string(pi.getData());
        return vf.constructor(Factory.Node_pi, data);
    }
    if (content instanceof EntityRef) {
        EntityRef er = (EntityRef) content;
        IString data = vf.string(er.getName());
        return vf.constructor(Factory.Node_entityRef, data);
    }
    throw new AssertionError("cannot convert JDOM content type " + content.getClass());
}