Autor Zpráva
Fanda
Profil *
<?xml version="1.0" encoding="utf-8" ?>
<menu>
<byt-1>
<datum>20.11.2006</datum>
<text>Tento text je</text>
<odkaz>neco</odkaz>
</byt-1>
<byt2>
<datum>2.12.2006</datum>
<text>Další novinka</text>
<odkaz>neco2</odkaz>
</byt-2>
</menu>

Ve funkci volám id a podle něj výsledný byt .. napr. byt-2. Jak mám udělat
podmínku abych zjistil jen hodnoty byt-2 .. pomocí childNodes, firstChild,..
Díky.
Fanda
Profil *
Proč mi tohle nechodí?

stop();

SetVariable(id);



informace.html = true;
informace.multiline = true;

var CSSstyl:TextField.StyleSheet = new TextField.StyleSheet();
CSSstyl.load("styl-xml.css");
CSSstyl.onLoad = function(success:Boolean) {

if (success) {
informace.styleSheet = CSSstyl;

textData = new XML();
textData.ignoreWhite = true;
textData.load("byty.xml");
textData.onLoad = function(succ:Boolean) {

if (succ) {

var node1:XMLNode;
node1 = textData.firstChild;
node1Name = node1.nodeName;

if (node1Name == "byty") {

informace.htmlText += node1.attributes;

for (var ndSubs:XMLNode = node1.firstChild; ndSubs != null; ndSubs=ndSubs.nextSibling) {

if(ndSubs.firstChild == "2") {
informace.htmlText = "Zachyceno";
}

}
}
} else {
informace.text = "Chyba v načítání XML dokumentu";
}
};
}
};
Fanda
Profil *
Uz to mam, dnes jsem se probudil a koukam na to a uplne to bije do oci stop();

SetVariable(id);



informace.html = true;
informace.multiline = true;

var CSSstyl:TextField.StyleSheet = new TextField.StyleSheet();
CSSstyl.load("styl-xml.css");
CSSstyl.onLoad = function(success:Boolean) {

if (success) {
informace.styleSheet = CSSstyl;

textData = new XML();
textData.ignoreWhite = true;
textData.load("byty.xml");
textData.onLoad = function(succ:Boolean) {

if (succ) {

var node1:XMLNode;
node1 = textData.firstChild;
node1Name = node1.nodeName;

if (node1Name == "byty") {

informace.htmlText += node1.attributes;

for (var ndSubs:XMLNode = node1.firstChild; ndSubs != null; ndSubs=ndSubs.nextSibling) {

if(ndSubs.nodeName == "byt-2") {
informace.htmlText += ndSubs;
}

}
}
} else {
informace.text = "Chyba v načítání XML dokumentu";
}
};
}
};
Toto téma je uzamčeno. Odpověď nelze zaslat.

0