1
$\begingroup$

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

text = URLFetch[ "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=protein&id=8&retmode=xml"]; ImportString[text, {"XML", "XMLObject"}]; 

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

Any suggestions?

$\endgroup$
3
  • $\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 help center! 3) When you see good questions and answers, vote them up by clicking the vote 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$ Commented 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$ Commented 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$ Commented Oct 14, 2015 at 14:37

1 Answer 1

1
$\begingroup$

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.

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.