Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Palle Hansen 143 posts 396 karma points
    Feb 23, 2015 @ 19:52
    Palle Hansen
    0

    umbraco.library:GetXmlDocumentByUrl is getting error

    Hi.

    I'm having a problem with umbraco.library:GetXmlDocumentByUrl.
    I  have this variable:  <xsl:variable name="xname" select="umbraco.library:GetXmlDocumentByUrl('https://services.web.info.dk/api/prod/?user=lxxx&amp;password=xxx&amp;format=xml', 3600)"/> and this is working just fine.

    But i need to get this in afterwards: &amp;sincedays=10
    For this I have this variable: <xsl:variable name="sourceURLxml" select="umbraco.library:GetXmlDocumentByUrl(concat($xname, '&amp;sincedays=14'))"/>

    But here the error comes.
    When saving the XSLT file this is written: 
    System.UriFormatException: Invalid URI: The Uri scheme is too long. 
    at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind) 
    at System.Net.WebRequest.Create(String requestUriString) 
    at umbraco.library.GetXmlDocumentByUrl(String Url)

    I can't use &amp;sincedays=10 in the first variable that's why I'm using concat in the second variable.

    Hope any one can tell why the error comes.

    /pth

     

     

  • Chriztian Steinmeier 2798 posts 8787 karma points MVP 7x admin c-trib
    Feb 23, 2015 @ 21:09
    Chriztian Steinmeier
    1

    Hi Palle,

    This fails because you're already fetching XML in the first variable, and then you're using that XML as the URL in the second one - try this instead:

    <xsl:variable name="sourceURL" select="'https://services.web.info.dk/api/prod/?user=lxxx&amp;password=xxx&amp;format=xml'" />
    
    <xsl:variable name="sourceURL10days" select="concat($sourceURL, '&amp;sincedays=10')" />
    
    <xsl:variable name="sourceURLxml" select="umbraco.library:GetXmlDocumentByUrl($sourceURL10days, 3600)" />
    

    /Chriztian

  • Palle Hansen 143 posts 396 karma points
    Feb 23, 2015 @ 21:27
    Palle Hansen
    100

    Hi Chriztian.

    Of course. Got it working.

    Thanks

    /pth 

Please Sign in or register to post replies

Write your reply to:

Draft