www.webdeveloper.com
Results 1 to 4 of 4

Thread: Display XML in Textarea

  1. #1
    Join Date
    May 2004
    Posts
    37

    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:
    PHP Code:
    <!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 {
        
    height10em;
        
    width20em;
    }

    -->
    </
    style>
    </
    head>
    <
    body>
    <
    textarea class="unnamed1" datasrc="#Txt" datafld="Title"></textarea>
    </
    body>
    </
    html
    XML code:
    PHP Code:
    <?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>
    ta,
    jbw

  2. #2
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    This has AJAX written all over it.

  3. #3
    Join Date
    May 2004
    Posts
    37
    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.

  4. #4
    Join Date
    May 2004
    Posts
    37
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles