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

World: r3wp

[XML] xml related conversations

Henrik
26-Oct-2008
[518]
That's a good method.
BrianH
27-Oct-2008
[519]
Some databases have the ability to generate XML directly. That approach 
can be faster, depending on how much data the database has to process. 
It all depends on what database you are using though.
Graham
3-Nov-2008
[520]
Has anyone used rebelxml.r ?
Graham
4-Nov-2008
[521]
Pekr thinks there is a tool that converts xml to a rebol object ... 
anyone know what it is?
Pekr
4-Nov-2008
[522]
wait a bit, I'll find it - it was cool stuff from XML REBOL guru. 
That person used it for his work ...
Graham
4-Nov-2008
[523]
Gavin Mckenzie was the guy who wrote a xml parser
Pekr
4-Nov-2008
[524]
yes, it is him. And his toolset contained several tools IIRC.
Graham
4-Nov-2008
[525]
I wasn't aware it created objects
Pekr
4-Nov-2008
[526]
http://www.rebol.org/view-script.r?script=xml-object.r
PeterWood
4-Nov-2008
[527]
It's explained in Chapter 4 of Olivier Auverlot's Rebol - Guide du 
Programmeur.
Graham
4-Nov-2008
[528]
Hmm.... kewl if it works
PeterWood
4-Nov-2008
[529]
obj-xml: make object! xml-to-object parse-xml+ read %my.xml
Pekr
4-Nov-2008
[530x2]
IIRC we discussed ability to creat XML back from the object, but 
such script was not written. Maybe it is not even possible, as rebol 
block as well as created object might not contain original xml tags 
info ...
Peter - what tools are you referring to? What is xml-to-object and 
parse-xml+?
Graham
4-Nov-2008
[532x3]
these are Gavin's stuff
>> do %xml-parse.r

Script: "A more XML 1.0 compliant set of XML parsing tools." (2-Mar-2005)
** Script Error: Invalid argument:
    Parses XML code and returns a tree of blocks.
    This is a more XML 1.0 compliant parse than the...
