Jump to content

How to use a Permalink in xml


AmericanRev2

Recommended Posts

 
<stateData stateName="Alabama" url = "https://www.mymilitia.com/forums/topic/43392-individual-state-militia-laws/?do=findComment&comment=49164" stateMode = "ON" initialStateColor= "5c5c5c" stateOverColor = "939393" stateSelectedColor = "3CBC8D">


 
 
on my custom maps, I'm unable to get one of them working that has 50 permalinks (links directly to a post) because evidently, you cannot have an "&" symbol in the xml code is there a workaround?
Link to comment
Share on other sites

The encoded value is valid XML

https://www.ibm.com/support/knowledgecenter/en/SSS28S_3.5.0/com.ibm.form.designer.xfdl.doc/i_xfdl_g_computes_illegal_characters_in_xml_attributes.html

When you say "it does not work", can you give some more details? Do you have a sample XML file that was generated which does not work? And how does it not work - is the XML not validating, or is whatever program that tries to use it not accepting it?

Link to comment
Share on other sites

I think you're misunderstanding here.

URLs (any URL, not ours) do not "comply" with XML standards, because they're not XML. They are URLs and adhere to a different standard.

To use a URL in an XML document, it would need to comply with any XML requirements, including escaping of & and < characters.

I just tested it, and this is in fact a valid XML document:

<stateData stateName="Alabama" url = "https://www.mymilitia.com/forums/topic/43392-individual-state-militia-laws/?do=findComment&amp;comment=49164" stateMode = "ON" initialStateColor= "5c5c5c" stateOverColor = "939393" stateSelectedColor = "3CBC8D">

Note how I used &amp; instead of & in the URL.

auXas01dEa3aYCkSRDcXk1E0S5DJ83.png

So, I can only deduce a few possibilities here:

  • You did not escape the ampersand as I suggested
  • The application that you are importing this XML file into is not actually XML compliant.
  • Or perhaps your &amp; character is somehow getting converted to a & mistakenly somewhere along the way.

 

Think about it for a moment - an ampersand is a normal part of a query string. If it couldn't be used in XML, that would preclude just about every site on the internet from being able to generate search engine sitemaps and RSS feeds. The only thing you have to do is use the HTML entity version (&amp;) but otherwise it's perfectly fine.

Link to comment
Share on other sites

On 11/29/2018 at 9:17 AM, bfarber said:

I think you're misunderstanding here.

URLs (any URL, not ours) do not "comply" with XML standards, because they're not XML. They are URLs and adhere to a different standard.

To use a URL in an XML document, it would need to comply with any XML requirements, including escaping of & and < characters.

I just tested it, and this is in fact a valid XML document:


<stateData stateName="Alabama" url = "https://www.mymilitia.com/forums/topic/43392-individual-state-militia-laws/?do=findComment&amp;comment=49164" stateMode = "ON" initialStateColor= "5c5c5c" stateOverColor = "939393" stateSelectedColor = "3CBC8D">

Note how I used &amp; instead of & in the URL.

auXas01dEa3aYCkSRDcXk1E0S5DJ83.png

So, I can only deduce a few possibilities here:

  • You did not escape the ampersand as I suggested
  • The application that you are importing this XML file into is not actually XML compliant.
  • Or perhaps your &amp; character is somehow getting converted to a & mistakenly somewhere along the way.

 

Think about it for a moment - an ampersand is a normal part of a query string. If it couldn't be used in XML, that would preclude just about every site on the internet from being able to generate search engine sitemaps and RSS feeds. The only thing you have to do is use the HTML entity version (&amp;) but otherwise it's perfectly fine.

 

The Link Does Not Work @bfarber

https://www.mymilitia.com/forums/topic/43392-individual-state-militia-laws/?do=findComment&amp;comment=49164

 

Link to comment
Share on other sites

No offence, but you may be missing the point.

Put this:

https://www.mymilitia.com/forums/topic/43392-individual-state-militia-laws/?do=findComment&amp;comment=49164

in your XML file and you will get this:

https://www.mymilitia.com/forums/topic/43392-individual-state-militia-laws/?do=findComment&comment=49164

rendered when the xml file is viewed.

See the attached file - same content, only difference is the changing of the & to &amp; in the url.

If you are still having issues....create an xml file with the non-working url and let us look at it.

 

usaMapSettings4.xml

Link to comment
Share on other sites

Yes, perhaps your importing system is not handling the &amp; correctly and is converting it. I don't know what to say there. But XML is a standard, and all you need to do to comply with the standard is turn & into &amp;. This has nothing to do with "our software" (or any specific software), as IPS did not invent the XML standard (or the standard governing URLs).

Link to comment
Share on other sites

  • 1 year later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...