Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# HTTP
I've got a program that loads the XML time of 1 hour from the site
I have to catch the response from the server, and at its base to launch an alert. Unfortunately the program can not add / expand. The only way that I can see is the capture.
But how to do it - I do not know.
Posted 10-Jan-13 0:30am
Radzhab1.2K

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

<books>
    <book>
        <title>JavaScript, the Definitive Guide</title>
        <publisher>O'Reilly</publisher>
        <author>David Flanagan</author>
        <cover src="/images/cover_defguide.jpg" />
        <blurb>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</blurb>
    </book>
    <book>
        <title>DOM Scripting</title>
        <publisher>Friends of Ed</publisher>
        <author>Jeremy Keith</author>
        <cover src="/images/cover_domscripting.jpg" />
        <blurb>Praesent et diam a ligula facilisis venenatis.</blurb>
    </book>
    <book>
        <title>DHTML Utopia: Modern Web Design using JavaScript &amp; DOM</title>
        <publisher>Sitepoint</publisher>
        <author>Stuart Langridge</author>
        <cover src="/images/cover_utopia.jpg" />
        <blurb>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</blurb>
    </book>
</books>
 
function setDataXML(req)
{
    var books = req.responseXML.getElementsByTagName('book');
    for (var i=0;i<books.length;i++)
    {
        var x = document.createElement('div');
        x.className = 'book';
        var y = document.createElement('h3');
        y.appendChild(document.createTextNode(getNodeValue(books[i],'title')));
        x.appendChild(y);
        var z = document.createElement('p');
        z.className = 'moreInfo';
        z.appendChild(document.createTextNode('By ' + getNodeValue(books[i],'author') + ', ' + getNodeValue(books[i],'publisher')));
        x.appendChild(z);
        var a = document.createElement('img');
        a.src = books[i].getElementsByTagName('cover')[0].getAttribute('src');
        x.appendChild(a);
        var b = document.createElement('p');
        b.appendChild(document.createTextNode(getNodeValue(books[i],'blurb')));
        x.appendChild(b);
        document.getElementById('writeroot').appendChild(x);
    }
}
 
function getNodeValue(obj,tag)
{
    return obj.getElementsByTagName(tag)[0].firstChild.nodeValue;
}
  Permalink  
Comments
Radzhab at 10-Jan-13 10:29am
   
What is it ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Peter Leow 160
1 Mika Wendelius 156
2 TheRealSteveJudge 129
3 Abhinav S 125
4 Suvendu Shekhar Giri 100
0 Sergey Alexandrovich Kryukov 8,513
1 OriginalGriff 6,526
2 Peter Leow 3,727
3 Zoltán Zörgő 3,426
4 Richard MacCutchan 2,417


Advertise | Privacy | Mobile
Web02 | 2.8.150123.1 | Last Updated 13 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100