Hirdetés
- Samsung Galaxy S24 Ultra - ha működik, ne változtass!
- Google Pixel topik
- Gyorsabb lesz a tárhely, de drágább lesz a Nothing Phone (4a)
- CES 2026: Aláírjuk a Motorola Signature mutatós külsejét
- Bemutatkozott a Poco X7 és X7 Pro
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- Samsung Galaxy A56 - megbízható középszerűség
- Samsung Galaxy S25 - végre van kicsi!
- Honor 200 Pro - mobilportré
- iPhone topik
Ú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?:))
- Lenovo ThinkPad X1 Yoga G6 (6th Gen) - i7-1185G7, 32GB, 1TB SSD, 4K multitouch + TOLL (ELKELT)
- Bomba ár! Dynabook Portege X30-L - i5-1135G7 I 8-16GB I 256SSD I 13,3" FHD I Cam I W11 I Garancia!
- ÚJ ASUS Vivobook 15 X1504 - 15.6"FHD IPS - i5-1335U - 16GB - 1TB - Win11 - 3 év garancia - MAGYAR
- Fém, összecsukható és kihúzható fotó állvány eladó
- Gamer PC-Számítógép! Csere-Beszámítás! I7 8700K / RTX 3070 / 32GB DDR4 / 1TB SSD
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest


