Code Monkey home page Code Monkey logo

Comments (4)

Robert-M-Muench avatar Robert-M-Muench commented on June 25, 2024

This is happening on a longer XML. Here is an excerpt of the XML:

<ad:feature key="PARTICULATE_FILTER_DIESEL" url="https://services.mobile.de/refdata/classes/Car/features/PARTICULATE_FILTER_DIESEL">
<resource:local-description xml-lang="de">Partikelfilter</resource:local-description>
</ad:feature>
<ad:feature key="AUTOMATIC_RAIN_SENSOR" url="https://services.mobile.de/refdata/classes/Car/features/AUTOMATIC_RAIN_SENSOR">
<resource:local-description xml-lang="de">Regensensor</resource:local-description>
</ad:feature>

The part with "Partikelfilter" works because I writeln it to the console, and then it bombs. But I can't see any problem...

from dxml.

Robert-M-Muench avatar Robert-M-Muench commented on June 25, 2024

This is the code:

// query specific model offers with details
  auto http = HTTP();
  http.method = HTTP.Method.get;
  http.url    = "https://sandbox.services.mobile.de/search-api/search?page.size=100&classification=refdata%2Fclasses%2FCar%2Fmakes%2FAUDI%2Fmodels%2FA6";
  http.setAuthentication("search-generic", "search-generic");
  http.addRequestHeader("Accept-Language", "de");
  http.onReceive = (ubyte[] answer){
    auto cars = parseXML(cast(char[])answer);
    foreach(entity; cars){
      version(log3) {
        writeln(entity); // all XML
        writeln("\t", entity.type);
   
        if(entity.type == EntityType.elementStart || entity.type == EntityType.elementEnd) writeln("\t", entity.name);
      }

      if(entity.type == EntityType.elementStart && entity.name == "ad:ad") {
        string adid;
        entity.attributes.getAttrs("key", &adid);
        write(adid);
      }
      if(entity.type == EntityType.text) writeln(" : ", entity.text);
    }
    return answer.length;
  };
  
  http.perform();

from dxml.

Robert-M-Muench avatar Robert-M-Muench commented on June 25, 2024

Interestingly, when I run the code several times, I can parse the received XML up to different places before I get the assert. But the returned XML is always the same.

from dxml.

Robert-M-Muench avatar Robert-M-Muench commented on June 25, 2024

Ok, and this led me to the problem: It's not dxml, I used the curl code wrong... sorry for the noise.

from dxml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.