MCPcopy Create free account
hub / github.com/apache/freemarker / wrap

Method wrap

src/main/java/freemarker/ext/dom/NodeModel.java:369–385  ·  view source on GitHub ↗
(Node node)

Source from the content-addressed store, hash-verified

367 }
368
369 static public NodeModel wrap(Node node) {
370 if (node == null) {
371 return null;
372 }
373 NodeModel result = null;
374 switch (node.getNodeType()) {
375 case Node.DOCUMENT_NODE : result = new DocumentModel((Document) node); break;
376 case Node.ELEMENT_NODE : result = new ElementModel((Element) node); break;
377 case Node.ATTRIBUTE_NODE : result = new AttributeNodeModel((Attr) node); break;
378 case Node.CDATA_SECTION_NODE :
379 case Node.COMMENT_NODE :
380 case Node.TEXT_NODE : result = new CharacterDataNodeModel((org.w3c.dom.CharacterData) node); break;
381 case Node.PROCESSING_INSTRUCTION_NODE : result = new PINodeModel((ProcessingInstruction) node); break;
382 case Node.DOCUMENT_TYPE_NODE : result = new DocumentTypeModel((DocumentType) node); break;
383 }
384 return result;
385 }
386
387 /**
388 * Recursively removes all comment nodes

Callers 9

setUpMethod · 0.95
getMethod · 0.95
wrapMethod · 0.95
NodeListModelMethod · 0.95
parseMethod · 0.95
getParentNodeMethod · 0.95
getDocumentNodeModelMethod · 0.95
processMethod · 0.95
wrapDomNodeMethod · 0.95

Calls 1

getNodeTypeMethod · 0.65

Tested by 1

setUpMethod · 0.76