** Where: throw-on-error
** Near: func [[{
    Parses XML code and returns a tree of blocks.
    This is a more XML 1.0 compliant parse than the built-in
...
>>
is the file corrupted?
Pekr
4-Nov-2008
[535]
... haven't tried for ages ...
Graham
4-Nov-2008
[536x6]
must be corrupted
well, just use parse-xml ....
Hmm.  Doesn't actually work.
soapenv:Envelope: make object!

is not valid
ie. can't use : inside a set-word
so close !
Graham
8-Nov-2008
[542x8]
I know we discussed writing a SOAP:// protocol years and years ago 
on the mailing list ... but that never got done.
I made a little change to the http protocol to send SOAP messages 
.. so that I could access the National Library of Medicine's RxNorm 
API.
I read that most web APIs are REST based, but there are still a significant 
number based on SOAP, and also JSON
See this blog http://blogs.zdnet.com/Hinchcliffe/?p=215&tag=nl.e540
on OpenAPIs ... now over 1000
So, if we wish to access these, we need to talk XML better .. as 
generally data is marked up in XML
read/custom some-url reduce [ 'SOAP payload [ soapaction: "" ]]
the only difference I can see between POST and SOAP is that the encoding 
method ... SOAP uses text/xml;
Chris
9-Nov-2008
[550]
The web and soap/http are in a sense REST applications (REST is just 
WS over HTTP) though both use a limited subset of REST arguments 
and have to work around as such.


The web is limited (by the HTML spec) to the verbs 'get and 'post, 
and post content types of 'application/x-www-form-urlencoded (default) 
or 'multipart/form-data (used to upload files).  For the most part, 
the web is RESTful as we usually only want to 'get resources.  However, 
other operations typically violate REST principles, as all other 
resource actions (create, update, delete) have to squeeze through 
the get/post/url-encode/multipart pipe.  The Rebol HTTP protocol 
as standard is designed to mimic this and requires patching to move 
beyond get/post/url-endode (even for multipart)


SOAP as I understand it, when using HTTP only uses 'post - the post 
content contains the actual request.  Where it varies from the web 
(and Rebol HTTP) is the need for the 'text/xml content type.


REST itself is limited only by HTTP.  It uses theoretically limitless 
HTTP (v1.1) verbs (though most common patterns use 'get, 'put, 'post 
and 'delete).  It uses any encoding.  It uses HTTP headers as parameters 
(eg. the 'Accept header specifies the desired return type).  Therefore, 
any HTTP protocol designed for REST will accomodate SOAP requests.
Ashley
9-Nov-2008
[551]
Probably more a pure HTML question, and showing my complete lack 
of HTML knowledge these days, but how would I go about automatically 
updating a device (an IP Phone in my case) that has a page (http://10.1.1.7/admin.html) 
with a whole bunch of phone numbers in separate fields and a submit 
button that posts changes back? I can generate the page with the 
data I want submitted back, but I can't work out how to mimic pressing 
the submit button from a specific URL.
Tomc
9-Nov-2008
[552]
is    result:  read/custom url ['POST  query-string]   on the right 
track?
Reichart
9-Nov-2008
[553]
Ashley, I may be missing your question.


Are you asking, how from an IP phone (like a SIP phone), you would 
"sync" your phonebook (contacts) from a website?
Ashley
10-Nov-2008
[554]
Almost ... I want to "push" my Address Book (on my iMac) to all the 
IP Phones in our office. I know the address of each IP Phone (10.1.1.x), 
and I can extract the data from Address Book easily enough ... what 
I havn't figured out how to do is replace the manual process of bringing 
up the admin page of each phone (in Safari), keying in the numbers 
and clicking the "Submit" button. Tom's suggestion may be on the 
right track, although I've got no idea what query-string is supposed 
to look like. May be time to dig the old HTML4 manual out! ;)
Henrik
10-Nov-2008
[555]
ashley, do they have a telnet/SSH interface?
Pekr
10-Nov-2008
[556x3]
you should be able to simulate even submit, no? Browser generates 
http action for it after all ... Maybe it would be good to watch 
packets in WireShark, or install FF plug-in for displaying http headers 
...
Web developer extension and FireBug are kind of must-have extensions 
....
Live HTTP headers is the one I use ....
Tomc
10-Nov-2008
[559]
Ashley  it looks just like what is after the ? in a GET to a  *.cgi?name="value"&N2="v2"
Ashley
10-Nov-2008
[560]
Ah, thanks. I'll give that a go.
Gabriele
10-Nov-2008
[561]
ashley, look at the source for the page, and search for the <form> 
tag. if method="GET", as Tom said, look at the url after pressing 
the submit button and just do a read on a similarly composed url. 
if method="POST", you need to look at all the <input> tags, figure 
out what the query string would be, and send it via POST using read/custom. 
(you could also use wireshark or similar to look at the query string 
the browser is sending if you don't want to look for the <input> 
tags)
Ashley
11-Nov-2008
[562]
All works, "read/custom url reduce ['POST query-string]" did the 
trick! Thanks guys.

My little 64 line script now does the following:


 1) Read Address Book vCard file and extract a list of number/name 
 pairs (I prefix the numbers with 'n to assist with lookups)

 2) Read each Linksys SPA942 IP Phone's call history and create a 
 sorted list of number/frequency pairs

 3) Join these 2 lists and create a query string for matches and an 
 exception report for numbers without an address book entry
	4) POST merged and updated name/number pairs back to each phone


Script took 2 hours to write and debug, runs in 2-3 seconds and gives 
us the features of an advanced call management facility for free. 
Once again, REBOL to the rescue (my business partner shook his head 
when he saw this and just said, "but HOW can REBOL do all this???").
Arthur
11-Nov-2008
[563x3]
wow
amazing
Such things are unheard of around here.
Geomol
11-Nov-2008
[566]
:-) Good work, Ashley!
Henrik
11-Nov-2008
[567]
Great stuff. I did something similar once. REBOL is fantastic as 
"impossible gluelogic".