# Importing xml and styling with css

**URL:** <https://forum.kirupa.com/t/importing-xml-and-styling-with-css/275766>\
**Category:** Uncategorized\
**Created:** [November 18, 2008, 3:23pm UTC](https://forum.kirupa.com/t/importing-xml-and-styling-with-css/275766 "2008-11-18T15:23:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![piratesage](https://avatars.discourse-cdn.com/v4/letter/p/ea5d25/32.png) [@piratesage](https://forum.kirupa.com/u/piratesage)\
**Post date:** [November 18, 2008, 3:23pm UTC](https://forum.kirupa.com/t/importing-xml-and-styling-with-css/275766/1 "2008-11-18T15:23:28Z")

</div>

I’m trying to just figure out how to style text imported via xml with css. Here’s the code I have. It imports the XML just fine, but there is no style. I’ve also included the xml + css files.

Any ideas?

Actionscript:

```auto

import flash.text.StyleSheet;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;

loadCSS();

function loadCSS() {
	trace("loadCSS");
	var cssLoader:URLLoader = new URLLoader();
	cssLoader.load(new URLRequest("test.css"));
	cssLoader.addEventListener(Event.COMPLETE, cssComplete);
}

function cssComplete(e:Event) {
	trace("cssComplete");
	var sheet:StyleSheet = new StyleSheet();
	sheet.parseCSS(e.target.data);
	textObj.styleSheet = sheet;
	
	loadXML();
}

function loadXML() {
	trace("loadXML");
	var xmlLoader:URLLoader = new URLLoader();
	xmlLoader.load(new URLRequest("forcss.xml"));
	xmlLoader.addEventListener(Event.COMPLETE, xmlComplete);
}

function xmlComplete(e:Event):void {
	trace("xmlComplete");
	var xml:XML = new XML(e.target.data);
	textObj.htmlText = xml.point[0];
}

```

XML:

```auto

<?xml version="1.0" encoding="iso-8859-1"?>
<data>
    <point><=!=[=C=D=A=T=A=[<h1 class="test">Test</h1><br><br><p>test test test test </p><p>test test etst ste</p>]=]=></point>
</data>    

```

CSS:

```auto

.test {
    font-size: 20px;
    color: #0000ff;
}

```
