This forum is in permanent archive mode. Our new active community can be found here.

A really difficult XML problem

edited November 2008 in Technology
Hi everyone, I know this might be sounding like a dumb idea for a post because I can not "figure it out", however after searching google for over 3 hours on this issue I am going to hope someone in here might help me in the right direction.

Ok here is the XML like I would like to add in a well formed XMl document (I removed the line and the XML validates perfectly):

<More_Info>http://maps.google.com/maps?f=q&hl=en&geocode=&q=game+players+unlimited&jsv=132d&sll=43.213659,-77.939052&sspn=0.036531,0.074072&ie=UTF8&cd=1&latlng=43218555,-77937600,13473380947166061560&ei=_uf2SIu5HoX4Npa_yNYL"</More_Info>

As you can tell it is nothing more then a URL being passed into the More_Info element, however when I try to validate the object into any validation checker it crashes when trying to read the URL. I have seen nothing online on anyone else having this issue and just stuck.

Any ideas? Thanks for reading.

Comments

  • edited November 2008
    It's most likely because you have & in the URL. In XML they mark beginning of entities. You probably need to replace them with &amp;
    <More_Info>http://maps.google.com/maps?f=q&amp;hl=en&amp;geocode=&amp;q=game+players+unlimited&amp;jsv=132d&amp;sll=43.213659,-77.939052&amp;sspn=0.036531,0.074072&amp;ie=UTF8&amp;cd=1&amp;latlng=43218555,-77937600,13473380947166061560&amp;ei=_uf2SIu5HoX4Npa_yNYL"</More_Info>
    Post edited by bugmenot on
  • I know next to nothing about XML, but is that a trailing " at the end of the URL? Should you have one at the beginning?
  • If your XML validator is crashing, it's a shitty validator. It should be giving an error message. Also, that quote really doesn't belong there. Make sure your urlencoding is correct. You might also want to try using the URL % escapes instead of the XML & elements.
  • ......
    edited November 2008
    File name:Nonexistent
    Column:47
    Error:Reference to entity "hl" must end with the ';' delimiter.
    Error position:...http://maps.google.com/maps?f=q&hl=en&geocode=&q=game+players+unlimited&j
    As damn_n00b said, & is the start of an entity in XML, you will have to escape them. Use the % escapes since you're working with a URL.

    This should do it:<more_info>http://maps.google.com/maps?f=q%26hl=en%26geocode=%26q=game+players+unlimited%26jsv=132d%26sll=43.213659,-77.939052%26sspn=0.036531,0.074072%26ie=UTF8%26cd=1%26latlng=43218555,-77937600,13473380947166061560%26ei=_uf2SIu5HoX4Npa_yNYL</more_info>
    Edit: It is correct according to the same online XML validator. A question, what is the XML validator you are using, and why aren't you just using a free online one?
    Note: Only the characters "<" and "&" are strictly illegal in XML. The greater than character is legal, but it is a good habit to replace it. </p>
    Post edited by ... on
  • Thanks for all your help on this issue, well the gist of the validation that I was using was a piece of crap, I went online to a few others to test this fact. I was hoping to keep the URL in tact since well....there are 698 more of them in what is going to be a huge XML file. Now I think I had an idea last night by using the command to say to the browser to not look at the url. Let's hope I can automate the 696 entries into the template. Thanks for the help guys and gals.
Sign In or Register to comment.