Ok, Ive managed to get hold of my printout of the JSTL spec (didnt have it last night). The <x:parse> tags "xml" attribute can point at either a string or a reader. I think you could probably just get a reader in a scriptlet (or write a simple custom tag to do it), refer to it from the <x:parse tag> , and another scriplet/tag after to close it. (Or you could just read the local file into a string in one go).

To get an inputStream onto the file, if its relative to the webapps root, you code can use ServletContext.getResourceAsStream("/WEB-INF/foo/bar/myfile.xml"), and use the stream to read the file or create a reader object.

hth
-Andrew

Seth Milder wrote:

Andrew Hill wrote:

<snip>
parse an xml file from the local filesystem
</snip>



Yes, this is correct. It seems to want to do this over HTTP. Local paths do not seem to work, unless I am missing something, which is entirely possible.


The users local filesystem, or the servers?

In the former case no (you would need to get them to uplaod it first). In the later case (which I guess is what you mean as it has a leading /)... not sure. :-(

<snip>
"We want to stand upon our own feet and look fair and square at the world -- its good facts, its bad facts, its beauties, and its ugliness; see the world as it is and be not afraid of it. Conquer the world by intelligence and not merely by being slavishly subdued by the terror that comes from it." [Bertrand Russell]
</snip>


The most merciful thing in the world, I think, is the inability of the human mind to correlate all its contents. We live on a placid island of ignorance in the midst of black seas of infinity, and it was not meant that we should voyage far.
The sciences, each straining in its own direction, has hitherto harmed us little; but some day the piecing together of dissociated knowledge will open up such terrifying vistas of reality, and of our frightful position therein, that we shall either go mad from the revelation or flee from the deadly light into the peace and safety of a new dark age.
- HP Lovecraft



ok ok, I admit it! I only really answered to throw the lovecraft quote back at your russell quote, but hey, its Friday! :-) (by a whole hour)


-Andrew


I can deal with being infintesmal. I just feel honored to be sentient. Most things in the Universe do not have this priviledge :) I think Lovecraft is correct though, I can feel the darkness approaching rapidly.


Seth Milder wrote:

Hi,

I am new to using the JSTL x tags and I was wondering if there was a way to parse an xml file from the local filesystem without having to go through HTTP first. I'd like to be able to do something like this:

  <c:import url="/some/path/to/test.xml" var="xml" />
  <x:parse  doc="${xml}" var="foo" />

Is there a way to do this?

Thanks for your help!



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to