r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[XML] xml related conversations

Gabriele
29-Apr-2006
[466x4]
when i think about representing data conceptually, i tend to always 
come up with a graph or a tree (then i map the conceptual graph to 
a relational model, or maybe to a dialect). so for selecting data 
a "navigation" approach (which is basically what xpath does) seems 
rather natural for me; then you can map the navigation to SELECT 
statements etc if needed.
so maybe my question is: is graph navigation (or, if you think it 
is general enough, tree navigation) a general enough selection model, 
or do you think that it would be missing something?
(maybe there just isn't any general solution to the problem of selection.)
brian: do you think that structural pattern matching could be done 
with parse rules too? or, do you think we need something like "longest 
match" (which can be implemented in parse but is tedious to do manually)
BrianH
29-Apr-2006
[470]
You can do some structural pattern matching with parse rules, but 
with how parse is currently implemented it can be a little awkward. 
The lack of arguments to parse rules make recursion quite difficult, 
and the lack of local variables make the rules difficult to use concurrently. 
It is difficult to examine both the data type and the value of elements 
in block parsing, to switch to string parsing mode for string elements, 
to parse lists, hashes or parens, to direct the parse flow based 
on semantic criteria (which is needed to work around any of these 
other problems).


And don't even get me started on the difficulties of structure rebuilding. 
The thing that is the most difficult to do in parse is the easiest 
thing to do with regexes: Search and replace. Didn't we make a web 
site years ago collecting suggestions for improving parse? Wasn't 
a replace operation one of those suggestions? What happened with 
that?


Structural pattern matching and rebuilding currently has to be done 
with a mix of parse and REBOL code that is tricky to write and debug. 
If parse doesn't get improved, I'd rather use a nice declarative 
dialect, preferably with before and after structures, and have the 
dialect processor generate the parse and REBOL code for me. If that 
dialect is powerful enough to be written in itself then we'll really 
be cooking.
Graham
29-Apr-2006
[471]
Brian, did you post a rambo on parse after a discussion we have a 
while ago ?
BrianH
29-Apr-2006
[472]
Yup. I've posted on rambo about everything I've suggested and more. 
I hope they consider these suggestions for REBOL 3.
Gabriele
30-Apr-2006
[473x6]
my rewrite function works quite well for search and replace. it still 
has the limitations of parse, though, but they don't seem a huge 
problem so far.
example: assume the AST for 3*1+2+0 is [plus [plus [mult [lit 3] 
[lit 1]] [lit 2]] [lit 0]]
we want to compile it to a forth-like processor
>> rewrite [
[        plus [plus [mult [lit 3] [lit 1]] [lit 2]] [lit 0]
[    ] [
[        ['lit set x number!] [push (x)]
[        ['plus into ['lit 1 1 0] set x block!] [(x)]
[        ['plus set x block! into ['lit 1 1 0]] [(x)]
[        ['mult into ['lit 1 1 1] set x block!] [(x)]
[        ['mult set x block! into ['lit 1 1 1]] [(x)]
[        ['plus set x block! set y block!] [(x) (y) add]
[        ['mult set x block! set y block!] [(x) (y) mul]
[    ]
== [push 3 push 2 add
]
(rewrite is currently 25 lines of code)
do you have common examples that you consider problematic for parse? 
we can probably use rewrite on the parse rules themselves to extend 
them in a similar way that compile-rules does.
Anton
30-Apr-2006
[479x2]
That's pretty cool. But, isn't the output of the rewrite above missing 
the multiply ?
Oh, I see, it has optimized the expression.
Christophe
2-Jun-2006
[481x3]
Well, I'm back after a long time off the air... Now back online and 
talking from a brand new iMac, and I enjoy it :-)
I submitted RebelXML to rebol.org quite some time from now. I can 
see it as been examined by some people. Well, it should be great 
if I could get some feedback about it.
We'll use it in production very soon. I took a SAX approach because 
we've to manipulate big XML files, and it was a mean to boost performences.
Graham
2-Jun-2006
[484]
why rebel and not rebol?
Christophe
4-Jun-2006
[485]
Is REBOL not pronounce REBEL ? It was just for the fun...
Maxim
8-Jun-2006
[486]
implementing schema is sooo much fun!
Pekr
8-Jun-2006
[487]
I wonder if REBOL can get standards fully compliant XML parser/emitter 
....
Maxim
8-Jun-2006
[488]
(I hope my previous post was read as intended... ironically!)    
;-)  although schema is pretty well defined and actually not too 
badly designed, its just so huge.
Christophe
17-Jun-2006
[489]
Well, no reaction to RebelXML. Do I have to assume it has no bugs 
or nobody is using it ? :-))
Ashley
17-Jun-2006
[490]
Folks seem to be using/talking about it ... just do a google search 
on "RebelXML". ;)
Christophe
18-Jun-2006
[491x2]
Well, Ashley, this is very kind of you :-) But after checking the 
links, it seems Google isn't my friend anymore :-))
Seriously, I need this lib for my work. Is there anybody out there 
who has ANY comment about it ? Please ...
Anton
18-Jun-2006
[493x2]
Well, I just had a quick look. It seems to be clean code, well organised. 
Perhaps I can find some time to test it out myself in a few days.
I do not know much about the greater issues of XML, however.
Maarten
3-Jun-2007
[495]
Has anybody done work on translating XML schemas (perhaps automagically) 
to REBOL parse rules that can work on REbelXML/RebXML like native 
syntax?
Maxim
5-Jun-2007
[496x3]
hehe... I have a validating schema parser which uses a modified RebXML 
engine... but I still have not had the balls to ask my client if 
we would be willing to make it open source.... I'm sure he would 
benefit from the extra time people might put on it.
I did not do it using parse for lack of knowledge ... and also the 
fact that schema and PARSE do not have the same traversal mechanisms... 
but its still very fast and error report is extremely precise (it 
gives you the full path of the error!)
the change in RebXML was to forego of a few limitiations and to allow 
direct xpath like useage of the loaded xml... which can't be done 
with RebXML out of the box.
Graham
22-Oct-2008
[499]
What are people using to create XML ?
Tomc
22-Oct-2008
[500]
core
Graham
22-Oct-2008
[501]
apple core or solaris core?
Tomc
22-Oct-2008
[502]
solaris , I am just emitting some simple rss feeds
Henrik
22-Oct-2008
[503]
The HTML Dialect can do a bit of XML
Graham
22-Oct-2008
[504]
is this yours?
Henrik
22-Oct-2008
[505]
yes, posting some code to you privately.
Graham
22-Oct-2008
[506]
Ok .. Ta
Geomol
22-Oct-2008
[507]
RebXML: http://home.tiscali.dk/john.niclasen/rebxml/
Graham
22-Oct-2008
[508]
Good ... a few choices
Dockimbel
22-Oct-2008
[509x2]
RSP, I use it to generate RSS feeds from Cheyenne's blog.
REBOL's built in BUILD-MARKUP function can also be a good choice.
Maarten
24-Oct-2008
[511]
Which was the first apss at RSP (1 of 2 choices) I handede to Carl. 
I think build-markup does only support <%= %> not <% %> (which I 
always found a pity)
Graham
24-Oct-2008
[512x2]
apss = pass
( took me a while to figure out that one ...  )
Graham
25-Oct-2008
[514x2]
Just playing with rebelxml

>> set-xml-data/content 'header/to "[carl-:-rebol-:-com]"
== "<header><to>[carl-:-rebol-:-com]</to></header>"


Now if I start with "header" and "to", how would I get the same result?
<xs:complexType name="MessageType">
<xs:sequence>

<xs:element name="Header" minOccurs="1" maxOccurs="1" type="HeaderType" 
/>

<xs:element name="Body" minOccurs="1" maxOccurs="1" type="BodyType" 
/>
<xs:element name="Error">
<xs:complexType>
<xs:sequence>
<xs:element name="Code" minOccurs="1" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="600|601|602|900" />
</xs:restriction>
</xs:simpleType>
</xs:element>

<xs:element name="DescriptionCode" minOccurs="0" maxOccurs="1" type="an..3" 
/>

<xs:element name="Description" minOccurs="0" maxOccurs="1" type="an..70" 
/>
</xs:sequence>
</xs:complexType>
</xs:element>


If I have the schema looking like this ( no examples I'm afraid ), 
is something like this what I have to generate
<header> ... headertype .. </header>
<body>
<error>
<code> 600 </code>
<Descriptioncode />
<Description />
</error>
</body>