World: r3wp
[!REBOL3]
older newer | first last |
Robert 18-Aug-2010 [4495x2] | No, not necessary. |
Yes, just raw data. | |
Gregg 18-Aug-2010 [4497x3] | Just use PARSE then. I have a solution for the block approach, but just use PARSE when I need to extract data in more stream-oriented ways. |
Give me a minute though, I might have something... | |
This was used with small pieces of XML, rather than entire documents, but might be a starting point for you. xml-get-field: func [input name /local xml-field= data other-name] [ xml-field=: compose/deep [ some [ (rejoin ["<" name ">"]) copy data to (rejoin ["</" name ">"]) to end | skip ;(to paren! [prin '.]) ] ] either parse input xml-field= [data] [none] ] | |
Robert 18-Aug-2010 [4500] | Ok, thanks. |
Sunanda 18-Aug-2010 [4501] | I've used Gavin's XML-object.r in a couple of projects. Not tried it under R3 though: http://www.rebol.org/view-script.r?script=xml-object.r |
Gabriele 19-Aug-2010 [4502x2] | http://www.rebol.it/power-mezz/parsers/ml-parser.html |
inside?: no parse-ml "...your text..." func [command data] [ either inside? [ ?? command ?? data if command = </tag> [inside?: no] ] [ if command = <tag> [inside?: yes] ] ] | |
Chris 19-Aug-2010 [4504] | ; Another flavour of Rebol XML: do http://www.ross-gill.com/r/r3xml.r doc: load-xml/dom location foreach tag doc/get-by-tag <a> [ probe tag/flatten probe tag/text probe tag/get #href ] |
Robert 19-Aug-2010 [4505x2] | Chris, you post can now be done native using DECODE. Carl added this yesterday. |
I proposed a change to how path notation works on TAG! to return name value blocks for attributes. | |
Chris 19-Aug-2010 [4507x2] | Decode loads an XML document? |
Is there docs on the change? | |
Graham 19-Aug-2010 [4509] | even better would be to release the binaries! |
Graham 20-Aug-2010 [4510x2] | http://www.rebol.com/cgi-bin/blog.r?view=0484#comments Does any one have write access, or is Carl mistaken ? |
ie. anyone with a rank of 50 or higher | |
Robert 20-Aug-2010 [4512x4] | Here is how it works: |
Added it as a codec so you can access it: >> ml: decode 'markup read http://www.rebol.com >> foreach tag ml [probe tag] <!doctype html> ^/ <html> <head> ^/ <meta name="generator" content="REBOL WIP Wiki"/> ^/ <meta name="date" content="10-Aug-2010/12:18:33-7:00"/> ^/ <meta name="rebol-version" content="2.100.97.4.2"/> ^/ <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/> | |
It's a simple way to traverse over tags. | |
No fancy thing yet. | |
Pekr 20-Aug-2010 [4516] | btw - codecs were supposed to be redone, using port mechanism, to allow streaming etc. Is this the case already, or not? |
Robert 20-Aug-2010 [4517] | Don't know. DECODE doesn't look like a port to me. Maybe on the lower level this is done via a port like mechanism. |
Chris 20-Aug-2010 [4518] | Equivalent to load/markup then? With respect, that's not exactly the same as the example I posted... |
Robert 20-Aug-2010 [4519] | Yes, that's the missing part I made a proposal for to Carl. |
Chris 20-Aug-2010 [4520] | r3xml is an R3 port of AltXML, a Rebolised version of XML DOM: http://bit.ly/XMLandREBOL |
RobertS 20-Aug-2010 [4521] | 2.100.99.3.1 the use of function at with negative index simply returns the whole series - which reminds me to ask why at with index 0 doe not return the series atfter the last item i.e. place you at the end of the series? The docs for at specify behavior for a negative index "Using a negative index N, you can go N values backwards in a series:" PS I have relocated to Fredericton, NB, Canada. Lovely, green and interesting. |
Graham 20-Aug-2010 [4522x2] | Chris, with the hostkit you can compile in your own functions such as r3xml |
Carl ... http://www.rebol.com/cgi-bin/blog.r?view=0484#comments ... big typo at the top of the page! | |
Chris 20-Aug-2010 [4524] | G: I'm not clear on how to get to that point or how to do that. Or if it's worthwhile? |
Graham 20-Aug-2010 [4525x8] | well, there's only the one protocol included so far .. if you want your own, you have the option of including, or loading afterwards |
Thanks Ladislav for confirming the lack of write access to the rebol.com wiki | |
Chris, how to include your own protocols http://jira.rebolsource.net:8080/browse/REBOLKIT-2 | |
I don't know how much of a pain this would be, but I would like to consider overloading of words such as empty? It would like to see if there were an 'empty? actor if noun is an object ...and use that. | |
in the same way that open, close etc are port actors | |
I presume that is something that needs to changed in the r3lib.dll and is not possible from the hostkit | |
Hmm... I guess I could just redefine 'empty ... | |
Afterall is it really necessary for me to write thousands of times empty? vidfield/text when the language should allow me to write empty? vidfield | |
PeterWood 20-Aug-2010 [4533x4] | I can confirm that I am able to edit pages in the rebol.com wiki. |
Ladislav should also be able to edit them. Message #6921 explains. | |
Graham: if you really have to write empty? vidfield/text thousands of times, it would probably be worth adding it as a keyboard shortcut in your text editor. | |
Message #6921 on R3 chat. | |
Graham 20-Aug-2010 [4537x4] | Well, Gregg and I are only 50 |
Ladislav has rank 70 .. and so either Carl reinstituted the edit facility just after ladislav tested it .. or it's broken | |
Peter .. vidfield was meant to mean any object which has a field attribute | |
text attribute | |
Ladislav 21-Aug-2010 [4541] | If I remember correctly, I was able to edit even when I had rank 50. But, currently, notbody is able to edit, as far as I know. |
Graham 21-Aug-2010 [4542] | Peter says he can edit |
Henrik 21-Aug-2010 [4543] | I'm able to edit as well |
Ladislav 21-Aug-2010 [4544] | aha, hmm, I am still unable to log in, strange |
older newer | first last |