List of usage examples for com.google.gwt.xml.client Node getNodeType
short getNodeType();
From source file:anzsoft.xmpp4gwt.client.packet.PacketGwtImpl.java
License:Open Source License
public void setCData(String cdata) { final NodeList nodes = element.getChildNodes(); for (int index = 0; index < nodes.getLength(); index++) { final Node child = nodes.item(index); if (child.getNodeType() == Node.TEXT_NODE) { element.removeChild(child);// w w w .ja va 2s.co m } } element.appendChild(element.getOwnerDocument().createTextNode(cdata)); }
From source file:bz.davide.dmxmljson.unmarshalling.xml.gwt.GWTXMLValue.java
License:Open Source License
void recursiveText(Node node, StringBuffer sb) { if (node.getNodeType() == Node.TEXT_NODE) { sb.append(node.getNodeValue());/*from w w w .ja v a 2s.c om*/ } if (node.getNodeType() == Node.ELEMENT_NODE) { NodeList nl = node.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { this.recursiveText(nl.item(i), sb); } } }
From source file:client.net.sf.saxon.ce.dom.DOMWriter.java
License:Mozilla Public License
/** * Set the attachment point for the new subtree * @param node the node to which the new subtree will be attached */// www . j a v a 2s . co m public void setNode(Node node) { if (node == null) { return; } currentNode = node; if (node.getNodeType() == Node.DOCUMENT_NODE) { document = (Document) node; } else { document = currentNode.getOwnerDocument(); if (document == null) { // which might be because currentNode() is a parentless ElementOverNodeInfo. // we create a DocumentOverNodeInfo, which is immutable, and will cause the DOMWriter to fail //document = new DocumentOverNodeInfo(); // TODO:CLAXON - check this } } }
From source file:com.bramosystems.oss.player.playlist.client.impl.SAXParser.java
License:Apache License
private void processNodes(NodeList node) throws ParseException { for (int i = 0; i < node.getLength(); i++) { Node nd = node.item(i); switch (nd.getNodeType()) { case Node.ELEMENT_NODE: HashMap<String, String> attr = new HashMap<String, String>(); NamedNodeMap nnm = nd.getAttributes(); for (int j = 0; j < nnm.getLength(); j++) { Node nm = nnm.item(j); attr.put(nm.getNodeName(), nm.getNodeValue()); }/* ww w .j a v a 2 s. c o m*/ handler.onNodeStart(nd.getNodeName(), attr, nd.getNamespaceURI()); processNodes(nd.getChildNodes()); handler.onNodeEnd(nd.getNodeName()); break; case Node.TEXT_NODE: handler.setNodeValue(nd.getParentNode().getNodeName(), nd.getNodeValue()); } } }
From source file:com.calclab.emite.base.xml.XMLPacketImplGWT.java
License:Open Source License
@Override public XMLPacket getFirstChild(final String name, final String namespace) { checkNotNull(name);// ww w. j a v a 2 s . c o m checkNotNull(namespace); final NodeList nodes = element.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { final Node node = nodes.item(i); if (node.getNodeType() != Node.ELEMENT_NODE) { continue; } final Element element = (Element) node; if (!"*".equals(name) && !name.equals(element.getTagName())) { continue; } if (!"*".equals(namespace) && !namespace.equals(element.getNamespaceURI())) { continue; } return new XMLPacketImplGWT(element); } return null; }
From source file:com.calclab.emite.base.xml.XMLPacketImplGWT.java
License:Open Source License
@Override public ImmutableList<XMLPacket> getChildren(final String name, final String namespace) { checkNotNull(name);//from w w w. j a v a 2 s . c o m checkNotNull(namespace); final ImmutableList.Builder<XMLPacket> result = ImmutableList.builder(); final NodeList nodes = element.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { final Node node = nodes.item(i); if (node.getNodeType() != Node.ELEMENT_NODE) { continue; } final Element element = (Element) node; if (!"*".equals(name) && !name.equals(element.getTagName())) { continue; } if (!"*".equals(namespace) && !namespace.equals(element.getNamespaceURI())) { continue; } result.add(new XMLPacketImplGWT(element)); } return result.build(); }
From source file:com.calclab.emite.base.xml.XMLPacketImplGWT.java
License:Open Source License
@Override public String getText() { final StringBuilder result = new StringBuilder(); final NodeList nodes = element.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { final Node child = nodes.item(i); if (child.getNodeType() == Node.TEXT_NODE) result.append(child.getNodeValue()); }/*from www . j a v a2 s . co m*/ return result.toString(); }
From source file:com.calclab.emite.base.xml.XMLPacketImplGWT.java
License:Open Source License
@Override public void setText(final String text) { // TODO: remove ALL children? final NodeList nodes = element.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { final Node child = nodes.item(i); if (child.getNodeType() == Node.TEXT_NODE) { element.removeChild(child);// www. ja v a 2s. c o m } } if (!Strings.isNullOrEmpty(text)) { element.appendChild(document.createTextNode(text)); } }
From source file:com.calclab.emite.core.client.packet.gwt.GWTPacket.java
License:Open Source License
@Override public String getText() { Node item; final NodeList childs = element.getChildNodes(); for (int index = 0; index < childs.getLength(); index++) { item = childs.item(index);/* w ww .j a v a 2 s . c o m*/ if (item.getNodeType() == Node.TEXT_NODE) return item.getNodeValue(); } return null; }
From source file:com.calclab.emite.core.client.packet.gwt.GWTPacket.java
License:Open Source License
@Override public void setText(final String text) { final NodeList nodes = element.getChildNodes(); for (int index = 0; index < nodes.getLength(); index++) { final Node child = nodes.item(index); if (child.getNodeType() == Node.TEXT_NODE) { element.removeChild(child);//from w w w . jav a 2 s . com } } if (text != null) { element.appendChild(element.getOwnerDocument().createTextNode(text)); } }