Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8660543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:16:41+00:00 2026-06-12T16:16:41+00:00

So I have this code inside of a class file: Document requestData (String url,

  • 0

So I have this code inside of a class file:

Document requestData (String url, [String postVars, bool pauseApp = false, onSuccess(Document ht)]) {
   HttpRequest html = new HttpRequest();
   html.open((postVars == null ? 'GET' : 'POST'), url, async: !pauseApp);

   html.send(postVars);
   if (pauseApp == true) { return html.responseXML; }
   else { html.on.readyStateChange.add((Event e) { 
             if (html.readyState == HttpRequest.DONE && (html.status == 200 || html.status == 0)) {
                 try { 
                   //HERE IS WHERE THE ISSUE IS ----V
                   DOMParser d = new DOMParser();
                   onSuccess(d.parseFromString(html.responseText,"text/html")); 
                   }
                 catch (e) {
                   print("Error on requestData($url) async = $pauseApp - $e");
                 }
               }
           });
     }
 }

(Entire source for reference: http://pastebin.com/z21PM7r0 – I am using the dartium flag ‘–disable-web-security’ to allow cross server requests)

The issue is basically, the requests responseXML returns null whereas the responseText returns the HTML as expected. To combat this I attempted to use the DOM parser and that failed.

As I don’t own or control the server I need to connect to I cannot fix the html myself. The issue I assume is because its malformed.

Here is the code of the website I am trying to parse using the function above:
http://pastebin.com/KvMN9AuF

W3 Validator gives: 193 Errors, 16 warning(s)

Does anybody know how to combat this issue? Or is this something I am just going to have to give up on…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:16:42+00:00Added an answer on June 12, 2026 at 4:16 pm

    Try html5lib. It’s a spec-compliant html5 parser in pure Dart. You should be able to read in the malformed html, and then use document.outerHtml to get a well-formed String.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I have code which looks like this inside a header file: class Bar;
I have this code inside a header (edited): template <int i> class A {};
So I have this code inside my lib/ folder: class GlobalConfig::SetHelper def self.yes_no_input(configuration) value
I have this code which will include template.php file from inside each of these
I have this code inside a iframe: window.addEventListener('message', function(e){ if(e.data == 'test') console.log(e); },
I have this code inside thread and when I call terminate it terminates fast
I have this code snippet inside a function that checks if an object exists
I have written this code inside a servlet to delete certain records from three
I have this block of code inside a loop: var points = [new google.maps.LatLng(lat1,
I have this code that shows all the images inside 'images' directory but it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.