static public NodeModel wrap(Node node) { if (node == null) { return null; } NodeModel result = null; switch (node.getNodeType()) { case Node.DOCUMENT_NODE : result = new DocumentModel((Document) node); break; case Node.ELEMENT_NODE : result = new ElementModel((Element) node); break; case Node.ATTRIBUTE_NODE : result = new AttributeNodeModel((Attr) node); break; case Node.CDATA_SECTION_NODE : case Node.COMMENT_NODE : case Node.TEXT_NODE : result = new CharacterDataNodeModel((org.w3c.dom.CharacterData) node); break; case Node.PROCESSING_INSTRUCTION_NODE : result = new PINodeModel((ProcessingInstruction) node); break; case Node.DOCUMENT_TYPE_NODE : result = new DocumentTypeModel((DocumentType) node); break; } return result; }
@Override public TemplateModel get(String key) throws TemplateModelException { if (key.equals("*")) { return getRootElement(); } else if (key.equals("**")) { NodeList nl = ((Document) node).getElementsByTagName("*"); return new NodeListModel(nl, this); } else if (DomStringUtil.isXMLNameLike(key)) { ElementModel em = (ElementModel) NodeModel.wrap(((Document) node).getDocumentElement()); if (em.matchesName(key, Environment.getCurrentEnvironment())) { return em; } else { return new NodeListModel(this); } } return super.get(key); }
ElementModel getRootElement() { if (rootElement == null) { rootElement = (ElementModel) wrap(((Document) node).getDocumentElement()); } return rootElement; }
static public NodeModel wrap(Node node) { if (node == null) { return null; } NodeModel result = null; switch (node.getNodeType()) { case Node.DOCUMENT_NODE : result = new DocumentModel((Document) node); break; case Node.ELEMENT_NODE : result = new ElementModel((Element) node); break; case Node.ATTRIBUTE_NODE : result = new AttributeNodeModel((Attr) node); break; case Node.CDATA_SECTION_NODE : case Node.COMMENT_NODE : case Node.TEXT_NODE : result = new CharacterDataNodeModel((org.w3c.dom.CharacterData) node); break; case Node.PROCESSING_INSTRUCTION_NODE : result = new PINodeModel((ProcessingInstruction) node); break; case Node.DOCUMENT_TYPE_NODE : result = new DocumentTypeModel((DocumentType) node); break; } return result; }
ElementModel getRootElement() { if (rootElement == null) { rootElement = (ElementModel) wrap(((Document) node).getDocumentElement()); } return rootElement; }
@Override public TemplateModel get(String key) throws TemplateModelException { if (key.equals("*")) { return getRootElement(); } else if (key.equals("**")) { NodeList nl = ((Document) node).getElementsByTagName("*"); return new NodeListModel(nl, this); } else if (DomStringUtil.isXMLNameLike(key)) { ElementModel em = (ElementModel) NodeModel.wrap(((Document) node).getDocumentElement()); if (em.matchesName(key, Environment.getCurrentEnvironment())) { return em; } else { return new NodeListModel(this); } } return super.get(key); }
static public NodeModel wrap(Node node) { if (node == null) { return null; } NodeModel result = null; switch (node.getNodeType()) { case Node.DOCUMENT_NODE : result = new DocumentModel((Document) node); break; case Node.ELEMENT_NODE : result = new ElementModel((Element) node); break; case Node.ATTRIBUTE_NODE : result = new AttributeNodeModel((Attr) node); break; case Node.CDATA_SECTION_NODE : case Node.COMMENT_NODE : case Node.TEXT_NODE : result = new CharacterDataNodeModel((org.w3c.dom.CharacterData) node); break; case Node.PROCESSING_INSTRUCTION_NODE : result = new PINodeModel((ProcessingInstruction) node); break; case Node.DOCUMENT_TYPE_NODE : result = new DocumentTypeModel((DocumentType) node); break; } return result; }
ElementModel getRootElement() { if (rootElement == null) { rootElement = (ElementModel) wrap(((Document) node).getDocumentElement()); } return rootElement; }
@Override public TemplateModel get(String key) throws TemplateModelException { if (key.equals("*")) { return getRootElement(); } else if (key.equals("**")) { NodeList nl = ((Document) node).getElementsByTagName("*"); return new NodeListModel(nl, this); } else if (DomStringUtil.isXMLNameLike(key)) { ElementModel em = (ElementModel) NodeModel.wrap(((Document) node).getDocumentElement()); if (em.matchesName(key, Environment.getCurrentEnvironment())) { return em; } else { return new NodeListModel(this); } } return super.get(key); }
static public NodeModel wrap(Node node) { if (node == null) { return null; } NodeModel result = null; switch (node.getNodeType()) { case Node.DOCUMENT_NODE : result = new DocumentModel((Document) node); break; case Node.ELEMENT_NODE : result = new ElementModel((Element) node); break; case Node.ATTRIBUTE_NODE : result = new AttributeNodeModel((Attr) node); break; case Node.CDATA_SECTION_NODE : case Node.COMMENT_NODE : case Node.TEXT_NODE : result = new CharacterDataNodeModel((org.w3c.dom.CharacterData) node); break; case Node.PROCESSING_INSTRUCTION_NODE : result = new PINodeModel((ProcessingInstruction) node); break; case Node.DOCUMENT_TYPE_NODE : result = new DocumentTypeModel((DocumentType) node); break; } return result; }
ElementModel getRootElement() { if (rootElement == null) { rootElement = (ElementModel) wrap(((Document) node).getDocumentElement()); } return rootElement; }
public TemplateModel get(String key) throws TemplateModelException { if (key.equals("*")) { return getRootElement(); } else if (key.equals("**")) { NodeList nl = ((Document)node).getElementsByTagName("*"); return new NodeListModel(nl, this); } else if (StringUtil.isXMLID(key)) { ElementModel em = (ElementModel) NodeModel.wrap(((Document) node).getDocumentElement()); if (em.matchesName(key, Environment.getCurrentEnvironment())) { return em; } else { return new NodeListModel(this); } } return super.get(key); }
this.documentModels = documentModels; if (documentModels.size() == 0) documentModels.add(new DocumentModel()); documentModels.add(new DocumentModel()); notifyDataSetChanged(); } else {