List of usage examples for org.jdom2 EntityRef EntityRef
public EntityRef(String name)
EntityRef
with the supplied name. From source file:org.rascalmpl.library.lang.xml.DOM.java
License:Open Source License
private Content nodeToContent(IConstructor n) { if (n.getConstructorType() == Factory.Node_element) { return nodeToElement(n); }//from w ww. ja va 2s .c om if (n.getConstructorType() == Factory.Node_pi) { IString target = (IString) n.get(0); IString data = (IString) n.get(1); return new ProcessingInstruction(target.getValue(), data.getValue()); } if (n.getConstructorType() == Factory.Node_charRef) { IInteger code = (IInteger) n.get(0); int c = java.lang.Integer.parseInt(code.getStringRepresentation()); return new Text(new java.lang.String(Character.toChars(c))); } if (n.getConstructorType() == Factory.Node_entityRef) { return new EntityRef(((IString) n.get(0)).getValue()); } java.lang.String text = ((IString) n.get(0)).getValue(); if (n.getConstructorType() == Factory.Node_cdata) { return new CDATA(text); } if (n.getConstructorType() == Factory.Node_charData) { return new Text(text); } if (n.getConstructorType() == Factory.Node_comment) { return new Comment(text); } wellformednessError(); return null; }