javascript - Extract complex URL from XML with JS or PHP -


i extracting data database using api; api returns data xml file.

i able put api return xml file on server, using php (file_get_contents() , file_put_contents()). fields, able parse xml file created , manipulate using either php or javascript (i.e., i've done both successfully).

one of field values need call complex url automatically downloads image file. able call field api, , goes xml file rest of fields.

however, both php parser ( simplexml_load_file() ) or javascript parser ( xmlhttprequest() ) fail read xml file complex url field. know have write code parsing because said, can manipulate other field these parsers.

how can @ agencyphoto field?

<?xml version="1.0" encoding="utf-8" standalone="no"?> <results count="4">         <row id="14" created="2013-04-07 21:43:59" updated="2013-05-05 19:12:21">             <agencyphoto>https://fw.civicore.com/vtmentoring/index.php?downloadfile=1&table=agencies&field=agencyphoto&check=969ac322f0347d4358bd3a7852b7b282&key=14</agencyphoto>         </row> </results> 

your xml doesn't valid. url contains unescaped & characters illegal. should escaped &amp; or put cdata. first fix before continuing.

so either

<agencyphoto>https://fw.civicore.com/vtmentoring/index.php?downloadfile=1&amp;table=agencies&amp;field=agencyphoto&amp;check=969ac322f0347d4358bd3a7852b7b282&amp;key=14</agencyphoto> 

or

<agencyphoto><![cdata[https://fw.civicore.com/vtmentoring/index.php?downloadfile=1&table=agencies&field=agencyphoto&check=969ac322f0347d4358bd3a7852b7b282&key=14]]></agencyphoto> 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -