Hirdetés
- Házimozi belépő szinten
- Milyen házat vegyek?
- Azonnali informatikai kérdések órája
- Windowsos tablet topic
- Kormányok / autós szimulátorok topikja
- Mini PC
- Házi barkács, gányolás, tákolás, megdöbbentő gépek!
- NVIDIA GeForce RTX 4080 /4080S / 4090 (AD103 / 102)
- Kellemes karácsonyi ünnepeket!
- AMD K6-III, és minden ami RETRO - Oldschool tuning
Új hozzászólás Aktív témák
-
artiny
őstag
a toXml az emloyee ban igy nez ki most,
public String toXml() {
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();Document doc = db.newDocument();
Element employeee = doc.createElement("employee");
doc.appendChild(employeee);Element employee = doc.createElement("employee");
employee.setAttribute("rodneCislo", String.valueOf(rodneCislo));
employee.appendChild(employeee);Element nameE = doc.createElement("meno");
employee.appendChild(nameE);
Text nameEHodnota = doc.createTextNode(this.name);
nameE.appendChild(nameEHodnota);Element oddelenieE = doc.createElement("oddelenie");
employee.appendChild(oddelenieE);
Text oddelenieEHodnota = doc.createTextNode(this.oddelenie);
oddelenieE.appendChild(oddelenieEHodnota);TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer();
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(new File("xmldoc.xml"));
t.transform(source, result);
return result.toString();} catch (Exception e) {
System.out.println(e.getMessage());
}
return null;}
return null; a netbeans rakta be, ha ide is a return result.toString(); raktam akkor hibat irt,ha nem volt akkor pedig hianyzott a toXml nek a return statement.
xml.append(employee.toXml()); most nem jelez pirossan."Ja és még valami, ne itt rakd az XML-t fájlba, hanem az oraj osztályban."
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer();
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(new File("xmldoc.xml"));
t.transform(source, result);
return result.toString();
-akkor ez a resze a toXml nek nem ide valo hanem az orej osztalyba,ide:public String toXml() {
StringBuilder xml = new StringBuilder();
if ( this.emp!=null && !this.emp.isEmpty() ) {
for (Employee employee: this.emp) {
// employee to xml, ahogy tetszik.
xml.append(employee.toXml());
}
}
return xml.toString();
}
Új hozzászólás Aktív témák
A topicot kiemeltem. Valaki nem akar egy nyitó hsz-t írni?:))
- AZONNAL KÉSZLETRŐL! AMD Ryzen 7 9800X3D 64GB 6000MHz RAM 2TB Gen4 SSD RTX 5090 32GB GDDR7 1200W
- AZONNAL KÉSZLETRŐL! Intel Core i5 14600K 64GB 6000MHz RAM 2TB Gen4 SSD RTX 5060 8GB FSP 750W
- AZONNAL KÉSZLETRŐL! Intel Core i5 14600K 32GB 6000MHz RAM 2TB Gen4 SSD RTX 5060 8GB FSP 750W
- AZONNAL KÉSZLETRŐL! Intel Core i5 14600K 32GB 6000MHz RAM 1TB Gen4 SSD RTX 5060 8GB FSP 750W
- BESZÁMÍTÁS! GIGABYTE A520M R5 5500 16GB DDR4 256GB SSD 1TB HDD GTX 1060 6GB Zalman T3 Plus 400W
- Lenovo Thinkpad X1 Yoga 6th Gen. i7 11th, 32GB RAM, új akku, 4G LTE, toll, 27% ÁFÁS (0215)
- Azonnali készpénzes Intel i3 i5 i7 i9 12/13/14 gen processzor felvásárlás személyesen / csomagküldés
- BESZÁMÍTÁS! ASUS H610M i5 12600KF 32GB DDR5 500GB SSD RX 9060 XT 16GB Zalman T4 Plus CM 650W
- Apple iPhone 12 Mini / 256GB / Kártyafüggetlen / 12Hó Garancia / Akku: 89%
- Apple iPhone 16 Pro Max - Black Titanium - 256GB - Akku: 90% - Megkímélt állapot!
Állásajánlatok
Cég: Laptopszaki Kft.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest


