• Hi,

    Currently I’m trying to read a few elements from an XML file, to be able to list them on a page (or post if that would make it easier). I’ve tried several things: WP All Import, Site Import plugin, writing my own PHP, converting it to JSON and then reading it etc. Yet probably due my lack of knowledge about this topic I still haven’t been able to.

    What I’m looking to do is to take the ‘name’ and ‘thumbnail’ from each ‘item’ at http://www.boardgamegeek.com/xmlapi/collection/Zuiderspel?own=1&version=1, and list them on a page on my site, each item in a new div.

    Would anybody know how I could tackle this? Perhaps through code or a plugin.

    Thanks

Viewing 1 replies (of 1 total)
  • Thread Starter Aldun

    (@aldun)

    Addition:

    What I’m currently trying is through the following code

    <script>function loadDoc(){
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
    if (xhttp.readyState == 4 && xhttp.status == 200) {
    myFunction(xhttp);
    }
    };
    xhttp.open("GET", "http://www.boardgamegeek.com/xmlapi/collection/Zuiderspel?own=1&version=1", true);
    }
    xhttp.send();
    
    function myFunction(xml){
    console.log("test");
    }
    
    </script>

    With in the myFunction obviously the right code to place it in divs. However, this gives me ‘Unexpected token ILLEGAL’ for a reason I can’t find out. I’ve tried changing the xhttp.open to the local xml file on my server, but with the same results.

Viewing 1 replies (of 1 total)

The topic ‘How to read XML?’ is closed to new replies.