Ask a Question related to Macromedia Flash, Design and Development.
-
hsin #1
help newbie with reading XML problem
I try to read the value from XML file,
it read, but come out all wrong, I don't understand why, here is the code,
can someone help me out?
thanks ahead!
Willy
AS code
===========================
my_XML = new XML();
my_XML.onLoad = convertXML;
my_display = "Loading data ... ";
my_XML.load("data.xml");
var fileList = new Array();
var thumList = new Array();
var nViewList = new Array();
var cViewList = new Array();
var titleList = new Array();
var detailList = new Array();
var editionList = new Array();
var madeList = new Array();
var dateList = new Array();
function convertXML() {
if (this.loaded) {
my_display = "Data loaded.";
}
var mainTag = new XML();
var imageTag = new XML();
var no_i = 0;
var mainTag = this.firstChild.nextSibling;
if (mainTag.nodeName.toLowerCase() == "files") {
fileList = mainTag.childNodes;
my_display = "";
for (i=0; i<=mainTag.childNodes.length; i++) {
my_display = "---"+mainTag.childNodes.length;
if (fileList[i].nodeName.toLowerCase() == "image") {
//we get the child node array beneath the articles, aka the meat and
potatoes we are after
imageList = fileList[i].childNodes;
//and loop through that looking for the data we need
for (j=1; j<=imageList.length; j++) {
imageTag = imageList[j];
myTitle="<br>"+imageList.length;
imageType = imageTag.nodeName.toLowerCase();
if (imageType == "filename") {
fileList[no_i] = imageTag.firstChild.nodeValue;
no_i++;
}
if (imageType == "thumbnail") {
thumList[no_i-1] = imageTag.firstChild.nodeValue;
}
if (imageType == "normalview") {
nViewList[no_i-1] = imageTag.firstChild.nodeValue;
}
if (imageType == "closeview") {
cViewList[no_i-1] = imageTag.firstChild.nodeValue;
}
if (imageType == "detail") {
detailList[no_i-1] = imageTag.firstChild.nodeValue;
}
if (imageType == "title") {
titleList[no_i-1] = imageTag.firstChild.nodeValue;
}
if (imageType == "edition") {
editionList[no_i-1] = imageTag.firstChild.nodeValue;
}
if (imageType == "made") {
madeList[no_i-1] = imageTag.firstChild.nodeValue;
}
if (imageType == "date") {
dateList[no_i-1] = imageTag.firstChild.nodeValue;
}
}
// end for j
}
// end if image
}
// end for i
}
// end if files
for (i=0; i<=fileList.length; i++) {
//i_list += "<br>i="+i+" "+"<br>i="+fileList[i]+"<br>i="+i+"
"+thumList[i]+"<br>i="+i+" "+nViewList[i]+"<br>i="+i+"
"+cViewList[i]+"<br>i="+i+" "+detailList[i]+"<br>i="+i+"
"+titleList[i]+"<br>i="+i+" "+madeList[i]+"<br>i="+i+"
"+dateList[i]+"<br><br>==============<br><br>";
i_list +=
"i="+i+"<br>"+"fileList="+fileList[i]+"<br>"+"thumList="+thumList[i]+"<br>"+
"nViewList="+nViewList[i]+"<br>"+"cViewList="+cViewList[i]+"<br>"+"detailLis
t="+detailList[i]+"<br>"+"titleList="+titleList[i]+"<br>"+"madeList="+madeLi
st[i]+"<br>"+"dateList="+dateList[i]+"<br>"+"<br><br>==============<br><br>"
;
}
}
===========================
XML file
============================
<?xml version="1.0" encoding="utf-8"?>
<files>
<image id="1">
<filename>01</filename>
<thumbnail>images/1_0.jpg</thumbnail>
<normalview>images/1_1.jpg</normalview>
<closeview>images/1_2.jpg</closeview>
<title>Marble Series, No. three</title>
<detail xml:space="preserve">The marbles remind me of my playful
youth,
but they also are symbolic of my maturation; most scattered marbles
contain
a Chinese brush painted lotus or venerable-Buddhist symbols that
represent my goal of gradual enlightenment.</detail>
<edition>40" * 59", 8 editions</edition>
<made>ink jet print on acetate or mount on plexi glass</made>
<date>2003/2004</date>
</image>
<image id="2">
<filename>02</filename>
<thumbnail>images/2_0.jpg</thumbnail>
<normalview>images/2_1.jpg</normalview>
<closeview>images/2_2.jpg</closeview>
<title>Marble Series, No. three</title>
<detail>The marbles remind me of my playful youth, but they also are
symbolic of my maturation; most scattered marbles contain a Chinese brush
painted lotus or venerable-Buddhist symbols that represent my goal of
gradual enlightenment.</detail>
<edition>40" * 59", 8 editions</edition>
<made>ink jet print on acetate or mount on plexi glass</made>
<date>2003/2004</date>
</image>
<image id="3">
<filename>03</filename>
<thumbnail>images/3_0.jpg</thumbnail>
<normalview>images/3_1.jpg</normalview>
<closeview>images/3_2.jpg</closeview>
<title>Marble Series, No. three</title>
<detail>The marbles remind me of my playful youth, but they also are
symbolic of my maturation; most scattered marbles contain a Chinese brush
painted lotus or venerable-Buddhist symbols that represent my goal of
gradual enlightenment.</detail>
<edition>40" * 59", 8 editions</edition>
<made>ink jet print on acetate or mount on plexi glass</made>
<date>2003/2004</date>
</image>
<image id="4">
<filename>04</filename>
<thumbnail>images/4_0.jpg</thumbnail>
<normalview>images/4_1.jpg</normalview>
<closeview>images/4_2.jpg</closeview>
<title>Marble Series, No. three</title>
<detail>The marbles remind me of my playful youth, but they also are
symbolic of my maturation; most scattered marbles contain a Chinese brush
painted lotus or venerable-Buddhist symbols that represent my goal of
gradual enlightenment.</detail>
<edition>40" * 59", 8 editions</edition>
<made>ink jet print on acetate or mount on plexi glass</made>
<date>2003/2004</date>
</image>
<image id="5">
<filename>05</filename>
<thumbnail>images/5_0.jpg</thumbnail>
<normalview>images/5_1.jpg</normalview>
<closeview>images/5_2.jpg</closeview>
<title>Marble Series, No. three</title>
<detail>The marbles remind me of my playful youth, but they also are
symbolic of my maturation; most scattered marbles contain a Chinese brush
painted lotus or venerable-Buddhist symbols that represent my goal of
gradual enlightenment.</detail>
<edition>40" * 59", 8 editions</edition>
<made>ink jet print on acetate or mount on plexi glass</made>
<date>2003/2004</date>
</image>
<image id="6">
<filename>06</filename>
<thumbnail>images/6_0.jpg</thumbnail>
<normalview>images/6_1.jpg</normalview>
<closeview>images/6_2.jpg</closeview>
<title>Marble Series, No. three</title>
<detail>The marbles remind me of my playful youth, but they also are
symbolic of my maturation; most scattered marbles contain a Chinese brush
painted lotus or venerable-Buddhist symbols that represent my goal of
gradual enlightenment.</detail>
<edition>40" * 59", 8 editions</edition>
<made>ink jet print on acetate or mount on plexi glass</made>
<date>2003/2004</date>
</image>
<image id="7">
<filename>07</filename>
<thumbnail>images/7_0.jpg</thumbnail>
<normalview>images/7_1.jpg</normalview>
<closeview>images/7_2.jpg</closeview>
<title>Marble Series, No. three</title>
<detail>The marbles remind me of my playful youth, but they also are
symbolic of my maturation; most scattered marbles contain a Chinese brush
painted lotus or venerable-Buddhist symbols that represent my goal of
gradual enlightenment.</detail>
<edition>40" * 59", 8 editions</edition>
<made>ink jet print on acetate or mount on plexi glass</made>
<date>2003/2004</date>
</image>
<image id="8">
<filename>08</filename>
<thumbnail>images/8_0.jpg</thumbnail>
<normalview>images/8_1.jpg</normalview>
<closeview>images/8_2.jpg</closeview>
<title>Marble Series, No. three</title>
<detail>The marbles remind me of my playful youth, but they also are
symbolic of my maturation; most scattered marbles contain a Chinese brush
painted lotus or venerable-Buddhist symbols that represent my goal of
gradual enlightenment.</detail>
<edition>40" * 59", 8 editions</edition>
<made>ink jet print on acetate or mount on plexi glass</made>
<date>2003/2004</date>
</image>
<image id="9">
<filename>09</filename>
<thumbnail>images/9_0.jpg</thumbnail>
<normalview>images/9_1.jpg</normalview>
<closeview>images/9_2.jpg</closeview>
<title>Marble Series, No. three</title>
<detail>The marbles remind me of my playful youth, but they also are
symbolic of my maturation; most scattered marbles contain a Chinese brush
painted lotus or venerable-Buddhist symbols that represent my goal of
gradual enlightenment.</detail>
<edition>40" * 59", 8 editions</edition>
<made>ink jet print on acetate or mount on plexi glass</made>
<date>2003/2004</date>
</image>
<image id="10">
<filename>10</filename>
<thumbnail>images/10_0.jpg</thumbnail>
<normalview>images/10_1.jpg</normalview>
<closeview>images/10_2.jpg</closeview>
<title>Marble Series, No. three</title>
<detail>The marbles remind me of my playful youth, but they also are
symbolic of my maturation; most scattered marbles contain a Chinese brush
painted lotus or venerable-Buddhist symbols that represent my goal of
gradual enlightenment.</detail>
<edition>40" * 59", 8 editions</edition>
<made>ink jet print on acetate or mount on plexi glass</made>
<date>2003/2004</date>
</image>
<image id="11">
<filename>11</filename>
<thumbnail>images/11_0.jpg</thumbnail>
<normalview>images/11_1.jpg</normalview>
<closeview>images/11_2.jpg</closeview>
<title>Marble Series, No. three</title>
<detail>The marbles remind me of my playful youth, but they also are
symbolic of my maturation; most scattered marbles contain a Chinese brush
painted lotus or venerable-Buddhist symbols that represent my goal of
gradual enlightenment.</detail>
<edition>40" * 59", 8 editions</edition>
<made>ink jet print on acetate or mount on plexi glass</made>
<date>2003/2004</date>
</image>
</files>
==============================
hsin Guest
-
Newbie asking for help - Reading a text file of qurantined emails and parsing contents.
Greetings. Please excuse this post if it is about something that is very simple or have been discussed before, as I am newbie in PHP, and failed... -
[newbie]saving and reading array of associative array
i'm looking for examples of saving to file and reading back an array of associative array, in a ruby like way. saying i have something like : ... -
newbie question: reading from mysql
Hi, I am trying to read some info from my mysql tables and display it. This is what I have now which works: $select = "SELECT `name` FROM... -
Newbie - Reading File Contents
Hi All - Can I get some help here. I am parsing a file delimited by |. For some reason the content is displayed to the browser properly - but the... -
newbie cocoa file reading/writing files
I am working on an application that presents only one window. This window contains a number of controls, and an NSTextView. I would like to... -
Samuria #2
Re: help newbie with reading XML problem
On Fri, 28 Jan 2005 11:45:04 -0500, "hsin" <hsinhsin@comcast.net>
wrote:
The easy way to do it is use a textarea and then use
content.multiline= true;
content.wordWrap = true;
content.html = true;
story = new XML();
story.ignoreWhite = true;
story.html = true;
story.wordWrap = true;
story.load("help.xml");
story.onLoad = function () {
content.htmlText = story;
}
you can see it working @
[url]http://www.janwright.co.uk/war[/url]
The secret is to use a stye sheet to do the formating ie
BODY {SCROLLBAR-FACE-COLOR: #8080FF; SCROLLBAR-HIGHLIGHT-COLOR:
#89A3B4; SCROLLBAR-SHADOW-COLOR: #000000; SCROLLBAR-3DLIGHT-COLOR:
#000000; SCROLLBAR-ARROW-COLOR: #FFFF80; SCROLLBAR-TRACK-COLOR:
#004080; SCROLLBAR-DARKSHADOW-COLOR: #000000; border: medium groove
#C0C0C0; cursor: default; outline: #f9bd64 ridge; accelerator: true;
border-style: groove groove ridge ridge; text-align: justify;
border-color: transparent; border-bottom-color: silver;
border-left-color: silver; border-right-color: gray; border-top-color:
gray; border-bottom-style: groove; border-left-style: groove;
border-right-style: ridge; border-top-style: ridge; border-top:
groove; border-right: ridge; border-bottom: ridge; border-left: ridge}
body, td, left, p, div {
font-family: verdana;
font-size: 9pt;
}
headline {font-family: Arial,Helvetica,sans-serif; font-size: 16px;
font-weight: bold; display: list-item; color: #0000CC}
subheadline {font-family: Arial,Helvetica,sans-serif; font-size: 12px;
font-weight: bold; display: list-item}
mainBody {font-family: Arial,Helvetica,sans-serif; font-size: 10px;
display: Block}
biline {
font-family: Arial,Helvetica,sans-serif; font-size: 8px; font-style:
italic; display:inline; }
A {
font-family: Arial,Helvetica,sans-serif; color: cccccc; font-size:
12px; display: table; text-decoration: underline}
>I try to read the value from XML file,
>it read, but come out all wrong, I don't understand why, here is the code,
>can someone help me out?
>thanks ahead!
>Willy
>
>AS code
>===========================
>my_XML = new XML();
>my_XML.onLoad = convertXML;
>my_display = "Loading data ... ";
>my_XML.load("data.xml");
>var fileList = new Array();
>var thumList = new Array();
>var nViewList = new Array();
>var cViewList = new Array();
>var titleList = new Array();
>var detailList = new Array();
>var editionList = new Array();
>var madeList = new Array();
>var dateList = new Array();
>function convertXML() {
> if (this.loaded) {
> my_display = "Data loaded.";
> }
> var mainTag = new XML();
> var imageTag = new XML();
> var no_i = 0;
> var mainTag = this.firstChild.nextSibling;
> if (mainTag.nodeName.toLowerCase() == "files") {
> fileList = mainTag.childNodes;
> my_display = "";
> for (i=0; i<=mainTag.childNodes.length; i++) {
> my_display = "---"+mainTag.childNodes.length;
> if (fileList[i].nodeName.toLowerCase() == "image") {
> //we get the child node array beneath the articles, aka the meat and
>potatoes we are after
> imageList = fileList[i].childNodes;
> //and loop through that looking for the data we need
> for (j=1; j<=imageList.length; j++) {
> imageTag = imageList[j];
> myTitle="<br>"+imageList.length;
> imageType = imageTag.nodeName.toLowerCase();
> if (imageType == "filename") {
> fileList[no_i] = imageTag.firstChild.nodeValue;
> no_i++;
> }
> if (imageType == "thumbnail") {
> thumList[no_i-1] = imageTag.firstChild.nodeValue;
> }
> if (imageType == "normalview") {
> nViewList[no_i-1] = imageTag.firstChild.nodeValue;
> }
> if (imageType == "closeview") {
> cViewList[no_i-1] = imageTag.firstChild.nodeValue;
> }
> if (imageType == "detail") {
> detailList[no_i-1] = imageTag.firstChild.nodeValue;
> }
> if (imageType == "title") {
> titleList[no_i-1] = imageTag.firstChild.nodeValue;
> }
> if (imageType == "edition") {
> editionList[no_i-1] = imageTag.firstChild.nodeValue;
> }
> if (imageType == "made") {
> madeList[no_i-1] = imageTag.firstChild.nodeValue;
> }
> if (imageType == "date") {
> dateList[no_i-1] = imageTag.firstChild.nodeValue;
> }
> }
> // end for j
> }
> // end if image
> }
> // end for i
> }
> // end if files
> for (i=0; i<=fileList.length; i++) {
> //i_list += "<br>i="+i+" "+"<br>i="+fileList[i]+"<br>i="+i+"
>"+thumList[i]+"<br>i="+i+" "+nViewList[i]+"<br>i="+i+"
>"+cViewList[i]+"<br>i="+i+" "+detailList[i]+"<br>i="+i+"
>"+titleList[i]+"<br>i="+i+" "+madeList[i]+"<br>i="+i+"
>"+dateList[i]+"<br><br>==============<br><br>";
> i_list +=
>"i="+i+"<br>"+"fileList="+fileList[i]+"<br>"+"thumList="+thumList[i]+"<br>"+
>"nViewList="+nViewList[i]+"<br>"+"cViewList="+cViewList[i]+"<br>"+"detailLis
>t="+detailList[i]+"<br>"+"titleList="+titleList[i]+"<br>"+"madeList="+madeLi
>st[i]+"<br>"+"dateList="+dateList[i]+"<br>"+"<br><br>==============<br><br>"
>;
> }
>}
>===========================
>
>XML file
>============================
><?xml version="1.0" encoding="utf-8"?>
><files>
> <image id="1">
> <filename>01</filename>
> <thumbnail>images/1_0.jpg</thumbnail>
> <normalview>images/1_1.jpg</normalview>
> <closeview>images/1_2.jpg</closeview>
> <title>Marble Series, No. three</title>
> <detail xml:space="preserve">The marbles remind me of my playful
>youth,
> but they also are symbolic of my maturation; most scattered marbles
>contain
> a Chinese brush painted lotus or venerable-Buddhist symbols that
> represent my goal of gradual enlightenment.</detail>
> <edition>40" * 59", 8 editions</edition>
> <made>ink jet print on acetate or mount on plexi glass</made>
> <date>2003/2004</date>
> </image>
> <image id="2">
> <filename>02</filename>
> <thumbnail>images/2_0.jpg</thumbnail>
> <normalview>images/2_1.jpg</normalview>
> <closeview>images/2_2.jpg</closeview>
> <title>Marble Series, No. three</title>
> <detail>The marbles remind me of my playful youth, but they also are
>symbolic of my maturation; most scattered marbles contain a Chinese brush
>painted lotus or venerable-Buddhist symbols that represent my goal of
>gradual enlightenment.</detail>
> <edition>40" * 59", 8 editions</edition>
> <made>ink jet print on acetate or mount on plexi glass</made>
> <date>2003/2004</date>
> </image>
> <image id="3">
> <filename>03</filename>
> <thumbnail>images/3_0.jpg</thumbnail>
> <normalview>images/3_1.jpg</normalview>
> <closeview>images/3_2.jpg</closeview>
> <title>Marble Series, No. three</title>
> <detail>The marbles remind me of my playful youth, but they also are
>symbolic of my maturation; most scattered marbles contain a Chinese brush
>painted lotus or venerable-Buddhist symbols that represent my goal of
>gradual enlightenment.</detail>
> <edition>40" * 59", 8 editions</edition>
> <made>ink jet print on acetate or mount on plexi glass</made>
> <date>2003/2004</date>
> </image>
> <image id="4">
> <filename>04</filename>
> <thumbnail>images/4_0.jpg</thumbnail>
> <normalview>images/4_1.jpg</normalview>
> <closeview>images/4_2.jpg</closeview>
> <title>Marble Series, No. three</title>
> <detail>The marbles remind me of my playful youth, but they also are
>symbolic of my maturation; most scattered marbles contain a Chinese brush
>painted lotus or venerable-Buddhist symbols that represent my goal of
>gradual enlightenment.</detail>
> <edition>40" * 59", 8 editions</edition>
> <made>ink jet print on acetate or mount on plexi glass</made>
> <date>2003/2004</date>
> </image>
> <image id="5">
> <filename>05</filename>
> <thumbnail>images/5_0.jpg</thumbnail>
> <normalview>images/5_1.jpg</normalview>
> <closeview>images/5_2.jpg</closeview>
> <title>Marble Series, No. three</title>
> <detail>The marbles remind me of my playful youth, but they also are
>symbolic of my maturation; most scattered marbles contain a Chinese brush
>painted lotus or venerable-Buddhist symbols that represent my goal of
>gradual enlightenment.</detail>
> <edition>40" * 59", 8 editions</edition>
> <made>ink jet print on acetate or mount on plexi glass</made>
> <date>2003/2004</date>
> </image>
> <image id="6">
> <filename>06</filename>
> <thumbnail>images/6_0.jpg</thumbnail>
> <normalview>images/6_1.jpg</normalview>
> <closeview>images/6_2.jpg</closeview>
> <title>Marble Series, No. three</title>
> <detail>The marbles remind me of my playful youth, but they also are
>symbolic of my maturation; most scattered marbles contain a Chinese brush
>painted lotus or venerable-Buddhist symbols that represent my goal of
>gradual enlightenment.</detail>
> <edition>40" * 59", 8 editions</edition>
> <made>ink jet print on acetate or mount on plexi glass</made>
> <date>2003/2004</date>
> </image>
> <image id="7">
> <filename>07</filename>
> <thumbnail>images/7_0.jpg</thumbnail>
> <normalview>images/7_1.jpg</normalview>
> <closeview>images/7_2.jpg</closeview>
> <title>Marble Series, No. three</title>
> <detail>The marbles remind me of my playful youth, but they also are
>symbolic of my maturation; most scattered marbles contain a Chinese brush
>painted lotus or venerable-Buddhist symbols that represent my goal of
>gradual enlightenment.</detail>
> <edition>40" * 59", 8 editions</edition>
> <made>ink jet print on acetate or mount on plexi glass</made>
> <date>2003/2004</date>
> </image>
> <image id="8">
> <filename>08</filename>
> <thumbnail>images/8_0.jpg</thumbnail>
> <normalview>images/8_1.jpg</normalview>
> <closeview>images/8_2.jpg</closeview>
> <title>Marble Series, No. three</title>
> <detail>The marbles remind me of my playful youth, but they also are
>symbolic of my maturation; most scattered marbles contain a Chinese brush
>painted lotus or venerable-Buddhist symbols that represent my goal of
>gradual enlightenment.</detail>
> <edition>40" * 59", 8 editions</edition>
> <made>ink jet print on acetate or mount on plexi glass</made>
> <date>2003/2004</date>
> </image>
> <image id="9">
> <filename>09</filename>
> <thumbnail>images/9_0.jpg</thumbnail>
> <normalview>images/9_1.jpg</normalview>
> <closeview>images/9_2.jpg</closeview>
> <title>Marble Series, No. three</title>
> <detail>The marbles remind me of my playful youth, but they also are
>symbolic of my maturation; most scattered marbles contain a Chinese brush
>painted lotus or venerable-Buddhist symbols that represent my goal of
>gradual enlightenment.</detail>
> <edition>40" * 59", 8 editions</edition>
> <made>ink jet print on acetate or mount on plexi glass</made>
> <date>2003/2004</date>
> </image>
> <image id="10">
> <filename>10</filename>
> <thumbnail>images/10_0.jpg</thumbnail>
> <normalview>images/10_1.jpg</normalview>
> <closeview>images/10_2.jpg</closeview>
> <title>Marble Series, No. three</title>
> <detail>The marbles remind me of my playful youth, but they also are
>symbolic of my maturation; most scattered marbles contain a Chinese brush
>painted lotus or venerable-Buddhist symbols that represent my goal of
>gradual enlightenment.</detail>
> <edition>40" * 59", 8 editions</edition>
> <made>ink jet print on acetate or mount on plexi glass</made>
> <date>2003/2004</date>
> </image>
> <image id="11">
> <filename>11</filename>
> <thumbnail>images/11_0.jpg</thumbnail>
> <normalview>images/11_1.jpg</normalview>
> <closeview>images/11_2.jpg</closeview>
> <title>Marble Series, No. three</title>
> <detail>The marbles remind me of my playful youth, but they also are
>symbolic of my maturation; most scattered marbles contain a Chinese brush
>painted lotus or venerable-Buddhist symbols that represent my goal of
>gradual enlightenment.</detail>
> <edition>40" * 59", 8 editions</edition>
> <made>ink jet print on acetate or mount on plexi glass</made>
> <date>2003/2004</date>
> </image>
></files>
>
>==============================
>Samuria Guest
-
hsin #3
Re: help newbie with reading XML problem
thanks for the help, I think i didn't make it clear what is wrong with my
code,
i mean after my code read the XML file, all the elements are mess up.
"Samuria" <samuria@rock.com> wrote in message
news:mcflv0tca0gdb2er2s2h7ri6f8bqdmbsbf@4ax.com...code,> On Fri, 28 Jan 2005 11:45:04 -0500, "hsin" <hsinhsin@comcast.net>
> wrote:
>
> The easy way to do it is use a textarea and then use
>
> content.multiline= true;
> content.wordWrap = true;
> content.html = true;
>
> story = new XML();
> story.ignoreWhite = true;
> story.html = true;
> story.wordWrap = true;
> story.load("help.xml");
> story.onLoad = function () {
> content.htmlText = story;
> }
>
> you can see it working @
> [url]http://www.janwright.co.uk/war[/url]
>
> The secret is to use a stye sheet to do the formating ie
> BODY {SCROLLBAR-FACE-COLOR: #8080FF; SCROLLBAR-HIGHLIGHT-COLOR:
> #89A3B4; SCROLLBAR-SHADOW-COLOR: #000000; SCROLLBAR-3DLIGHT-COLOR:
> #000000; SCROLLBAR-ARROW-COLOR: #FFFF80; SCROLLBAR-TRACK-COLOR:
> #004080; SCROLLBAR-DARKSHADOW-COLOR: #000000; border: medium groove
> #C0C0C0; cursor: default; outline: #f9bd64 ridge; accelerator: true;
> border-style: groove groove ridge ridge; text-align: justify;
> border-color: transparent; border-bottom-color: silver;
> border-left-color: silver; border-right-color: gray; border-top-color:
> gray; border-bottom-style: groove; border-left-style: groove;
> border-right-style: ridge; border-top-style: ridge; border-top:
> groove; border-right: ridge; border-bottom: ridge; border-left: ridge}
> body, td, left, p, div {
> font-family: verdana;
> font-size: 9pt;
> }
> headline {font-family: Arial,Helvetica,sans-serif; font-size: 16px;
> font-weight: bold; display: list-item; color: #0000CC}
> subheadline {font-family: Arial,Helvetica,sans-serif; font-size: 12px;
> font-weight: bold; display: list-item}
> mainBody {font-family: Arial,Helvetica,sans-serif; font-size: 10px;
> display: Block}
> biline {
> font-family: Arial,Helvetica,sans-serif; font-size: 8px; font-style:
> italic; display:inline; }
> A {
> font-family: Arial,Helvetica,sans-serif; color: cccccc; font-size:
> 12px; display: table; text-decoration: underline}
>
>> >I try to read the value from XML file,
> >it read, but come out all wrong, I don't understand why, here is the+>> >can someone help me out?
> >thanks ahead!
> >Willy
> >
> >AS code
> >===========================
> >my_XML = new XML();
> >my_XML.onLoad = convertXML;
> >my_display = "Loading data ... ";
> >my_XML.load("data.xml");
> >var fileList = new Array();
> >var thumList = new Array();
> >var nViewList = new Array();
> >var cViewList = new Array();
> >var titleList = new Array();
> >var detailList = new Array();
> >var editionList = new Array();
> >var madeList = new Array();
> >var dateList = new Array();
> >function convertXML() {
> > if (this.loaded) {
> > my_display = "Data loaded.";
> > }
> > var mainTag = new XML();
> > var imageTag = new XML();
> > var no_i = 0;
> > var mainTag = this.firstChild.nextSibling;
> > if (mainTag.nodeName.toLowerCase() == "files") {
> > fileList = mainTag.childNodes;
> > my_display = "";
> > for (i=0; i<=mainTag.childNodes.length; i++) {
> > my_display = "---"+mainTag.childNodes.length;
> > if (fileList[i].nodeName.toLowerCase() == "image") {
> > //we get the child node array beneath the articles, aka the meat and
> >potatoes we are after
> > imageList = fileList[i].childNodes;
> > //and loop through that looking for the data we need
> > for (j=1; j<=imageList.length; j++) {
> > imageTag = imageList[j];
> > myTitle="<br>"+imageList.length;
> > imageType = imageTag.nodeName.toLowerCase();
> > if (imageType == "filename") {
> > fileList[no_i] = imageTag.firstChild.nodeValue;
> > no_i++;
> > }
> > if (imageType == "thumbnail") {
> > thumList[no_i-1] = imageTag.firstChild.nodeValue;
> > }
> > if (imageType == "normalview") {
> > nViewList[no_i-1] = imageTag.firstChild.nodeValue;
> > }
> > if (imageType == "closeview") {
> > cViewList[no_i-1] = imageTag.firstChild.nodeValue;
> > }
> > if (imageType == "detail") {
> > detailList[no_i-1] = imageTag.firstChild.nodeValue;
> > }
> > if (imageType == "title") {
> > titleList[no_i-1] = imageTag.firstChild.nodeValue;
> > }
> > if (imageType == "edition") {
> > editionList[no_i-1] = imageTag.firstChild.nodeValue;
> > }
> > if (imageType == "made") {
> > madeList[no_i-1] = imageTag.firstChild.nodeValue;
> > }
> > if (imageType == "date") {
> > dateList[no_i-1] = imageTag.firstChild.nodeValue;
> > }
> > }
> > // end for j
> > }
> > // end if image
> > }
> > // end for i
> > }
> > // end if files
> > for (i=0; i<=fileList.length; i++) {
> > //i_list += "<br>i="+i+" "+"<br>i="+fileList[i]+"<br>i="+i+"
> >"+thumList[i]+"<br>i="+i+" "+nViewList[i]+"<br>i="+i+"
> >"+cViewList[i]+"<br>i="+i+" "+detailList[i]+"<br>i="+i+"
> >"+titleList[i]+"<br>i="+i+" "+madeList[i]+"<br>i="+i+"
> >"+dateList[i]+"<br><br>==============<br><br>";
> > i_list +=
>"i="+i+"<br>"+"fileList="+fileList[i]+"<br>"+"thumList="+thumList[i]+"<br>"s>
>"nViewList="+nViewList[i]+"<br>"+"cViewList="+cViewList[i]+"<br>"+"detailLii>
>t="+detailList[i]+"<br>"+"titleList="+titleList[i]+"<br>"+"madeList="+madeL">
>st[i]+"<br>"+"dateList="+dateList[i]+"<br>"+"<br><br>==============<br><br>are> >;
> > }
> >}
> >===========================
> >
> >XML file
> >============================
> ><?xml version="1.0" encoding="utf-8"?>
> ><files>
> > <image id="1">
> > <filename>01</filename>
> > <thumbnail>images/1_0.jpg</thumbnail>
> > <normalview>images/1_1.jpg</normalview>
> > <closeview>images/1_2.jpg</closeview>
> > <title>Marble Series, No. three</title>
> > <detail xml:space="preserve">The marbles remind me of my playful
> >youth,
> > but they also are symbolic of my maturation; most scattered marbles
> >contain
> > a Chinese brush painted lotus or venerable-Buddhist symbols that
> > represent my goal of gradual enlightenment.</detail>
> > <edition>40" * 59", 8 editions</edition>
> > <made>ink jet print on acetate or mount on plexi glass</made>
> > <date>2003/2004</date>
> > </image>
> > <image id="2">
> > <filename>02</filename>
> > <thumbnail>images/2_0.jpg</thumbnail>
> > <normalview>images/2_1.jpg</normalview>
> > <closeview>images/2_2.jpg</closeview>
> > <title>Marble Series, No. three</title>
> > <detail>The marbles remind me of my playful youth, but they alsoare> >symbolic of my maturation; most scattered marbles contain a Chinese brush
> >painted lotus or venerable-Buddhist symbols that represent my goal of
> >gradual enlightenment.</detail>
> > <edition>40" * 59", 8 editions</edition>
> > <made>ink jet print on acetate or mount on plexi glass</made>
> > <date>2003/2004</date>
> > </image>
> > <image id="3">
> > <filename>03</filename>
> > <thumbnail>images/3_0.jpg</thumbnail>
> > <normalview>images/3_1.jpg</normalview>
> > <closeview>images/3_2.jpg</closeview>
> > <title>Marble Series, No. three</title>
> > <detail>The marbles remind me of my playful youth, but they alsoare> >symbolic of my maturation; most scattered marbles contain a Chinese brush
> >painted lotus or venerable-Buddhist symbols that represent my goal of
> >gradual enlightenment.</detail>
> > <edition>40" * 59", 8 editions</edition>
> > <made>ink jet print on acetate or mount on plexi glass</made>
> > <date>2003/2004</date>
> > </image>
> > <image id="4">
> > <filename>04</filename>
> > <thumbnail>images/4_0.jpg</thumbnail>
> > <normalview>images/4_1.jpg</normalview>
> > <closeview>images/4_2.jpg</closeview>
> > <title>Marble Series, No. three</title>
> > <detail>The marbles remind me of my playful youth, but they alsoare> >symbolic of my maturation; most scattered marbles contain a Chinese brush
> >painted lotus or venerable-Buddhist symbols that represent my goal of
> >gradual enlightenment.</detail>
> > <edition>40" * 59", 8 editions</edition>
> > <made>ink jet print on acetate or mount on plexi glass</made>
> > <date>2003/2004</date>
> > </image>
> > <image id="5">
> > <filename>05</filename>
> > <thumbnail>images/5_0.jpg</thumbnail>
> > <normalview>images/5_1.jpg</normalview>
> > <closeview>images/5_2.jpg</closeview>
> > <title>Marble Series, No. three</title>
> > <detail>The marbles remind me of my playful youth, but they alsoare> >symbolic of my maturation; most scattered marbles contain a Chinese brush
> >painted lotus or venerable-Buddhist symbols that represent my goal of
> >gradual enlightenment.</detail>
> > <edition>40" * 59", 8 editions</edition>
> > <made>ink jet print on acetate or mount on plexi glass</made>
> > <date>2003/2004</date>
> > </image>
> > <image id="6">
> > <filename>06</filename>
> > <thumbnail>images/6_0.jpg</thumbnail>
> > <normalview>images/6_1.jpg</normalview>
> > <closeview>images/6_2.jpg</closeview>
> > <title>Marble Series, No. three</title>
> > <detail>The marbles remind me of my playful youth, but they alsoare> >symbolic of my maturation; most scattered marbles contain a Chinese brush
> >painted lotus or venerable-Buddhist symbols that represent my goal of
> >gradual enlightenment.</detail>
> > <edition>40" * 59", 8 editions</edition>
> > <made>ink jet print on acetate or mount on plexi glass</made>
> > <date>2003/2004</date>
> > </image>
> > <image id="7">
> > <filename>07</filename>
> > <thumbnail>images/7_0.jpg</thumbnail>
> > <normalview>images/7_1.jpg</normalview>
> > <closeview>images/7_2.jpg</closeview>
> > <title>Marble Series, No. three</title>
> > <detail>The marbles remind me of my playful youth, but they alsoare> >symbolic of my maturation; most scattered marbles contain a Chinese brush
> >painted lotus or venerable-Buddhist symbols that represent my goal of
> >gradual enlightenment.</detail>
> > <edition>40" * 59", 8 editions</edition>
> > <made>ink jet print on acetate or mount on plexi glass</made>
> > <date>2003/2004</date>
> > </image>
> > <image id="8">
> > <filename>08</filename>
> > <thumbnail>images/8_0.jpg</thumbnail>
> > <normalview>images/8_1.jpg</normalview>
> > <closeview>images/8_2.jpg</closeview>
> > <title>Marble Series, No. three</title>
> > <detail>The marbles remind me of my playful youth, but they alsoare> >symbolic of my maturation; most scattered marbles contain a Chinese brush
> >painted lotus or venerable-Buddhist symbols that represent my goal of
> >gradual enlightenment.</detail>
> > <edition>40" * 59", 8 editions</edition>
> > <made>ink jet print on acetate or mount on plexi glass</made>
> > <date>2003/2004</date>
> > </image>
> > <image id="9">
> > <filename>09</filename>
> > <thumbnail>images/9_0.jpg</thumbnail>
> > <normalview>images/9_1.jpg</normalview>
> > <closeview>images/9_2.jpg</closeview>
> > <title>Marble Series, No. three</title>
> > <detail>The marbles remind me of my playful youth, but they alsoare> >symbolic of my maturation; most scattered marbles contain a Chinese brush
> >painted lotus or venerable-Buddhist symbols that represent my goal of
> >gradual enlightenment.</detail>
> > <edition>40" * 59", 8 editions</edition>
> > <made>ink jet print on acetate or mount on plexi glass</made>
> > <date>2003/2004</date>
> > </image>
> > <image id="10">
> > <filename>10</filename>
> > <thumbnail>images/10_0.jpg</thumbnail>
> > <normalview>images/10_1.jpg</normalview>
> > <closeview>images/10_2.jpg</closeview>
> > <title>Marble Series, No. three</title>
> > <detail>The marbles remind me of my playful youth, but they alsoare> >symbolic of my maturation; most scattered marbles contain a Chinese brush
> >painted lotus or venerable-Buddhist symbols that represent my goal of
> >gradual enlightenment.</detail>
> > <edition>40" * 59", 8 editions</edition>
> > <made>ink jet print on acetate or mount on plexi glass</made>
> > <date>2003/2004</date>
> > </image>
> > <image id="11">
> > <filename>11</filename>
> > <thumbnail>images/11_0.jpg</thumbnail>
> > <normalview>images/11_1.jpg</normalview>
> > <closeview>images/11_2.jpg</closeview>
> > <title>Marble Series, No. three</title>
> > <detail>The marbles remind me of my playful youth, but they also>> >symbolic of my maturation; most scattered marbles contain a Chinese brush
> >painted lotus or venerable-Buddhist symbols that represent my goal of
> >gradual enlightenment.</detail>
> > <edition>40" * 59", 8 editions</edition>
> > <made>ink jet print on acetate or mount on plexi glass</made>
> > <date>2003/2004</date>
> > </image>
> ></files>
> >
> >==============================
> >
hsin Guest



Reply With Quote

