List of usage examples for com.google.gwt.xml.client Node TEXT_NODE
short TEXT_NODE
To view the source code for com.google.gwt.xml.client Node TEXT_NODE.
Click Source Link
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 . j a va 2s .c om*/ } } 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 www . j a v a2 s . 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.xmldom.NodeXml.java
License:Apache License
/** * This method creates a new node of the correct type. * // ww w. j av a2 s . co m * @param node - the supplied DOM JavaScript object * @return a Node object that corresponds to the DOM object */ public static Node build(JavaScriptObject node) { if (node == null) { return null; } short nodeType = XMLParserImpl.getNodeType(node); switch (nodeType) { case Node.ATTRIBUTE_NODE: return new AttrImpl(node); case Node.CDATA_SECTION_NODE: return new CDATASectionImpl(node); case Node.COMMENT_NODE: return new CommentImpl(node); case Node.DOCUMENT_FRAGMENT_NODE: return new DocumentFragmentImpl(node); case Node.DOCUMENT_NODE: return new DocumentImpl(node); case Node.ELEMENT_NODE: return new ElementImpl(node); case Node.PROCESSING_INSTRUCTION_NODE: return new ProcessingInstructionImpl(node); case Node.TEXT_NODE: return new TextImpl(node); default: return new NodeXml(node); } }
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);/* w ww. j a v a 2 s . co m*/ 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()); } 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 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 ww w . j a v a 2s.c o 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);/* w w w .j a va 2s . c om*/ } } 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;//from ww w.j a va 2 s .c o m final NodeList childs = element.getChildNodes(); for (int index = 0; index < childs.getLength(); index++) { item = childs.item(index); 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);// ww w . j a v a 2s . co m } } if (text != null) { element.appendChild(element.getOwnerDocument().createTextNode(text)); } }
From source file:com.calclab.emite.core.client.packet.gwt.GWTPacket.java
License:Open Source License
private List<IPacket> wrap(final NodeList nodes) { int length;//from w ww. j a va 2s . c om if (nodes == null || (length = nodes.getLength()) == 0) return EMPTY_LIST; final ArrayList<IPacket> selected = new ArrayList<IPacket>(); for (int index = 0; index < length; index++) { final Node node = nodes.item(index); if (node.getNodeType() == Node.ELEMENT_NODE) { selected.add(new GWTPacket((Element) node)); } else if (node.getNodeType() == Node.TEXT_NODE) { } } return selected; }
From source file:com.fredhat.gwt.xmlrpc.client.XmlRpcClient.java
License:Open Source License
private String getNodeTextValue(Node node) { if (node.getChildNodes().getLength() != 1) return null; Node textNode = (Node) node.getFirstChild(); if (textNode.getNodeType() != Node.TEXT_NODE) return null; return textNode.getNodeValue(); }