HTTP module

Thursday, 3 May 2012 · 5 messages
MS
Michael Seiferlein reply to Erol Akarsu, 3 May 2012, 20:173 May 2012 19:42 #
Hi Erol, I don't think so; unless you provide a web server running locally, as the HTTP module relies on the http protocol. But you could use the doc('whatever.html') function, unless you need http specific functionalities. Just make sure the tagsoup is on your classpath and set the according parser options [1, for example code]. You may even use it from the GUI, there's a tab for parser options. I hope this helps a little. Kind regards Michael [1] http://docs.basex.org/wiki/Parsers#HTML_Parser
Quoted text · Erol Akarsu · 98 lines
Am 03.05.2012 um 18:17 schrieb Erol Akarsu: > Is there a way to parse html file located in local hard drive? > Http module of xquery is fantastic, you can retrieve any url content. > > but I have already html file locally and need to parse. Can I do it > > http://docs.basex.org/wiki/HTTP_Module > > I would like to do this successfully: > > let $l := http:send-request(<http:request method='get' status-only='false'/>, 'file:///D:/tmp/b000187585.htm') > > return $l > > Thanks > > Erol Akarsu > > On Tue, May 1, 2012 at 5:24 PM, Christian Grün <christian.gruen at gmail.com> wrote: > ...by the way, you can also use our own map implementation to store > key/value pairs in XQuery: > > http://docs.basex.org/wiki/Map_Module > ___________________________ > > On Tue, May 1, 2012 at 11:22 PM, Christian Grün > <christian.gruen at gmail.com> wrote: > >> I am having problem in making new of Properties object. > > > > Thanks; this has been fixed in the latest snapshot, which I've just uploaded. > > Christian > > __________________________________ > > > >> Query: declare namespace system = "java:java.lang.System"; > >> declare namespace fis = "java:java.io.FileInputStream"; > >> declare namespace p = "java:java.util.Properties"; > >> > >> let $a := 555 > >> return <a>{(p:new ())}</a> > >> Error: Improper use? Potential bug? Your feedback is welcome: > >> Contact: basex-talk at mailman.uni-konstanz.de > >> Version: BaseX 7.2.1 > >> Java: Sun Microsystems Inc., 1.6.0_22 > >> OS: Windows XP, x86 > >> Stack Trace: > >> java.lang.RuntimeException: {} > >> org.basex.util.Util.notexpected(Util.java:55) > >> org.basex.query.item.FuncType.cast(FuncType.java:88) > >> org.basex.query.func.JavaMapping.toValue(JavaMapping.java:102) > >> org.basex.query.func.JavaMapping.value(JavaMapping.java:77) > >> org.basex.query.func.JavaMapping.iter(JavaMapping.java:67) > >> org.basex.query.QueryContext.iter(QueryContext.java:275) > >> org.basex.query.expr.Constr.add(Constr.java:62) > >> org.basex.query.expr.CElem.item(CElem.java:82) > >> org.basex.query.expr.CElem.item(CElem.java:1) > >> org.basex.query.expr.CFrag.item(CFrag.java:1) > >> org.basex.query.expr.ParseExpr.iter(ParseExpr.java:42) > >> org.basex.query.QueryContext.iter(QueryContext.java:275) > >> org.basex.query.QueryContext.iter(QueryContext.java:229) > >> org.basex.query.QueryContext.execute(QueryContext.java:448) > >> org.basex.query.QueryProcessor.execute(QueryProcessor.java:94) > >> org.basex.core.cmd.AQuery.query(AQuery.java:86) > >> org.basex.core.cmd.XQuery.run(XQuery.java:22) > >> org.basex.core.Command.run(Command.java:325) > >> org.basex.core.Command.exec(Command.java:304) > >> org.basex.core.Command.execute(Command.java:76) > >> org.basex.gui.GUI.exec(GUI.java:390) > >> org.basex.gui.GUI$6.run(GUI.java:342) > >> > >> > >> Erol Akarsu > >> > >> On Mon, Apr 30, 2012 at 3:49 PM, Christian Grün <christian.gruen at gmail.com> > >> wrote: > >>> > >>> > The new XQJ does not support xquery 3.0 syntax. That is why I have > >>> > facing > >>> > issue. > >>> > >>> Right, thanks for the update. A future version of XQJ will support all > >>> current BaseX language features, such as XQuery 3.0 and the Update and > >>> Full-Text and map extensions. Once again, feel free to ask Charles > >>> Foster for his timeline (the more feedback he gets, the faster it > >>> might get implemented). > >>> > >>> > How can I use 721 basex with old XQJ? > >>> > >>> I'm sorry that's not possible, as we have removed all links to XQJ > >>> from our core. > >>> > >>> Christian > >> > >> > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
MS
Michael Seiferle3 May 2012 20:00 #
Hi Erol, hi list, I just re-read my last email: the "I don't think so"-part is a little misleading, I have not read your mail carefully enough I guess. I was referring to your code example:
Quoted text · Michael Seiferle · 1 line
> http:send-request(<http:request method='get' status-only='false'/>, 'file:///D:/tmp/b000187585.htm')
-> this is indeed impossible, yet: with Tagsoup on the classpath, HTML parsing is fully supported as pointed out in the wiki. Sorry for the confusion, had a long day :-) Kind regards Michael
Quoted text · Michael Seiferle · 2 lines
Am 03.05.2012 um 19:42 schrieb Michael Seiferle: > I don't think so; unless you provide a web server running locally, as the HTTP module relies on the http protocol.
EA
Erol Akarsu3 May 2012 20:17 #
Is there a way to parse html file located in local hard drive? Http module of xquery is fantastic, you can retrieve any url content. but I have already html file locally and need to parse. Can I do it http://docs.basex.org/wiki/HTTP_Module I would like to do this successfully: let $l := http:send-request(<http:request method='get' status-only='false'/>, 'file:///D:/tmp/b000187585.htm') return $l Thanks Erol Akarsu On Tue, May 1, 2012 at 5:24 PM, Christian Grün <christian.gruen at gmail.com>wrote:
Quoted text · 77 lines
> ...by the way, you can also use our own map implementation to store > key/value pairs in XQuery: > > http://docs.basex.org/wiki/Map_Module > ___________________________ > > On Tue, May 1, 2012 at 11:22 PM, Christian Grün > <christian.gruen at gmail.com> wrote: > >> I am having problem in making new of Properties object. > > > > Thanks; this has been fixed in the latest snapshot, which I've just > uploaded. > > Christian > > __________________________________ > > > >> Query: declare namespace system = "java:java.lang.System"; > >> declare namespace fis = "java:java.io.FileInputStream"; > >> declare namespace p = "java:java.util.Properties"; > >> > >> let $a := 555 > >> return <a>{(p:new ())}</a> > >> Error: Improper use? Potential bug? Your feedback is welcome: > >> Contact: basex-talk at mailman.uni-konstanz.de > >> Version: BaseX 7.2.1 > >> Java: Sun Microsystems Inc., 1.6.0_22 > >> OS: Windows XP, x86 > >> Stack Trace: > >> java.lang.RuntimeException: {} > >> org.basex.util.Util.notexpected(Util.java:55) > >> org.basex.query.item.FuncType.cast(FuncType.java:88) > >> org.basex.query.func.JavaMapping.toValue(JavaMapping.java:102) > >> org.basex.query.func.JavaMapping.value(JavaMapping.java:77) > >> org.basex.query.func.JavaMapping.iter(JavaMapping.java:67) > >> org.basex.query.QueryContext.iter(QueryContext.java:275) > >> org.basex.query.expr.Constr.add(Constr.java:62) > >> org.basex.query.expr.CElem.item(CElem.java:82) > >> org.basex.query.expr.CElem.item(CElem.java:1) > >> org.basex.query.expr.CFrag.item(CFrag.java:1) > >> org.basex.query.expr.ParseExpr.iter(ParseExpr.java:42) > >> org.basex.query.QueryContext.iter(QueryContext.java:275) > >> org.basex.query.QueryContext.iter(QueryContext.java:229) > >> org.basex.query.QueryContext.execute(QueryContext.java:448) > >> org.basex.query.QueryProcessor.execute(QueryProcessor.java:94) > >> org.basex.core.cmd.AQuery.query(AQuery.java:86) > >> org.basex.core.cmd.XQuery.run(XQuery.java:22) > >> org.basex.core.Command.run(Command.java:325) > >> org.basex.core.Command.exec(Command.java:304) > >> org.basex.core.Command.execute(Command.java:76) > >> org.basex.gui.GUI.exec(GUI.java:390) > >> org.basex.gui.GUI$6.run(GUI.java:342) > >> > >> > >> Erol Akarsu > >> > >> On Mon, Apr 30, 2012 at 3:49 PM, Christian Grün < > christian.gruen at gmail.com> > >> wrote: > >>> > >>> > The new XQJ does not support xquery 3.0 syntax. That is why I have > >>> > facing > >>> > issue. > >>> > >>> Right, thanks for the update. A future version of XQJ will support all > >>> current BaseX language features, such as XQuery 3.0 and the Update and > >>> Full-Text and map extensions. Once again, feel free to ask Charles > >>> Foster for his timeline (the more feedback he gets, the faster it > >>> might get implemented). > >>> > >>> > How can I use 721 basex with old XQJ? > >>> > >>> I'm sorry that's not possible, as we have removed all links to XQJ > >>> from our core. > >>> > >>> Christian > >> > >> >
MS
Michael Seiferlein reply to Erol Akarsu, 3 May 2012, 22:063 May 2012 20:50 #
Hi Erol, Thanks for your reply, mines below:-- Michael Seiferle Sent from my mobile, sorry for the brevity.
Quoted text · Erol Akarsu · 8 lines
On Thursday, 3. May 2012 at 20:06, Erol Akarsu wrote: > Michael, > > Thanks for reply. > > I think that should be easy to enhance current basex HTTP support to other url types like here file:/// for local html files. > > We will replace with url fetch with local file downloading.
I guess it would be easy to allow http requests and somehow misuse them for local access, on the other hand using tagsoup and the doc() function will allow requesting files via both, http or the local filesystem with well defined semantics. I mean how would you post/put to file://, how will you handle request and response headers etc. - http offers a lot of options and means to access resources, that can not be mapped to local files without adding another layer of indirection, eg WebDAV. What are your concerns with using doc(file://) & doc(http://), maybe I am missing something obvious?
Quoted text · Erol Akarsu · 1 line
> Isn't it?
Well, imho it depends ;-) Maybe there are more opinions on our list?
Quoted text · Erol Akarsu · 2 lines
> > Erol Akarsu
Michael
Quoted text · Michael Seiferle · 21 lines
> > On Thu, May 3, 2012 at 2:00 PM, Michael Seiferle <ms at basex.org (mailto:ms at basex.org)> wrote: > > Hi Erol, > > hi list, > > > > I just re-read my last email: the "I don't think so"-part is a little misleading, I have not read your mail carefully enough I guess. > > > > I was referring to your code example: > > > http:send-request(<http:request method='get' status-only='false'/>, 'file:///D:/tmp/b000187585.htm') > > -> this is indeed impossible, yet:with Tagsoup on the classpath, HTML parsing is fully supported as pointed out in the wiki. > > > > Sorry for the confusion, had a long day :-) > > > > Kind regards > > Michael > > > > > > Am 03.05.2012 um 19:42 schrieb Michael Seiferle: > > > > > I don't think so; unless you provide a web server running locally, as the HTTP module relies on the http protocol. >
EA
Erol Akarsuin reply to Michael Seiferle, 3 May 2012, 20:003 May 2012 22:06 #
Michael, Thanks for reply. I think that should be easy to enhance current basex HTTP support to other url types like here file:/// for local html files. We will replace with url fetch with local file downloading. Isn't it? Erol Akarsu
Quoted text · Michael Seiferle · 30 lines
On Thu, May 3, 2012 at 2:00 PM, Michael Seiferle <ms at basex.org> wrote: > Hi Erol, > hi list, > > I just re-read my last email: > the "I don't think so"-part is a little misleading, I have not read your > mail carefully enough I guess. > > I was referring to your code example: > > http:send-request(<http:request method='get' status-only='false'/>, ' > file:///D:/tmp/b000187585.htm') > > -> this is indeed impossible, yet: > with Tagsoup on the classpath, HTML parsing is fully supported as pointed > out in the wiki. > > Sorry for the confusion, had a long day :-) > > Kind regards > Michael > > > Am 03.05.2012 um 19:42 schrieb Michael Seiferle: > > I don't think so; unless you provide a web server running locally, as the > HTTP module relies on the http protocol. > > >

⚡Generated with XQuery