/    Sign up×
Community /Pin to ProfileBookmark

Reading from XML

my xml file

[CODE]<note>
<Link>http://www.webdeveloper.com</Link>
<Word>JS</Word>
<Forum>javascript</Forum>
<Post>bilen</Post>
</note>
<note>
<Link>http://www.url.com</Link>
<Word>JS</Word>
<Forum>javascript</Forum>
<Post>bilen</Post>
</note>[/CODE]

i read first <note> sectiom with

[CODE]<script type=”text/javascript”
for=”window” event=”onload”>

var xmlDoc=new ActiveXObject(“Microsoft.XMLDOM”)
xmlDoc.async=”false”
xmlDoc.load(“xml_note.xml”)

nodes=xmlDoc.documentElement.childNodes
link.innerText= nodes.item(0).text
word.innerText= nodes.item(1).text
forum.innerText= nodes.item(2).text
post.innerText= nodes.item(3).text

</script>

<title>HTML using XML data</title>
</head>
<body bgcolor=”yellow”>

<h1>W3Schools.com Internal Note</h1>

<b>url: </b>
<span id=”link”> </span>
<br />
<b>word: </b>
<span id=”word”></span>
<hr>
<b>forum : <b>
<b><span id=”forum”></span></b>
<hr>
<b> post: <b>
<span id=”post”></span>
</body>[/CODE]

but how to read the second <note> section ??????????????

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Jun 15.2006 — Man, you really only code for IE eh!

Keep going through the child nodes or look into getElementsByTagName().

I think you need to look into document.getElementById("theID") when you are setting the innerHTML of an element. And also look into the XMLHttpRequest Object with responseXML when loading an XML document. Just some hints. Also get Firefox!

Eric
Copy linkTweet thisAlerts:
@bilenauthorJun 15.2006 — i am making a copy of intellitext ad for a corporation ?

everythingsi s finished but my boss wants me to do everything with js becasue of server performance ?

i made same thing with vb.net but i am trying to do it with js and xml

i wish i do it.

only reading xml didint compalte but i will do it i think thx
×

Success!

Help @bilen spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...