# Help with xml

**URL:** <https://forum.kirupa.com/t/help-with-xml/154755>\
**Category:** flash\
**Created:** [July 12, 2005, 2:19pm UTC](https://forum.kirupa.com/t/help-with-xml/154755 "2005-07-12T14:19:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![inzane](https://avatars.discourse-cdn.com/v4/letter/i/b38774/32.png) [@inzane](https://forum.kirupa.com/u/inzane)\
**Post date:** [July 12, 2005, 2:19pm UTC](https://forum.kirupa.com/t/help-with-xml/154755/1 "2005-07-12T14:19:49Z")

</div>

I have 2 questions

**Question 1;**  
I’m having a problem attaching the .CSS to my content. here is my code

**The .CSS “mazda\_compare.css”**

> 

name {  
color: #ffffff;  
font-family: Tahoma;  
font-size: 18px;  
font-weight: bold;  
display: block;  
}  
comment {  
color: #ffffff;  
font-family: Tahoma;  
font-size: 14px;  
font-weight: normal;  
display: block;  
}

**The XML file “car1.xml”**

> \<?xml version=“1.0”?\>  
> \<compare\>  
> \<vehicle\>  
> \<name\>Mazda 6 Sedan\</name\>  
> \<comment\>The Mazda 6 Sedan;is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file. \</comment\>  
> \</vehicle\>  
> \</compare\>

[color=black] **Script** [/color]

> 

//init TextArea component  
comment\_txt.html = true;  
comment\_txt.wordWrap = true;  
comment\_txt.multiline = true;  
comment\_txt.label.condenseWhite=true;  
//load css  
compareStyle = new TextField.StyleSheet();  
compareStyle.load(“mazda\_compare.css”);  
name\_txt.styleSheet = compareStyle;  
comment\_txt.styleSheet = compareStyle;  
//load xml  
function loadXML(loaded) {  
if (loaded) {  
\_root.vehicle = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;  
\_root.comments = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;  
name\_txt.text = \_root.vehicle;  
comment\_txt.text = \_root.comments;  
} else {  
trace(“file not loaded!”);  
}  
}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“car1.xml”);

I have 2 dynamic boxes where the text show up but the css is not applied  
name\_txt  
comment\_txt

can any one figure out why?

**Question 2;**  
I want to also incorporate an image aswell what are the steps…  
I have seen tons of tuts with galleries but no luck…

when I do the following it does not work

**The XML file “car1.xml”**

> \<?xml version=“1.0”?\>  
> \<compare\>  
> \<vehicle\>  
> \<name\>Mazda 6 Sedan\</name\>  
> \<comment\>The Mazda 6 Sedan;is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file.The Mazda 6 SDN is a great working file. \</comment\>  
> \<image\>mazda6.jpg\</image\>  
> \</vehicle\>  
> \</compare\>

[color=black] **Script** [/color]

> 

//init TextArea component  
comment\_txt.html = true;  
comment\_txt.wordWrap = true;  
comment\_txt.multiline = true;  
comment\_txt.label.condenseWhite=true;  
//load css  
compareStyle = new TextField.StyleSheet();  
compareStyle.load(“mazda\_compare.css”);  
name\_txt.styleSheet = compareStyle;  
comment\_txt.styleSheet = compareStyle;  
//load xml  
function loadXML(loaded) {  
if (loaded) {  
\_root.vehicle = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;  
\_root.comments = this.firstChild.childNodes[0].childNode[1].firstChild.nodeValue;  
\_root.image = this.firstChild.childNodes[0].childNode[2].firstChild.nodeValue;  
name\_txt.text = \_root.vehicle;  
comment\_txt.text = \_root.comments;  
picture\_holder.loadMovie(image);  
} else {  
trace(“file not loaded!”);  
}  
}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“car1.xml”);

I made an empty MC and called it picture\_holder but when I test the movie nothing happens…  
I’m getting my \*\*\* kicked here can any1 help?
