I am trying to implement a store locator using php, javascript, html, css. The first step is to get my database query parsing in xml format, But I am getting an error that does not make sense to me. it says :
{ XML Parsing Error: junk after document element Line Number 3, Column 9: --------^}
The weird part is when I hit enter in line 3 to push error to line 4, error context does not change, it seems that error does not have any thing with the the code.
The XML:
<parks storeName="Devonshire Park" streetNumber="1250" lat="49.245020" lng="-123.13364" distance="0.3444475521254494"></parks>
<parks storeName="Shaughnessy Park" streetNumber="1300" lat="49.255715" lng="-123.13506" distance="0.4027917748443472"></parks>
<parks storeName="Braemar Park" streetNumber="895" lat="49.247615" lng="-123.12363" distance="0.46626204419188244"></parks>
<parks storeName="Douglas Park" streetNumber="801" lat="49.252493" lng="-123.12222" distance="0.5285969452661102"></parks>
<parks storeName="Angus Park" streetNumber="3600" lat="49.253932" lng="-123.14381" distance="0.5463666448497029"></parks>
<parks storeName="Heather Park" streetNumber="702" lat="49.254765" lng="-123.12110" distance="0.6412282952671712"></parks>
<parks storeName="Granville Park" streetNumber="3001" lat="49.258105" lng="-123.14239" distance="0.6940531309415132"></parks>
<parks storeName="VanDusen Botanical Gardens" streetNumber="5251" lat="49.239181" lng="-123.13129" distance="0.7530451429246237"></parks>
<parks storeName="Quilchena Park" streetNumber="4590" lat="49.243690" lng="-123.14886" distance="0.8262659935827044"></parks>
<parks storeName="Oak Meadows Park" streetNumber="899" lat="49.238445" lng="-123.12579" distance="0.867320490203991"></parks>
<parks storeName="Arbutus Village Park" streetNumber="4202" lat="49.249783" lng="-123.15525" distance="0.9901511999872843"></parks>
<parks storeName="Choklit Park" streetNumber="" lat="49.265482" lng="-123.12890" distance="1.0880158966243803"></parks>
<parks storeName="Prince Edward Park" streetNumber="3773" lat="49.244397" lng="-123.15642" distance="1.1124111373800636"></parks>
<parks storeName="Prince of Wales Park" streetNumber="4780" lat="49.244397" lng="-123.15642" distance="1.1124111373800636"></parks>
<parks storeName="Queen Elizabeth Park" streetNumber="4600" lat="49.240978" lng="-123.11202" distance="1.1445698543044514"></parks>
<parks storeName="Willow Park" streetNumber="802" lat="49.264868" lng="-123.12203" distance="1.14618861456822"></parks>
<parks storeName="Hillcrest Park" streetNumber="4501" lat="49.244734" lng="-123.10841" distance="1.1801942385262174"></parks>
<parks storeName="Ravine Park" streetNumber="2159" lat="49.240902" lng="-123.15593" distance="1.1988469137694855"></parks>
<parks storeName="Granville Loop Park" streetNumber="1435" lat="49.267284" lng="-123.13754" distance="1.2094922772420964"></parks>
<parks storeName="Charleson Park" streetNumber="999" lat="49.266995" lng="-123.12420" distance="1.2439538809012058"></parks>
The most common cause is encoding errors. There are several basic approaches to solving this: escaping problematic characters ( < becomes < , & becomes & , etc.), escaping entire blocks of text with CDATA sections, or putting an encoding declaration at the start of the feed.
"XML Parsing Error" occurs when something is trying to read the XML, not when it is being generated. Also, "not well-formed" usually refers to errors in the structure of the document, such as a missing end-tag, not the characters it contains.
That is not really XML if there is no single root element. Try wrapping all of those elements in a single root. The "junk" the parser is complaining about is the multiple roots after the first one, which is the only one it considers valid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With