From: Ian M. <ianm@ActiveState.com> - 2003-04-30 01:27:41
|
OK then the problem is in XmlTextREader probably. It passes back thru baseURI exactly what you pass in doc.Load so : mono UriTest.exe test.xml Uri: test.xml mono UriTest.exe ../test.xml Uri: ../test.xml mono UriTest.exe /home/ianm/foo/test.xml Uri: /home/ianm/foo/test.xml it could be a bit smarter. Ian > Not sure why but this is what I am getting and the code I am using. I did > a cvs update and rebuild today. > > -- code -- > > > using System; > using System.Xml; > using System.IO; > > public class UriTest > { > public static void Main(String[] args) > { > XmlDocument doc = new XmlDocument(); > doc.Load(args[0]); > Console.WriteLine("Uri: " + doc.BaseURI); > Uri uri = new Uri(doc.BaseURI); > } > } > > > -- end code -- > > -- output -- > > [kosta@apollo uri]$ mono UriTest.exe test.xml > Uri: test.xml > > Unhandled Exception: System.UriFormatException: The format of the URI > could not be determined. > in <0x0015e> 00 System.Uri:Parse (string) > in <0x00066> 08 System.Uri:Parse (string) > in <0x00137> 00 System.Uri:.ctor (string,bool) > in <0x00125> 00 System.Uri:.ctor (string) > in <0x000c0> 00 .UriTest:Main (string[]) > > -- end output -- > > Regardless, I'm sure they will figure it out. Thanks. > > -kosta > > > On Wed, 30 Apr 2003, Ian MacLean wrote: > > >>Kosta, >>but XmlDocument is returning somthing like : >> >>/home/ianm/dev/foo.build >>as the URI which should be valid. >>Anyway here is a link to the discusion at mono dev regarding the >>URI.parse bug. >>http://lists.ximian.com/archives/public/mono-devel-list/2003-April/000561.html >> >>Ian >> >> >>>Good to know its been reported. In comming up with a similar solution >>>I did some investigating. >>> >>>Bascially the MS .Net implemention of the URI class does not support >>>raw file paths as arguments. For example, the following code throws an >>>exception in MS .Net >>> >>> Uri uri = new Uri("test.xml"); // throws System.UriFormatException >>> Uri uri = new Uri("c:\test.xml"); // works >>> >>>Therefor, I believe the bug is with the XmlDocument class returning an >>>invalid uri with a call to XmlDocument.BaseURI. Which in fact is calling >>>an accessor in the XmlTextReader class. Although, I guess this is left up >>>to the implementor of the class to figure out... oh well. Thanks. >>> >>>-kosta >>> >>> >>>On Wed, 30 Apr 2003, Ian MacLean wrote: >>> >>> >>> >>>>Kosta, >>>>Actually thats not quite true. Yes it returns a file path and not a >>>>file:/// uri. However the Uri constructor should handle a raw file path >>>>as an argument. I've reported this to the mono team. Its basically the >>>>only thing stopping NAnt running fully on linux. I hacked around it by >>>>prepending "file://" to every URi constructor and it all worked. I'm not >>>>going to commit that though. Hopefully the bug in URI.parse will be >>>>fixed soon. >>>> >>>>Ian >>>> >>>> >>>> >>>>>I noticed that the method XmlDocument.BaseURI does not >>>>>return a valid Uri. Therefor, passing that argument into the Uri >>>>>constructor causes an exception. >>>>> >>>>>--- code --- >>>>> >>>>> XmlDocument doc = new XmlDocument(); >>>>> doc.Load("test.xml"); >>>>> Uri uri = new Uri(doc.BaseURI); >>>>> >>>>>--- end --- >>>>> >>>>>The doc.BaseURI example above returns "test.xml". On MS .Net it returns >>>>>file://full/path/test.xml >>>>> >>>>> >>>>> >>>>>------------------------------------------------------- >>>>>This sf.net email is sponsored by:ThinkGeek >>>>>Welcome to geek heaven. >>>>>http://thinkgeek.com/sf >>>>>_______________________________________________ >>>>>Nant-developers mailing list >>>>>Nan...@li... >>>>>https://lists.sourceforge.net/lists/listinfo/nant-developers >>>> >>>> >>>> >>> >>> >> >> >> >>------------------------------------------------------- >>This sf.net email is sponsored by:ThinkGeek >>Welcome to geek heaven. >>http://thinkgeek.com/sf >>_______________________________________________ >>Nant-developers mailing list >>Nan...@li... >>https://lists.sourceforge.net/lists/listinfo/nant-developers >> |