Menu

Using http basic auth inside of document()

Help
Anonymous
2011-11-21
2012-10-08
  • Anonymous

    Anonymous - 2011-11-21

    Hi,

    I'm attempting to do an HTTP GET with document(), for simple cases, this works
    great. However, this does not work when I need to use basic authentication:

    document('http://user:password@host.com/')

    Is this supported in any way in Saxon, or will I have to use a custom URI
    resolver?

    Thanks,

    James

     
  • Michael Kay

    Michael Kay - 2011-11-21

    Saxon's standard URI resolver will pass the URI unchanged to the chosen SAX
    parser (as an InputSource), so it's possible that what gets accepted may
    depend on which XML parser you are using. If you can find accurate
    documentation on what each XML parser accepts then you're smarter than me; but
    it's fair guess that at some stage someone is going to call a Java library
    routine like URL.getConnection(). If you want to do something that this can't
    handle directly, you're going to have to code it yourself in your own
    URIResolver.