next up previous contents index
Next: Special Notes about Parsing Up: libwww: The XSB Internet Previous: Status Code   Contents   Index

Example

Here is a complete example:

    | ?- libwww_request([xmlparse('http://public.org/test/simple1.xml',[timeout(4)],
                                  P,Y,Z)]),
          http_liberr(Z,Explanation,Class).

    P = [header(Content-Type,text/html),
         subrequest('http://public.org/secret/001.ent',-401)]
    Y = [elt(doc,[],[elt(pcdata,[],' '),
                     elt(foo,[attval(att1,123),attval(att2,ppp)],
                             [elt(pcdata,[],'Test1 '),elt(pcdata,[],' Test2 '),
                              elt(pcdata,[],adsdd),elt(pcdata,[], )]),
                     elt(pcdata,[],  ),
                     elt(a,[],[elt(pcdata,[], aaaaaaaaaaa),
                     elt(pcdata,[],' '),
                     elt(b,[attval(att,1)],[]),
                     elt(pcdata,[],' '),
                     elt(c,[attval(att,2)],[]),
                     elt(pcdata,[],' '),
                     elt(d,[],[elt(pcdata,[],dddddddd),
                     elt(f,[],[elt(pcdata,[],kkkkkkk)]),
                     elt(pcdata,[],abc)]),elt(pcdata,[],'  ')])])]
    Z = 200
    Explanation = 'OK'
    Class = 'success'
The above is a successful (because of the return code 200) request to parse an XML page. This page apparently had a reference to an external entity that was located in a protected domain. Since we did not supply authentication information, the call returned authentication failure for that subrequest (as indicated by the term subrequest('http://public.org/secret/001.ent',-401) in the fourth argument).



Luis Fernando P. de Castro 2003-06-27