PDA

Просмотр полной версии : Откуда после тэга появляется запятая? [xml]


mixey_lv
20.09.2005, 21:55
Есть xml файл:
<gal_element name="button_name" button="gallery_pictures/buttons/2_but.jpg">
<sub_element big_pic="gallery_pictures/pictures/cookinlet.jpg" thumbnail="gallery_pictures/thumbnails/cookinletpreview.jpg"><b> Welcome to Macromedia Flash MX 2004 and Macromedia Flash MX </b> Professional 2004. Flash provides everything you need to create and deliver rich web content and powerful applications. Whether you're designing motion graphics or building data-driven applications, Flash has the tools necessary to produce great results and deliver the best user experience across multiple platforms and devices.</sub_element>

Парсю:
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.load("gallery_pictures/r4.xml");
xmlData.onLoad = obrabotka_xml;
function obrabotka_xml(success) {
if (success) {
xmlNode = xmlData;
total = xmlNode.childNodes.length;
trace(xmlNode.childNodes[0].childNodes[0].childNodes.toString());
} else {
trace("File not found!");
}
}
А trace мне выдаёт:
<b> Welcome to Macromedia Flash MX 2004 and Macromedia Flash MX </b>, Professional 2004. Flash provides everything you need to create and deliver rich web content and powerful applications. Whether you&apos;re designing motion graphics or building data-driven applications, Flash has the tools necessary to produce great results and deliver the best user experience across multiple platforms and devices.

Откуда эта запятая??? Как её убрать? Чудеса какие-то :)

iNils
21.09.2005, 02:02
В данном случаи у тебя идет перечисление нодов, а перечисляются они через запятую.

mixey_lv
21.09.2005, 02:31
А как тогда достучаться именно до того нода? Чтобы получить его значение со всеми внутренними тэгами? Вообщем также, но без этих запятых после закрытия тэга
*help*

7thsky™
21.09.2005, 02:42
<sub_element big_pic="gallery_pictures/pictures/cookinlet.jpg" thumbnail="gallery_pictures/thumbnails/cookinletpreview.jpg"><![CDATA[<b> Welcome to Macromedia Flash MX 2004 and Macromedia Flash MX </b> Professional 2004. Flash provides everything you need to create and deliver rich web content and powerful applications. Whether you're designing motion graphics or building data-driven applications, Flash has the tools necessary to produce great results and deliver the best user experience across multiple platforms and devices.]]></sub_element>

iNils
21.09.2005, 02:53
// мой пример
xmlData = new XML ('<sub_element><![CDATA[<b>1</b>2<b>3</b>]]></sub_element>');
xmlData.ignoreWhite = true;
xmlNode = xmlData;
total = xmlNode.childNodes.length;
_root.createTextField ("txt", 0, 0, 0, 200, 50);
txt.html = true;
txt.htmlText = xmlNode.childNodes[0].childNodes[0].nodeValue;
// твой пример
xmlData2 = new XML ('<sub_element><b>1</b>2<b>3</b></sub_element>');
xmlData2.ignoreWhite = true;
xmlNode2 = xmlData2;
total = xmlNode2.childNodes.length;
_root.createTextField ("txt2", 1, 0, 100, 200, 50);
txt2.html = true;
txt2.htmlText = xmlNode2.childNodes[0].childNodes;

mixey_lv
21.09.2005, 13:15
Спасибо ребята! С вашей помощью всё получилось!
пасиб!