I am getting the following error when trying to import XML:

text = URLFetch[

ImportString[text, {"XML", "XMLObject"}];

XML`Parser`XMLGetString::prserr: MalformedURLException: The URL used an unsupported protocol at Line: 2 Character: 106. >>

Any suggestions?

  • $\begingroup$ Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – user9660
    Oct 14, 2015 at 11:30
  • 1
    $\begingroup$ I receive no errors and your code works fine on my computer (MMA 10.2, Win7-64). If the problem persists on your end, you could also try using Import directly: Import["http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=protein&id=8&rettype=xml", "XML"] which seems to produce the same results. $\endgroup$
    – MarcoB
    Oct 14, 2015 at 13:43
  • $\begingroup$ Thanks Marco. It's strange, I am getting the same error. I actually made a little mistake in what I copy/pasted to you, it should be retmode instead of rettype: In[171]:= Import["eutils.ncbi.nlm.nih.gov/entrez/eutils/… During evaluation of In[171]:= XMLParserXMLGet::prserr: MalformedURLException: The URL used an unsupported protocol at Line: 2 Character: 99 in /var/folders/ll/cl5jhpqx40s__jv4_blwsq5h0000gn/T/m000009227691/efetch.fcgi. >> During evaluation of In[171]:= Import::fmterr: Cannot import data as XML format. >> $\endgroup$ Oct 14, 2015 at 14:37

1 Answer 1


This response is very late, but I had the same problem and I found a solution that might work for you as well.

My XML file had headers that looked like

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE {some string} SYSTEM {some other string}>

Deleting those headers and then using Import[file] without any extra options correctly imported the XML file.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.