List of usage examples for org.dom4j Node ENTITY_REFERENCE_NODE
short ENTITY_REFERENCE_NODE
To view the source code for org.dom4j Node ENTITY_REFERENCE_NODE.
Click Source Link
From source file:architecture.common.xml.XmlWriter.java
License:Apache License
protected void writeNode(Node node) throws IOException { int nodeType = node.getNodeType(); switch (nodeType) { case Node.ELEMENT_NODE: writeElement((Element) node); break;//from w w w. j av a2 s .c o m case Node.ATTRIBUTE_NODE: writeAttribute((Attribute) node); break; case Node.TEXT_NODE: writeNodeText(node); // write((Text) node); break; case Node.CDATA_SECTION_NODE: writeCDATA(node.getText()); break; case Node.ENTITY_REFERENCE_NODE: writeEntity((Entity) node); break; case Node.PROCESSING_INSTRUCTION_NODE: writeProcessingInstruction((ProcessingInstruction) node); break; case Node.COMMENT_NODE: writeComment(node.getText()); break; case Node.DOCUMENT_NODE: write((Document) node); break; case Node.DOCUMENT_TYPE_NODE: writeDocType((DocumentType) node); break; case Node.NAMESPACE_NODE: // Will be output with attributes // write((Namespace) node); break; default: throw new IOException("Invalid node type: " + node); } }
From source file:architecture.common.xml.XmlWriter.java
License:Apache License
protected void writeEntityRef(String name) throws IOException { writer.write("&"); writer.write(name);//from w w w . j a v a 2 s . co m writer.write(";"); lastOutputNodeType = Node.ENTITY_REFERENCE_NODE; }
From source file:architecture.ee.util.xml.XmlWriter.java
License:Apache License
protected void writeNode(Node node) throws IOException { int nodeType = node.getNodeType(); switch (nodeType) { case Node.ELEMENT_NODE: writeElement((Element) node); break;/*from w w w. j a va 2s.c o m*/ case Node.ATTRIBUTE_NODE: writeAttribute((Attribute) node); break; case Node.TEXT_NODE: writeNodeText(node); //write((Text) node); break; case Node.CDATA_SECTION_NODE: writeCDATA(node.getText()); break; case Node.ENTITY_REFERENCE_NODE: writeEntity((Entity) node); break; case Node.PROCESSING_INSTRUCTION_NODE: writeProcessingInstruction((ProcessingInstruction) node); break; case Node.COMMENT_NODE: writeComment(node.getText()); break; case Node.DOCUMENT_NODE: write((Document) node); break; case Node.DOCUMENT_TYPE_NODE: writeDocType((DocumentType) node); break; case Node.NAMESPACE_NODE: // Will be output with attributes //write((Namespace) node); break; default: throw new IOException("Invalid node type: " + node); } }
From source file:com.christophermrossi.jpt.PageTemplateImpl.java
License:Open Source License
private void defaultContent(Element element, ContentHandler contentHandler, LexicalHandler lexicalHandler, Interpreter beanShell, Stack slotStack) throws SAXException, PageTemplateException, IOException { // Use default template content for (Iterator i = element.nodeIterator(); i.hasNext();) { Node node = (Node) i.next(); switch (node.getNodeType()) { case Node.ELEMENT_NODE: processElement((Element) node, contentHandler, lexicalHandler, beanShell, slotStack); break; case Node.TEXT_NODE: char[] text = node.getText().toCharArray(); contentHandler.characters(text, 0, text.length); break; case Node.COMMENT_NODE: char[] comment = node.getText().toCharArray(); lexicalHandler.comment(comment, 0, comment.length); break; case Node.CDATA_SECTION_NODE: lexicalHandler.startCDATA(); char[] cdata = node.getText().toCharArray(); contentHandler.characters(cdata, 0, cdata.length); lexicalHandler.endCDATA();/* w w w. ja v a2 s. c om*/ break; case Node.NAMESPACE_NODE: Namespace declared = (Namespace) node; //System.err.println( "Declared namespace: " + declared.getPrefix() + ":" + declared.getURI() ); namespaces.put(declared.getPrefix(), declared.getURI()); //if ( declared.getURI().equals( TAL_NAMESPACE_URI ) ) { // this.talNamespacePrefix = declared.getPrefix(); //} //else if (declared.getURI().equals( METAL_NAMESPACE_URI ) ) { // this.metalNamespacePrefix = declared.getPrefix(); //} break; case Node.ATTRIBUTE_NODE: // Already handled break; case Node.DOCUMENT_TYPE_NODE: case Node.ENTITY_REFERENCE_NODE: case Node.PROCESSING_INSTRUCTION_NODE: default: //System.err.println( "WARNING: Node type not supported: " + node.getNodeTypeName() ); } } }
From source file:com.cladonia.xml.XMLFormatter.java
License:Mozilla Public License
protected void writeMixedNode(Node node) throws IOException { if (DEBUG)//w w w .jav a 2 s .c o m System.out.println("XMLFormatter.writeMixedNode( " + node + ")"); int nodeType = node.getNodeType(); switch (nodeType) { case Node.ELEMENT_NODE: writeMixedElement((Element) node); break; case Node.ATTRIBUTE_NODE: writeAttribute((Attribute) node); break; case Node.TEXT_NODE: writeString(node.getText()); //write((Text) node); break; case Node.CDATA_SECTION_NODE: writeCDATA(node.getText()); break; case Node.ENTITY_REFERENCE_NODE: writeEntity((Entity) node); break; case Node.PROCESSING_INSTRUCTION_NODE: writeProcessingInstruction((ProcessingInstruction) node); break; case Node.COMMENT_NODE: writeComment(node.getText()); break; case Node.DOCUMENT_NODE: write((Document) node); break; case Node.DOCUMENT_TYPE_NODE: writeDocType((DocumentType) node); break; case Node.NAMESPACE_NODE: // Will be output with attributes //write((Namespace) node); break; default: throw new IOException("Invalid node type: " + node); } }
From source file:com.cladonia.xml.XMLFormatter.java
License:Mozilla Public License
protected void writePreservedNode(Node node) throws IOException { if (DEBUG)//from ww w .j a v a 2s . co m System.out.println("XMLFormatter.writeMixedNode( " + node + ")"); int nodeType = node.getNodeType(); switch (nodeType) { case Node.ELEMENT_NODE: writePreservedElement((Element) node); break; case Node.ATTRIBUTE_NODE: writeAttribute((Attribute) node); break; case Node.TEXT_NODE: writeString(node.getText()); //write((Text) node); break; case Node.CDATA_SECTION_NODE: writeCDATA(node.getText()); break; case Node.ENTITY_REFERENCE_NODE: writeEntity((Entity) node); break; case Node.PROCESSING_INSTRUCTION_NODE: writeProcessingInstruction((ProcessingInstruction) node); break; case Node.COMMENT_NODE: writeComment(node.getText()); break; case Node.DOCUMENT_NODE: write((Document) node); break; case Node.DOCUMENT_TYPE_NODE: writeDocType((DocumentType) node); break; case Node.NAMESPACE_NODE: // Will be output with attributes //write((Namespace) node); break; default: throw new IOException("Invalid node type: " + node); } }
From source file:com.webslingerz.jpt.PageTemplateImpl.java
License:Open Source License
private void defaultContent(Element element, ContentHandler contentHandler, LexicalHandler lexicalHandler, Interpreter beanShell, Stack<Map<String, Slot>> slotStack) throws SAXException, PageTemplateException, IOException { // Use default template content for (Iterator i = element.nodeIterator(); i.hasNext();) { Node node = (Node) i.next(); switch (node.getNodeType()) { case Node.ELEMENT_NODE: processElement((Element) node, contentHandler, lexicalHandler, beanShell, slotStack); break; case Node.TEXT_NODE: char[] text = Expression.evaluateText(node.getText().toString(), beanShell).toCharArray(); contentHandler.characters(text, 0, text.length); break; case Node.COMMENT_NODE: char[] comment = node.getText().toCharArray(); lexicalHandler.comment(comment, 0, comment.length); break; case Node.CDATA_SECTION_NODE: lexicalHandler.startCDATA(); char[] cdata = node.getText().toCharArray(); contentHandler.characters(cdata, 0, cdata.length); lexicalHandler.endCDATA();/*from w ww . ja va2 s . c o m*/ break; case Node.NAMESPACE_NODE: Namespace declared = (Namespace) node; // System.err.println( "Declared namespace: " + // declared.getPrefix() + ":" + declared.getURI() ); namespaces.put(declared.getPrefix(), declared.getURI()); // if ( declared.getURI().equals( TAL_NAMESPACE_URI ) ) { // this.talNamespacePrefix = declared.getPrefix(); // } // else if (declared.getURI().equals( METAL_NAMESPACE_URI ) ) { // this.metalNamespacePrefix = declared.getPrefix(); // } break; case Node.ATTRIBUTE_NODE: // Already handled break; case Node.DOCUMENT_TYPE_NODE: case Node.ENTITY_REFERENCE_NODE: case Node.PROCESSING_INSTRUCTION_NODE: default: // System.err.println( "WARNING: Node type not supported: " + // node.getNodeTypeName() ); } } }
From source file:freemarker.ext.xml._Dom4jNavigator.java
License:Apache License
String getType(Object node) { switch (((Node) node).getNodeType()) { case Node.ATTRIBUTE_NODE: { return "attribute"; }/* ww w. ja v a2 s . c o m*/ case Node.CDATA_SECTION_NODE: { return "cdata"; } case Node.COMMENT_NODE: { return "comment"; } case Node.DOCUMENT_NODE: { return "document"; } case Node.DOCUMENT_TYPE_NODE: { return "documentType"; } case Node.ELEMENT_NODE: { return "element"; } case Node.ENTITY_REFERENCE_NODE: { return "entityReference"; } case Node.NAMESPACE_NODE: { return "namespace"; } case Node.PROCESSING_INSTRUCTION_NODE: { return "processingInstruction"; } case Node.TEXT_NODE: { return "text"; } } return "unknown"; }
From source file:org.hudsonci.xpath.impl.Dom2Dom.java
License:Open Source License
private org.w3c.dom.Node createChild(Node child, org.w3c.dom.Node wparent) { int type = child.getNodeType(); // Collapse multiple consecutive text nodes to a single text node // with trimmed value. if (type != Node.TEXT_NODE) endText(wparent);//from w w w . ja va2s. com Name name; org.w3c.dom.Node node = null; switch (type) { case Node.ATTRIBUTE_NODE: break; case Node.CDATA_SECTION_NODE: CDATA cd = (CDATA) child; wparent.appendChild(node = wdoc.createCDATASection(cd.getText())); break; case Node.COMMENT_NODE: Comment co = (Comment) child; wparent.appendChild(node = wdoc.createComment(co.getText())); break; case Node.DOCUMENT_TYPE_NODE: DocumentType dt = (DocumentType) child; wparent.appendChild(new XDocumentType(dt, wparent)); break; case Node.ELEMENT_NODE: Element el = (Element) child; name = new Name(el); org.w3c.dom.Element e = name.namespaceURI == null ? wdoc.createElement(name.qualifiedName) : wdoc.createElementNS(name.namespaceURI, name.qualifiedName); wparent.appendChild(e); node = currentElement = e; for (int i = 0, n = el.attributeCount(); i < n; i++) { Attribute at = el.attribute(i); name = new Name(at); if (name.namespaceURI == null) e.setAttribute(name.qualifiedName, at.getValue()); else e.setAttributeNS(name.namespaceURI, name.qualifiedName, at.getValue()); } return e; case Node.ENTITY_REFERENCE_NODE: break; case Node.PROCESSING_INSTRUCTION_NODE: ProcessingInstruction p = (ProcessingInstruction) child; wparent.appendChild(node = wdoc.createProcessingInstruction(p.getTarget(), p.getText())); break; case Node.TEXT_NODE: textBuilder.append(child.getText()); lastText = (Text) child; break; case Node.NAMESPACE_NODE: Namespace ns = (Namespace) child; name = new Name(ns); currentElement.setAttribute(name.qualifiedName, ns.getURI()); break; default: throw new IllegalStateException("Unknown node type"); } if (node != null) reverseMap.put(node, child); return null; }
From source file:org.zenonpagetemplates.onePhaseImpl.PageTemplateImpl.java
License:Open Source License
@SuppressWarnings({ "unchecked" }) private void defaultContent(Element element, ContentHandler contentHandler, LexicalHandler lexicalHandler, EvaluationHelper evaluationHelper, Stack<Map<String, Slot>> slotStack) throws SAXException, PageTemplateException, IOException, EvaluationException { // Use default template content for (Iterator<Node> i = element.nodeIterator(); i.hasNext();) { Node node = i.next();/*from w w w .j a v a 2s . co m*/ switch (node.getNodeType()) { case Node.ELEMENT_NODE: processElement((Element) node, contentHandler, lexicalHandler, evaluationHelper, slotStack); break; case Node.TEXT_NODE: char[] text = node.getText().toCharArray(); contentHandler.characters(text, 0, text.length); break; case Node.COMMENT_NODE: char[] comment = node.getText().toCharArray(); lexicalHandler.comment(comment, 0, comment.length); break; case Node.CDATA_SECTION_NODE: lexicalHandler.startCDATA(); char[] cdata = node.getText().toCharArray(); contentHandler.characters(cdata, 0, cdata.length); lexicalHandler.endCDATA(); break; case Node.NAMESPACE_NODE: Namespace declared = (Namespace) node; //System.err.println( "Declared namespace: " + declared.getPrefix() + ":" + declared.getURI() ); this.namespaces.put(declared.getPrefix(), declared.getURI()); //if ( declared.getURI().equals( TAL_NAMESPACE_URI ) ) { // this.talNamespacePrefix = declared.getPrefix(); //} //else if (declared.getURI().equals( METAL_NAMESPACE_URI ) ) { // this.metalNamespacePrefix = declared.getPrefix(); //} break; case Node.ATTRIBUTE_NODE: // Already handled break; case Node.DOCUMENT_TYPE_NODE: case Node.ENTITY_REFERENCE_NODE: case Node.PROCESSING_INSTRUCTION_NODE: default: //System.err.println( "WARNING: Node type not supported: " + node.getNodeTypeName() ); } } }