/    Sign up×
Community /Pin to ProfileBookmark

Display XML in Textarea

I’m having a play with xml and considering using it as a way to allow updates to a news page without having to edit the html file itself.
So I searched this site and found enough info to get the xml to display in a textarea. It could be that I’m going about this all wrong but I can’t work out how to get a text area to display multiple datafields from an xml file.
This is solely so I can make the titles display in bold and the content normal. If any one has any better suggestions for doing this, then I’m all ears.

HTML code:

[code=php]<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
“http://www.w3.org/TR/html4/loose.dtd”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<title>Text Area with content from external file</title>
<xml id=”Txt” src=”news.xml”></xml>
<style type=”text/css”>
<!–
.unnamed1 {
height: 10em;
width: 20em;
}

–>
</style>
</head>
<body>
<textarea class=”unnamed1″ datasrc=”#Txt” datafld=”Title”></textarea>
</body>
</html>[/code]

XML code:

[code=php]<?xml version=”1.0″ encoding=”UTF-8″?>
<TextOnly>
<Title>This is my title</Title>
<Content>This xml file will display the latest news.</Content>
</TextOnly>[/code]

ta,
jbw

to post a comment
HTML

3 Comments(s)

Copy linkTweet thisAlerts:
@ray326Feb 22.2006 — This has AJAX written all over it.
Copy linkTweet thisAlerts:
@jbwauthorFeb 22.2006 — I hope you mean Asynchronous JavaScript And XML? Atleast that's what google has given me. I'll go check it out.

Many thanks for the heads up. ?
Copy linkTweet thisAlerts:
@jbwauthorFeb 23.2006 — Ok. I'm making small steps... very slowly. ?

I've found a couple of very detailed sites that explain how to read and write to xml using AJAX and I've managed to get an entire xml document to load (i.e. both the news titles and news content tags) in my simple webpage. But when it loads I can't get it to apply styles to the news content. I placed a css reference in the xml file and if I load the xml file in the browser it looks correct.

Can someone give a newbie a nudge in the right direction please? ?

ta,

jbw
×

Success!

Help @jbw 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.23,
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,
)...