ProcessingInstruction pi = (ProcessingInstruction) node; if ("target".equals(localName)) { result.add(createAttribute(pi, "target", pi.getTarget())); } else if ("data".equals(localName)) { result.add(createAttribute(pi, "data", pi.getData())); } else { DocumentType doctype = (DocumentType) node; if ("publicId".equals(localName)) { result.add(createAttribute(doctype, "publicId", doctype.getPublicId())); } else if ("systemId".equals(localName)) { result.add(createAttribute(doctype, "systemId", doctype.getSystemId())); } else if ("elementName".equals(localName)) { result.add(createAttribute(doctype, "elementName", doctype.getNodeName()));
@Override void getChildren(Object node, String localName, String namespaceUri, List result) { if ("".equals(namespaceUri)) { namespaceUri = null; } NodeList children = ((Node) node).getChildNodes(); for (int i = 0; i < children.getLength(); ++i) { Node subnode = children.item(i); // IMO, we should get the text nodes as well -- will discuss. if (subnode.getNodeType() == Node.ELEMENT_NODE || subnode.getNodeType() == Node.TEXT_NODE) { if (localName == null || (equal(subnode.getNodeName(), localName) && equal(subnode.getNamespaceURI(), namespaceUri))) { result.add(subnode); } } } }
@Override void getDescendants(Object node, List result) { NodeList children = ((Node) node).getChildNodes(); for (int i = 0; i < children.getLength(); ++i) { Node subnode = children.item(i); if (subnode.getNodeType() == Node.ELEMENT_NODE) { result.add(subnode); getDescendants(subnode, result); } } }
case Node.ATTRIBUTE_NODE: { buf.append(' ') .append(getQualifiedName(n)) .append("=\"") outputContent(n.getChildNodes(), buf); break; buf.append('<').append(getQualifiedName(n)); outputContent(n.getAttributes(), buf); buf.append('>'); outputContent(n.getChildNodes(), buf); buf.append("</").append(getQualifiedName(n)).append('>'); break; outputContent(n.getChildNodes(), buf); break;
@Override void getAsString(Object node, StringWriter sw) { outputContent((Node) node, sw); }
case Node.ATTRIBUTE_NODE: { buf.append(' ') .append(getQualifiedName(n)) .append("=\"") outputContent(n.getChildNodes(), buf); break; buf.append('<').append(getQualifiedName(n)); outputContent(n.getAttributes(), buf); buf.append('>'); outputContent(n.getChildNodes(), buf); buf.append("</").append(getQualifiedName(n)).append('>'); break; outputContent(n.getChildNodes(), buf); break;
private void outputContent(NodeList nodes, StringWriter buf) { for (int i = 0; i < nodes.getLength(); ++i) { outputContent(nodes.item(i), buf); } }
case Node.ATTRIBUTE_NODE: { buf.append(' ') .append(getQualifiedName(n)) .append("=\"") outputContent(n.getChildNodes(), buf); break; buf.append('<').append(getQualifiedName(n)); outputContent(n.getAttributes(), buf); buf.append('>'); outputContent(n.getChildNodes(), buf); buf.append("</").append(getQualifiedName(n)).append('>'); break; outputContent(n.getChildNodes(), buf); break;
private void outputContent(NamedNodeMap nodes, StringWriter buf) { for (int i = 0; i < nodes.getLength(); ++i) { outputContent(nodes.item(i), buf); } }
@Override void getDescendants(Object node, List result) { NodeList children = ((Node) node).getChildNodes(); for (int i = 0; i < children.getLength(); ++i) { Node subnode = children.item(i); if (subnode.getNodeType() == Node.ELEMENT_NODE) { result.add(subnode); getDescendants(subnode, result); } } }
@Override void getChildren(Object node, String localName, String namespaceUri, List result) { if ("".equals(namespaceUri)) { namespaceUri = null; } NodeList children = ((Node) node).getChildNodes(); for (int i = 0; i < children.getLength(); ++i) { Node subnode = children.item(i); // IMO, we should get the text nodes as well -- will discuss. if (subnode.getNodeType() == Node.ELEMENT_NODE || subnode.getNodeType() == Node.TEXT_NODE) { if (localName == null || (equal(subnode.getNodeName(), localName) && equal(subnode.getNamespaceURI(), namespaceUri))) { result.add(subnode); } } } }
ProcessingInstruction pi = (ProcessingInstruction) node; if ("target".equals(localName)) { result.add(createAttribute(pi, "target", pi.getTarget())); } else if ("data".equals(localName)) { result.add(createAttribute(pi, "data", pi.getData())); } else { DocumentType doctype = (DocumentType) node; if ("publicId".equals(localName)) { result.add(createAttribute(doctype, "publicId", doctype.getPublicId())); } else if ("systemId".equals(localName)) { result.add(createAttribute(doctype, "systemId", doctype.getSystemId())); } else if ("elementName".equals(localName)) { result.add(createAttribute(doctype, "elementName", doctype.getNodeName()));
@Override void getAsString(Object node, StringWriter sw) { outputContent((Node) node, sw); }
@Override void getDescendants(Object node, List result) { NodeList children = ((Node) node).getChildNodes(); for (int i = 0; i < children.getLength(); ++i) { Node subnode = children.item(i); if (subnode.getNodeType() == Node.ELEMENT_NODE) { result.add(subnode); getDescendants(subnode, result); } } }
@Override void getChildren(Object node, String localName, String namespaceUri, List result) { if ("".equals(namespaceUri)) { namespaceUri = null; } NodeList children = ((Node) node).getChildNodes(); for (int i = 0; i < children.getLength(); ++i) { Node subnode = children.item(i); // IMO, we should get the text nodes as well -- will discuss. if (subnode.getNodeType() == Node.ELEMENT_NODE || subnode.getNodeType() == Node.TEXT_NODE) { if (localName == null || (equal(subnode.getNodeName(), localName) && equal(subnode.getNamespaceURI(), namespaceUri))) { result.add(subnode); } } } }
ProcessingInstruction pi = (ProcessingInstruction) node; if ("target".equals(localName)) { result.add(createAttribute(pi, "target", pi.getTarget())); } else if ("data".equals(localName)) { result.add(createAttribute(pi, "data", pi.getData())); } else { DocumentType doctype = (DocumentType) node; if ("publicId".equals(localName)) { result.add(createAttribute(doctype, "publicId", doctype.getPublicId())); } else if ("systemId".equals(localName)) { result.add(createAttribute(doctype, "systemId", doctype.getSystemId())); } else if ("elementName".equals(localName)) { result.add(createAttribute(doctype, "elementName", doctype.getNodeName()));
@Override void getAsString(Object node, StringWriter sw) { outputContent((Node) node, sw); }
private void outputContent(NamedNodeMap nodes, StringWriter buf) { for (int i = 0; i < nodes.getLength(); ++i) { outputContent(nodes.item(i), buf); } }
private void outputContent(NodeList nodes, StringWriter buf) { for (int i = 0; i < nodes.getLength(); ++i) { outputContent(nodes.item(i), buf); } }
private void outputContent(NodeList nodes, StringWriter buf) { for (int i = 0; i < nodes.getLength(); ++i) { outputContent(nodes.item(i), buf); } }