|
Kod: |
import arg.apache.xerces.parsers.DOMParser; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.Text; public class readXML { static public void main(String[] argv) { try { DOMParser parser = new DOMParser(); parser.parse("greeting.xml"); Document doc = parser.getDocument(); for (Node node = doc.getDocumentElement().getFirstChild(); node != null; node = node.getNextSibling()) { if (node instanceof Element) { if (node.getNodeName().equals("TITLE")) { StringBuffer buffer = new StringBuffer(); for (Node subnode = node.getFirstChild(); subnode != null; subnode = subnode.getNextSibling()){ if (subnode instanceof Text) { buffer.append(subnode.getNodeValue()); } } System.out.println(buffer.toString()); } } } } catch (Exception e) { e.printStackTrace(); } } } |
| mrx napisał/a: |
| Ty przynajmniej napisałeś, że wykorzystałeś przykład a on nawet o tym nie wspomniał. Może chciał żeby wszyscy myśleli że to jego pomysł! |
| Fanotherpg napisał/a: |
| to, że zmienił tylko jedno polecenie też o niczym nie świadczy, |
| Stankol. napisał/a: |
| program niszczarka jest już na CP, więc nie jest niepowarzalny, nazywa się Program Czikita |
.
, czekam na wyniki... trzymam za siebie kciuki ;p | mrx napisał/a: |
| A kiedy będzie głosowanie publiczności?? |