OK... i have an xml problem.... :(

0 favourites
  • 9 posts
  • Can someone please tell me why is this not working?

    I edited standard xml example so that it loads same xml data just from remote server and it's not working...

    file removed... if someone needs it gimme PM

    this is data in my xml file on server:

    <?xml version=""1.0"" ?>
    
    <bookstore>
    
    <book category=""COOKING"">
      <title lang=""en"">Everyday Italian</title>
      <author>Giada De Laurentiis</author>
      <year>2005</year>
      <price>30.00</price>
    </book>
    
    <book category=""CHILDREN"">
      <title lang=""en"">Harry Potter</title>
      <author>J K. Rowling</author>
      <year>2005</year>
      <price>29.99</price>
    </book>
    
    <book category=""WEB"">
      <title lang=""en"">XQuery Kick Start</title>
      <author>James McGovern</author>
      <author>Per Bothner</author>
      <author>Kurt Cagle</author>
      <author>James Linn</author>
      <author>Vaidyanathan Nagarajan</author>
      <year>2003</year>
      <price>49.99</price>
    </book>
    
    <book category=""WEB"">
      <title lang=""en"">Learning XML</title>
      <author>Erik T. Ray</author>
      <year>2003</year>
      <price>39.95</price>
    </book>
    
    </bookstore>[/code:1rdivng1]
    thank you
  • Remove the double double quotes. They're needed when the XML is inside a String, but since you're reading it from a php you shouldn't use them. They're messing things up.

    Cheers!

  • brunopalermo

    hm.... it dosent seem to be the case... i'w removed double quotes and still no displayed result...

    edit... it works in chrome and in nw.js. and not in edge and in FF.... !?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • There's a rogue "792" appended at the end of the XML response. Maybe Chrome's XML parser is able to deal with it but not Edge's and Firefox' ?

  • Magistross

    ...i just noticed that also...

    My php is really simple as can be:

    <?php
      header('Access-Control-Allow-Origin: *');
      echo readfile('lista.xml');
    ?> [/code:5iggwtth]
    
    How do i lose that piece of junk?
    What causes it in the first place?
  • Just looked at the readfile() documentation. It writes the content of the file on the output stream then returns the count of bytes read. Simply lose the "echo" and keep "readfile('lista.xml');". The "792" should disappear.

  • Magistross

    Excellent!!!! You are a life saver!

  • I was testing in Chrome, so it worked fine... Sorry about that.

  • brunopalermo

    No problem... anyway thank you for your time!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)