-
Fototrend

Új hozzászólás Aktív témák
-
smallmer
őstag
válasz
smallmer
#12255
üzenetére
Sziasztok!
még mindig próbálom megoldani ezt a feladatot.
Eddig jutottam, de sajnos semmit nem rak bele a topics NodeList-embe.
Mi lehet a gond?import java.io.FileNotFoundException;
import java.io.FileReader;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
public class XPathDriver01 {
static NodeList topics;
public static void main(String[] args) throws XPathExpressionException, FileNotFoundException {
XPath xPath = (XPathFactory.newInstance().newXPath());
System.out.println("Valami1");
displayTopicNames(xPath);
System.out.println(topics.getLength());
}
public static void displayTopicNames(XPath xPath) throws XPathExpressionException, FileNotFoundException {
topics = (NodeList) xPath.evaluate("s:complexType/s:sequence/s:element", new InputSource(new FileReader("valami.xml")), XPathConstants.NODESET);
System.out.println(topics.getLength());
for (int i = 0; i < topics.getLength(); i++) {
System.out.println(" |____" + ((Element) topics.item(i)).getAttribute("name"));
}
}
}
Új hozzászólás Aktív témák
● olvasd el a téma összefoglalót!
- Play Station 4 Pro 1TB 2 Kontroller, frissen pasztázva.
- ÚJ HP EliteBook 6 G1a Ryzen 5 PRO 230 4.9GHz 16GB DDR5 512GB FHD+ 16:10 már jobbik kijelző, gar 2028
- Thrustmaster T500RS + kézifék, kormány adapter
- Gamer PC - i9 14900K, RTX 5070 és 32gb RAM + GARANCIA
- ÚJ STEELSERIES Arctis Nova Pro Wireless Playstation fekete
- magyar billentyűzet - 151 - Lenovo LOQ (15IAX9) - Intel Core i5-12450HX, RTX 4060
- 194 - Lenovo Legion 5 (15IRX10) - Intel Core i9-14900HX, RTX 5070 (ELKELT)
- HIBÁTLAN iPhone 14 Pro 256GB Gold- 1 ÉV GARANCIA - Kártyafüggetlen, MS4514
- Thermalright Phantom Spirit 120 SE
- Új könyv: Grandpierre Attila: Az élő világegyetem könyve
Állásajánlatok
Cég: Central PC számítógép és laptop szerviz - Pécs
Város: Pécs
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest


