Menu

MalformedURLException with document() functio

Jim Neff
2004-12-27
2013-04-25
  • Jim Neff

    Jim Neff - 2004-12-27

    Greetings,

    I'm having trouble using the document() function in my XSLT file.  Here is the code:

    <xsl:variable name="field_definitions" select="document('c:/temp/xmltest/field_definitions_nsf.xml')/records"/>

    This works with Saxon if I use the command line processor, but I'm trying to do it from .Net and it's throwing this error:

    An unhandled exception of type 'java.net.MalformedURLException' occurred in ikvm.gnu.classpath.dll

    Additional information: Absolute URL required with null context

    I've tried several different ways of referencing my xml document including, http://localhost/filename.xml, also:  file://c:/temp/xmltest/filename.xml

    Both of those work from the Saxon command line but again, not from within Saxon.net.

    Can someone please help me?

    Thanks,
    Jim Neff

     
    • Pieter Siegers

      Pieter Siegers - 2004-12-27

      Hi Jim,

      we're working on the problem to find a solution for you. I have forwarded your question to our lead developer M. David Peterson who does the job of building the Saxon.NET dll, and can handle your question directly at the code level.

      Cheers,
      <prs/>

       
    • M. David Peterson

      Hi Jim,

      Try one more thing:

      file:///c:/temp/xmltest/filename.xml

      Adding the third "/" should invoke proper recoginition and  this should fix things.  If it does not let me know and I will dig deeper.

      Cheers!

      &lt;M:D/&gt;

       
    • Jim Neff

      Jim Neff - 2004-12-28

      thanks David.   That was it.

      I have another question though, regarding carriage retruns.

      In my original xslt stylesheet, i used the command:

      <xsl:text>&#xA;</xsl:text>

      to start a new line.  This worked fine when running Saxon from the command line but now I am trying to use it from a VB.net application and everything is appearing on one big long line. 

      I've tried the following:  "&#13;" ,  "&#xD;" , "&#xD;&#xA;"  ... and all combonation

      I see in the C# example it is searching through the ByteArray output and replacing "\u000A" with "\r\n"

      I tried including this into my VB.Net application (even tried vbCrLf instead of \r\n) but I can't seem to get any kind of carriage return to persist.

      Thanks in advance,
      Jim Neff

       
    • Pieter Siegers

      Pieter Siegers - 2004-12-28

      Hi Jim,

      if you want I can have a look at it; please send the project code in a zip to psiegers2002@yahoo.com.

      Cheers,
      <prs/>

       
    • Jim Neff

      Jim Neff - 2004-12-30

      I figured it out.  I found out that even with VB.Net you still need ASCII codes 13 + 10 for line breaks.  Apparently the rest of the modern world just uses ASCII 10.  I think if something only needs code 10 then it will ignore the extra 13 so this should be fairly portable now.

      My working code ended up being this:

      <xsl:text>&#xD;&#xA;</xsl:text>

      Thanks to all that helped.

       

Log in to post a comment.