Example usage for org.jdom2 EntityRef getName

List of usage examples for org.jdom2 EntityRef getName

Introduction

In this page you can find the example usage for org.jdom2 EntityRef getName.

Prototype

public String getName() 

Source Link

Document

This returns the name of the EntityRef.

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  va2s  . co 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());
}