XML examples?
[1/17] from: jasonic::panix::com at: 21-Sep-2001 11:16
Looking for examples and/or advice parsing and generating XML in Rebol.
thanks
- Jason
[2/17] from: greggirwin:starband at: 21-Sep-2001 11:13
Hi Jason,
Andrew Martin has some great stuff he posted recently, and there is some XML
stuff in the REBOL library as well. If Andrew doesn't see this and jump in,
I'll see if I can find what he sent. I think his site is
http://zen.scripterz.org.
--Gregg
[3/17] from: mh983:ya:hoo at: 21-Sep-2001 12:29
I have had good success with Gavin McKenzie's xml-to-object.
http://www3.sympatico.ca/gavin.mckenzie/
REBOL has a parse-xml function, but Gavin's xml-to-object script takes the result of
parse-xml and produces a nice object
hierarchy. I'd like to see something generated that's a bit closer to the defined standard
for the DOM (Gavin?) but the output
from this script is very useful as-is.
mike
[4/17] from: jasonic:panix at: 21-Sep-2001 14:47
> I have had good success with Gavin McKenzie's xml-to-object.
>
> http://www3.sympatico.ca/gavin.mckenzie/
>
> REBOL has a parse-xml function, but Gavin's xml-to-object script takes the
result of parse-xml and produces a nice object
> hierarchy. I'd like to see something generated that's a bit closer to the
defined standard for the DOM (Gavin?) but the output
> from this script is very useful as-is.
Thanks
This is the kind of thing I was looking for.
I just found XML Generator at
http://www.reboltech.com/library/html/xmlgen.html
No luck yet finding Andrew MArtin's Rebol code at http://zen.scripterz.org.
I confess I am ambiguous about XML in Rebol. It seems so unnecessary and
verbose, but then that's typical XML - where the meta data overwhelms the
core data. This xml-to-object seems like a good way to go, especially if I
can get my head into the exccellent recent thread on 'Object Private
Member'.
I am needing to pass data to and from Flash5 interfaces. In parallel I am
wondering about the overhead of XML versus using KISS text files.
- Jason
[5/17] from: greggirwin:starband at: 21-Sep-2001 13:33
Hi Jason,
<< I confess I am ambiguous about XML in Rebol. >>
I'm not. :) I'm fairly new to REBOL myself but I really don't like XML at
all. I know that we'll need to use it for interfacing with other systems
but, for anything I possibly can, I plan to use the native REBOL format.
--Gregg
[6/17] from: greggirwin:starband at: 21-Sep-2001 13:35
Jason,
Here is a large message that Andrew posted not too long ago. Hopefully he
won't mind my re-posting it for you.
--Gregg
<snip>
And here's an example of it's use (along with some eText):
eText: do %/C/Rebol/Dialect/eText.r
HTML: do %/C/Rebol/Dialect/HTML.r
HTML/BgColor: #FFFFFC
HTML/Text: #000000
HTML/Link: #CC0000
HTML/VLink: #330099
HTML/ALink: #FF3300
HTML/Background: %Jade.jpg
Page: make object! [
Margin: 180
Width: 480
]
Leaf: function [File [file!]][Title Dialect][
Title: to-string copy/part File find File %.txt
Dialect: eText/Dialect read File
write replace File %.txt %.html HTML/Dialect compose/Deep [
Header [
Title (Title)
]
Body [
Table [
Tr [
Td/Width " " (Page/Margin)
Td/Width [(Dialect)] (Page/Width)
Td " "
]
]
]
]
]
Andrew Martin
ICQ: 26227169 http://zen.scripterz.org
-><-
----- Original Message -----
From: <[raven--swipnet--se]>
To: <[ally-list--rebol--com]>
Sent: Friday, September 14, 2001 7:56 AM
Subject: [ALLY] Re: XML and REBOL
> > Does anyone have any XML related rebol scripts to show off?
> >
> >I've got a WML, HTML and XHTML dialect that generates those markup
> >languages
> >from Rebol values. That way, I don't have to worry about ending tags, and
I
> >can generate HTML, etc from Rebol scripts or eText.
> >
<<quoted lines omitted: 11>>
> [ally-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
-- Attached file included as plaintext by Listar --
-- File: ML.r
[
Rebol [
Name: 'ML
Title: "ML Dialect"
File: %ML.r
Author: "Andrew Martin"
eMail: [Al--Bri--xtra--co--nz]
Date: 3/September/2001
]
make object! [
Empty-Tag: func [Tag [tag!]][
rejoin ["" join Tag " /" newline]
]
Encode: func [Value [any-type!]][
either any [
url? Value
issue? Value
][
mold Value
][
join "" Value
]
]
Replacements: make block! 0
Inline: func [Value [string!]][
foreach [Search Replacement] Replacements [
replace/all Value Search Replacement
]
Value
]
Inlines: func [Item [any-type!]][
either string? :Item [
Inline Item
][
:Item
]
]
Map: function [Block [block!] Function [function!]][Mapped][
Mapped: make block! length? Block
foreach Item Block [
insert/only tail Mapped Function :Item
]
Mapped
]
Recurse: func [Content [block! string! tag!]][
either block? Content [
join "" reduce bind Map Content :Inlines 'self
][
Content
]
]
Tags: func [Tag [tag!] Content [string! tag!] /Break /Breaks][
rejoin [
either any [Break Breaks] [newline][""]
Tag
either Breaks [newline][""]
Content
either Breaks [newline][""]
to-tag join "/" first parse Tag none
;either Breaks [newline][""]
]
]
Dialect: func [Content [block!]][
Recurse Content
]
Comment: func [Ignored [block! string! tag!]][
rejoin [<!--> mold Ignored "--"]
]
Br: join mold <br/> newline
P: function [Content [string! block!] /Left /Center /Right][Tag][
Tag: copy [p]
if Left [append Tag [align ("left")]]
if Center [append Tag [align ("center")]]
if Right [append Tag [align ("right")]]
Tags/Break build-tag Tag Recurse Content
]
]
]
-- Attached file included as plaintext by Listar --
-- File: HTML.r
[
Rebol [
Name: 'HTML
Title: "HTML Dialect"
File: %"HTML.r"
Author: "Andrew Martin"
eMail: [Al--Bri--xtra--co--nz]
Date: 11/September/2001
]
make do %ML.r insert tail [
BgColor: #FFFFFC
Text: "black"
Link: #CC0000
VLink: "blue"
ALink: "orange"
Background: none
Dialect: func [Content [block!]][
Tags <html> Recurse Content
]
Refresh: func [Delay [time!] File [url! file!]][
Empty-Tag build-tag [
meta http-equiv ("refresh") content (
rejoin [
mold Delay/second "; URL=" Encode File
]
)
]
]
StyleSheet: func [File [file! url!]][
Empty-Tag build-tag [
link rel ("stylesheet") type ("text/css") href (Encode File)
]
]
JavaScript: function [Text [file! url! string!]][Tag][
Tag: copy [script type ("text/javascript") language ("JavaScript")]
either string? Text [
Tags/Break build-tag Tag rejoin [
"<!-- " newline
Text newline
"//-->"
]
][
append Tag [src (Encode Text)]
Empty-Tag build-tag Tag
]
]
Title: func [Content [string!]][
Tags <title> Content
]
Header: func [Content [block!]][
Tags/breaks <head> Recurse Content
]
Body: function [Content [block!] /onLoad onLoadScript [string!]][Tag][
Tag: copy [
body bgcolor (Encode BgColor)
text (Encode Text)
link (Encode Link)
vlink (Encode VLink)
alink (Encode ALink)
]
if not none? Background [
append Tag [background (Encode Background)]
]
if onLoad [
append Tag [onload (onLoadScript)]
]
Tags/breaks build-tag Tag Recurse Content
]
Td: function [Content [string! block!] /Left /Center /Right /Width N
[integer! string!]][Tag][
Tag: copy [td]
if Left [append Tag [align ("left")]]
if Center [append Tag [align ("center")]]
if Right [append Tag [align ("right")]]
if Width [append Tag [width (N)]]
Tags build-tag Tag Recurse Content
]
Th: function [Content [string! block!] /Left /Center /Right][Tag][
Tag: copy [th]
if Left [append Tag [align ("left")]]
if Center [append Tag [align ("center")]]
if Right [append Tag [align ("right")]]
Tags build-tag Tag Recurse Content
]
Tr: func [Content [string! block!]][
Tags/Breaks <tr> Recurse Content
]
Table: function [
Content [string! block!]
/Width W [integer! string!]
/Height H [integer! string!]
][Tag][
Tag: copy [table]
if Width [append Tag [width (w)]]
if Height [append Tag [height (w)]]
Tags/Breaks build-tag Tag Recurse Content
]
Hr: <br />
Div: function [Class [string!] Content [string! block!] /Center][Tag][
Tag: copy [div class (Class)]
if Center [append Tag [align ("center")]]
Tags/Breaks build-tag Tag Recurse Content
]
Center: func [Content [string! block!]][
Div/Center "Center" Content
]
BlockQuote: func [Content [string! block!]][
Tags/Breaks <blockquote> Recurse Content
]
Address: func [Content [string! block!]][
Tags/Breaks <address> Recurse Content
]
IP: function [Content [string! block!] /Left /Center /Right][Tag][
Tag: copy [p class ("Initial")]
if Left [append Tag [align ("left")]]
if Center [append Tag [align ("center")]]
if Right [append Tag [align ("right")]]
Tags/Break build-tag Tag Recurse Content
]
UL: func [Content [block!]][
Tags/Breaks <ul> Recurse Content
]
OL: func [Content [block!]][
Tags/Breaks <ol> Recurse Content
]
Image: func [Picture [file! url!] WxH [pair!] Alternative [string!]][
Empty-Tag build-tag [
img border (0)
src (Encode Picture)
width (WxH/x) height (WxH/y)
alt (Alternative)
]
]
A: function [
Reference [file! url! email! string!] Content [string! block!] /Top /Name
/Blank
][
Tag
][
if email? Reference [
return MailTo Reference "" Content
]
Tag: copy [a]
if any [Top Blank] [
append Tag [target (either Top ["_top"]["_blank"])]
]
append Tag either Name [
Reference: replace/all copy Reference " " "_"
[name (Encode Reference)]
][
[href (Encode Reference)]
]
Tags build-tag Tag Recurse Content
]
MailTo: func [eMail [email!] Subject [string!] Content [string! block!]][
Tags build-tag [a href (rejoin ["mailto:" eMail "?subject=" Subject])]
Recurse Content
]
] use [Block] [
Block: make block! 10
foreach [Word Tag] [
U: <u>
B: <b>
I: <i>
Ins: <ins>
Del: <del>
Big: <big>
Em: <em>
Small: <small>
Strong: <strong>
Pre: <pre>
H1: <h1>
H2: <h2>
H3: <h3>
H4: <h4>
H5: <h5>
H6: <h6>
Tt: <tt>
Q: <q>
Dt: <dt>
Dd: <dd>
Dl: <dl>
NoBreak: <nobr>
Li: <li>
][
append Block compose/deep [
(:Word) func [Content [string! block!]][
Tags (Tag) Recurse Content
]
]
]
Block
]
]
-- Attached file included as plaintext by Listar --
-- File: eText.r
[
Rebol [
Name: 'eText
Title: "eText"
File: %eText.r
Author: "Andrew Martin"
eMail: [Al--Bri--xtra--co--nz]
Date: 13/September/2001
]
make object! [
Space: charset [#" " #"^-"]
Br: Empty: [any Space newline]
Graphic: charset [#"^(21)" - #"^(7E)"]
Printable: charset [#"^(20)" - #"^(7E)"]
URI: do %URI.r
Inline!: make object! [
Text: Block: Before: After: none
Plain: function [Value [block! string! tag! none!]][String][
String: copy/part Before After
if not empty? String [
append Block String
]
if not none? Value [
repend Block Value
]
]
Pair: function [Mark [char!] HtmlDialect [block!]][NonMark][
NonMark: exclude Graphic charset to string! Mark
compose/deep [
After: (Mark) copy Text [some (NonMark) any [some #" " some (NonMark)]]
(Mark)
(to-paren reduce ['Plain HtmlDialect])
Before:
]
]
Link: make object! [
LinkRef: URI/Link
Word: compose/deep [(URI/Alpha) some [(URI/Alphanumeric) | #"-"] opt
{'s}]
Files: Text: Link: none
Rule: [
[
After: [
{"} copy Text to {" } {" }
| copy Text Word
] copy Link LinkRef (
Plain ['A first load/next Link Text]
) Before:
]
| [
After: [
{?"} copy Link to {"} skip
| "?" copy Link Word
](
Text: replace/all copy Link " " " "
if none? Files [Files: read %.]
if found? find Files to-file join Link #"/" [
append Link #"/"
]
Link: rejoin [
to-file replace/all Link " " " "
either #"/" = last Link [%Index.html][%.html]
]
Plain ['A Link Text]
) Before:
]
]
]
Single: func [Mark [string! char!] Replacement [string!]][
compose [After: (Mark) (to-paren compose [Plain (Replacement)]) Before:]
]
Rules: compose [
(Link/Rule)
| (Pair #"_" ['U Text])
| (Pair #"~" ['I Text])
;| (Pair #"+" ['Ins Text])
;| (Pair #"-" ['Del Text]) ; Need a better choice for 'Del, not hyphen.
| (Pair #"*" ['B Text])
| (Single newline "<br/>")
| (Single {---} "—")
| (Single {--} "–")
| (Single {&} "&")
| (Single {<} "<")
| (Single {>} ">")
| (Single {(c)} "©") | (Single {(C)} "©")
| (Single {(r)} "®") | (Single {(R)} "®")
| (Single {(tm)} "™") | (Single {(TM)} "™")
| (Single {-tm} "™") | (Single {-TM} "™")
| (Single {A^^`} {À}) | (Single {a^^`} {à})
| (Single {A^^'} {Á}) | (Single {a^^'} {Á})
| (Single {A^^~} {Ã}) | (Single {a^^~} {ã})
| (Single {A^^"} {Ä}) | (Single {a^^"} {ä})
| (Single {A^^*} {Å}) | (Single {a^^*} {å})
| (Single {A^^E} {Æ}) | (Single {a^^e} {æ})
| (Single {,C} {Ç}) | (Single {,c} {&ccdel;})
| (Single {E^^`} {È}) | (Single {e^^`} {è})
| (Single {E^^'} {É}) | (Single {e^^'} {é})
| (Single {E^^"} {Ë}) | (Single {e^^"} {ë})
| (Single {I^^`} {Ì}) | (Single {i^^`} {ì})
| (Single {I^^'} {Í}) | (Single {i^^'} {í})
| (Single {I^^"} {Ï}) | (Single {i^^"} {ï})
| (Single {D^^-} {Ð}) | (Single {d^^-} {ð})
| (Single {N^^~} {Ñ}) | (Single {n^^~} {ñ})
| (Single {O^^`} {Ò}) | (Single {o^^`} {ò})
| (Single {O^^'} {Ó}) | (Single {o^^'} {ó})
| (Single {O^^~} {Õ}) | (Single {o^^~} {õ})
| (Single {O^^"} {Ö}) | (Single {o^^"} {ö})
| (Single {O^^/} {Ø}) | (Single {o^^/} {ø})
| (Single {O^^E} {Œ}) | (Single {o^^e} {œ})
| (Single {U^^`} {Ù}) | (Single {u^^`} {ù})
| (Single {U^^'} {Ú}) | (Single {u^^'} {ú})
| (Single {U^^"} {Ü}) | (Single {u^^"} {ü})
| (Single {Y^^'} {Ý}) | (Single {y^^'} {ý})
| (Single {Y^^"} {Ÿ}) | (Single {y^^"} {ÿ})
| (Single {S^^z} {ß})
| (Single {P|} {Þ}) | (Single {p|} {þ})
| (Single {~!} {¡}) | (Single {~?} {¿})
| (Single {c^^/} {¢}) | (Single {L^^-} {£})
| (Single {Y^^-} {&Yen;})
| (Single {o^^$} {¤})
| (Single {||} {¦})
| (Single {<<} {«}) | (Single {>>} {»})
| (Single {-,} {¬})
| (Single {^^-} {¯}) | (Single {^^o} {°}) | (Single {^^o-}
{º})
; { 1/4 } { ¼ } { 1/2 } { ½ } { 3/4 } { ¾ }
| (Single {''} {´})
| (Single {^^/u} {µ})
| (Single {P^^!} {¶})
| (Single {sO} {§})
| (Single {^^.} {·})
| (Single {,,} {¸})
| (Single {...} {…})
;{ +- } {±}
;{ * } {×}
| (Single {-:} {÷})
; { / } { ÷ } ; Slash is often used as a divider or alternative
marker.
| (Single {A^^} {Â}) | (Single {a^^} {â})
| (Single {E^^} {Ê}) | (Single {e^^} {ê})
| (Single {I^^} {Î}) | (Single {i^^} {î})
| (Single {O^^} {Ô}) | (Single {o^^} {ô})
| (Single {U^^} {Û}) | (Single {u^^} {û})
;{ pi } {π}
| (Single {sqrt} {√}) ; {<font face="symbol">Ö</font>}
| skip
]
Dialect: func [String [string!]][
Block: make block! 10
Before: String
After: none
parse/case/all String [some Rules (Plain None) end]
either empty? Block [
String
][
Block
]
]
]
Inline: get in Inline! 'Dialect
Line: Heading: Block: Previous: none
Text-Line: [Graphic any Printable]
Text: [copy Line Text-Line newline]
H: [
opt Empty
Text
[
some "*" (Heading: 'H1)
| some "=" (Heading: 'H2)
| some "-" (Heading: 'H3)
| some "~" (Heading: 'H4)
| some "_" (Heading: 'H5)
| some "." (Heading: 'H6)
] newline (repend Block [Heading Line])
]
IP: [Text (repend Block ['IP Inline Line])]
P: [[Empty | tab] Text (repend Block ['P Inline Line])]
Align!: make object! [
Type: 'Left
Rule: [#" " (Type: 'Center) | tab (Type: 'Right) | none (Type: 'Left)]
]
Align: Align!/Rule
Center: make object! [
Lines: make block! 10
Rule: [
some [
#" " copy Line [Graphic any Printable] newline (
if not empty? Lines [
append Lines 'Br
]
append Lines Inline Line
)
](
repend Block ['Center Lines]
Lines: make block! 10
)
]
]
Table: make object! [
Type: 'TH
Mark: #"|"
NonBar: exclude Printable charset to-string Mark
Cells: make block! 10
BarCell: [Mark Align copy Line some NonBar]
TabCell: [copy Line some Printable (trim Line)]
Append-Cell: does [
repend Cells [make path! reduce [Type Align!/Type] Inline Line]
]
Row: [
[
[
opt [some [Mark some #"-"] opt Mark newline]
some [BarCell (Append-Cell)]
opt Mark
]
| Align TabCell (Append-Cell) some [
tab Align TabCell (Append-Cell)
]
] newline
]
Rows: make block! 10
Rule: [
opt Empty
(
Type: 'TH
Rows: make block! 10
Cells: make block! 10
)
some [
Row (
repend Rows ['TR Cells]
Type: 'TD
Cells: make block! 10
)
](
repend Block ['Table Rows]
)
]
]
Quote: make object! [
Quotes: make block! 1
Tabbed-Text: charset [#"^(20)" - #"^(7E)" #"^-"]
Rule: [
some [
tab tab copy Line [some Tabbed-Text newline]
(append/only Quotes Inline Line)
](
repend Block ['BlockQuote 'Pre rejoin Quotes]
Quotes: make block! 10
)
]
]
BlockQuote: make object! [
Lines: make block! 1
NonQuoteText: exclude charset [#"^(20)" - #"^(7E)"] charset {"}
NonQuoteLine: [
copy Line some NonQuoteText
]
Rule: [
{"} copy Line some NonQuoteText {"} newline (
repend Block ['BlockQuote inline Line]
)
| [
{"} copy Line some NonQuoteText newline (
append Lines append inline Line 'Br
)
any [
Empty (append Lines 'Br)
| copy Line some NonQuoteText newline (
append Lines append inline Line 'Br
)
]
copy Line so
[7/17] from: al:bri:xtra at: 22-Sep-2001 8:26
> << I confess I am ambiguous about XML in Rebol. >>
>
> I'm not. :) I'm fairly new to REBOL myself but I really don't like XML at
all. I know that we'll need to use it for interfacing with other systems
but, for anything I possibly can, I plan to use the native REBOL format.
I plan to generate to XML, XHTML from rebol values and just use Rebol values
for all storage. That way it's far more readable.
Andrew Martin
ICQ: 26227169 http://zen.scripterz.org
[8/17] from: greggirwin:starband at: 21-Sep-2001 14:41
<< I plan to generate to XML, XHTML from rebol values and just use Rebol
values
for all storage. That way it's far more readable. >>
Agreed!
--Gregg
[9/17] from: al:bri:xtra at: 22-Sep-2001 9:01
Most recent versions can be found here:
http://groups.yahoo.com/group/Web_Dialect/messages
Andrew Martin
ICQ: 26227169 http://zen.scripterz.org
[10/17] from: greggirwin:starband at: 21-Sep-2001 16:24
Hi Andrew,
There were a number of files that didn't come down when I tried to get them
from the group. Are they available anywhere else?
--Gregg
[11/17] from: ingo:2b1 at: 21-Sep-2001 20:41
Hi Jason,
you could have a look at http://www.h-o-h.org/the_sea.r
A simple addressbook, saving data as xml.
kind regards,
Ingo
Once upon a time Jason Cunliffe spoketh thus:
[12/17] from: allenk:powerup:au at: 22-Sep-2001 12:04
Hi REBOLs,
To try and make finding these key REBOLs a bit easier,
I've added links to some of the outstanding REBOL projects or scripts that I
know of to the front page at http://www.rebolforces.com . Gavin's is amongst
them.
Apologies if I've missed anyone out, I just listed the ones that came to
mind that have a web presence that I know of. Feel free to email me directly
with any other good candidates. (If I get enough submissions I'll set up a
permanent page for them.)
Cheers,
Allen K
[13/17] from: jasonic:panix at: 22-Sep-2001 3:25
> you could have a look at http://www.h-o-h.org/the_sea.r
> A simple addressbook, saving data as xml.
>
> kind regards,
>
> Ingo
Thanks Ingo & everyone :-)
I just came across these tonight:
http://www.obscure.dk/rebol/
a. XML-Utils
Extended XML utilities, currently contains an XML parsing function
b. XML-RPC
XML-RPC client and server functions, requires xml-utils.r
c. ReMuSeS
General purpose TCP/IP server framework. Inspired by the Python Medusa
project.
All are dated 24-Sep-2000.
I am new here, but so apologise this is tired news for you.
OT => some prgoramming background
... with basic Rebol questions:
Part of what brings me to Rebol is my hopes for and frustrations for trying
to design peer-peer smart-clients applications in Zope, [which is based on
Medusa.. interesting!] Zope has a formidable learning curve and intense
mailing list activity to go with it. Zope's object publishign paradigm means
that one can call any object [object, data or method] via URL which looks
just like REBOL's path syntax, for similar reasons.
I like Python very much and find it plays nicely with REBOL. Python is a
little more verbose left to right, but Rebol is more verbose top to bottom.
This is becuase Python uses white space indentation to remove big nested
brackets.
A major plus is that code is readable and consistently so. Rebol's
blocks ][][]] still look rather messy to me, but I had no Lisp experience.
[scared by all those ((((())))) fx :-)]
After reading Rebol for the past few days, I find my oh-so-minimal Python
now has ['way' ,'too' ,'many' , 'commas, and "quotes" if, you, "know what I
mean"]
To my newbie Rebol wide-eyes, I notice that the cleanest reading ReBol code
is a little like great Forth. [that's a compliment btw]. When names are
_well_ chosen and the left-right syntax reads smoothly, it show the problem
has been well understood and factored. Easy to say but not so easy to do..
I had recently been looking at various techniques and cool 3rd party modules
in Python for XML-to-object adn vice versa. So am delighted to see the
response to this thread is in the same spirit of less-is-more, appropriate
design.
The two main things I miss from Python:
- dictionaries [associative hash arrays]
- named arguments
Python Dictionaries look like this:
>>> rolodex = {'name' : 'Jason', 'email' : ['jasonic--nomadics--org']}
>>> print rolodex.name
'Jason'
>>> rolodex['name']
'Jason'
It seems the way to do this in REBOL is
>> rolodex: [name jason email [jasonic--nomadics--org]]
>> rolodex/name
== jason
etc
RQ1: With much bigger block, how do you keep track in these implicit pairs
of what is a 'key' and what is a 'value'. In Python the extra punctuation is
more verbose, but always unambiguous
Named arguments for Python functions and classes allow one to set default
values very nicely. you can also call arguments in any order. The result is
terrific readibility, because you don't have ask what argument is what, or
deal with a predefined order. If you follow the pre-defined order, then you
can drop the 'name=' part instead provide just the value.
Python expressions can take these forms:
expression
function([value, name=value,...])
object.method([value, name=value,...])
To make a new function:
def name([arg, arg=value, *arg, **arg]): suite
arg simple name
arg=value default if arg not passed
*arg collects extra positional args
**arg collects extra keyword args
RQ2: Can anyone translate this into REBOL or suggest strategy for attaining
a keyword clarity. Perhaps it is not even desirable/necessary..
And please don't misunderstand. I am not trying to tilt at windmills, or
start any language-flame wars, just trying to understand How Rebol works and
take inspiration from good ideas wherever interesting people gather.
thanks
- Jason
[14/17] from: al:bri:xtra at: 22-Sep-2001 19:49
Greg wrote:
> There were a number of files that didn't come down when I tried to get
them from the group. Are they available anywhere else?
They're available directly from me. Let me know which ones you want.
Andrew Martin
ICQ: 26227169 http://zen.scripterz.org
[15/17] from: gavin:mckenzie:sympatico:ca at: 22-Sep-2001 7:27
A *real* (W3C) XML-DOM is certainly the industrial strength way to
manipulate an XML document. But, it sure is a very low-level interface, and
not very easy to use. Plus, all the XML-DOM interfaces constitute quite a
bit of hefty overhead for node management etc., where REBOL has already has
a set of collection types (blocks).
In my work-life I work with real XML-DOMs (and XPath and XSLT and...), but
the XML-DOM is almost always used just as the low-level storage for the
document with a higher-level custom DOM interface that corresponds to the
type of document you are manipulating.
For instance, if you were processing a particular flavour of XML documents
(say banking transactions), building a set of objects that represent those
transactions and layering that on top of a W3C XML-DOM gives you a nice
high-level interface over the otherwise painfully low-level W3C XML-DOM.
I created xml-to-object for sorta the same reason. Despite two years of
tinkering with REBOL, I still find navigating through complex block
hierarchies tedious. The basic blocked result set from parse-xml is (most
of the time) really too high-effort for me to manipulate XML documents. For
task at hand, I simply needed a way to be able easily address the content of
some known XML document types. REBOLs path syntax is like a small subset of
XML's XPath. Hence, by using a couple of basic principles for how to map
XML elements, attributes, and mixed-content into REBOL objects, I gain the
ability to use the REBOL path syntax for interpreting the content.
Though, as it stands, xml-to-object really is only useful for addressing XML
document content. There's nothing there to help you with actually making
changes to the XML content and writing it back out.
Anyway...interesting discussion. I can't say that I had thought about
creating a real W3C XML DOM on top of REBOL.
I'm curious as to what sort of XML applications people are building with
REBOL. A better understanding of the type of XML applications people are
building should indicate what type of REBOL XML processing tools we need.
Gavin.
P.S. Mike has found a nasty bug in my xml-to-object script. I've got some
bug fixing to do.
[16/17] from: lmecir:mbox:vol:cz at: 22-Sep-2001 16:47
Hi Allen,
I like the design of your pages.
Nice work
Ladislav
[17/17] from: greggirwin:starband at: 22-Sep-2001 12:31
Hi Andrew,
<< They're available directly from me. Let me know which ones you want. >>
Whatever is easily bundled. :) I just joined the web dialects group (though
I'll mostly lurk there for a while I'm sure) and I'm devouring everything
REBOL I can lay my hands on.
Thanks!
--Gregg
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted