Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser.d(2726): [1:1273]: There can only be whitespace between an end tag's name and the > #24

Closed
Robert-M-Muench opened this issue Mar 5, 2020 · 4 comments

Comments

@Robert-M-Muench
Copy link

I get this error while looping with foreach(entity, parsedXML) but looking at the XML there is nothing strange about it.

Any idea what this is about and what to do now?

@Robert-M-Muench
Copy link
Author

Robert-M-Muench commented Mar 5, 2020

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...

@Robert-M-Muench
Copy link
Author

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();

@Robert-M-Muench
Copy link
Author

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.

@Robert-M-Muench
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant