Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

request for another attribute of nodes in XML (node query, newest nodes, etc)

by Vynce (Friar)
on Jun 14, 2001 at 02:26 UTC ( #88228=monkdiscuss: print w/ replies, xml ) Need Help??

I've been using and looking to use even more the node query XML generator, which is wonderful (thank you, vroom). use seems to be like this:

http://www.perlmonks.org/index.pl?node_id=37150&nodes=81921,87392,8522 +2
and you get back some XML, like this:
<NEWESTNODES><INFO site="http://perlmonks.org" sitename="Perl Monks">R +endered by the Node query XML Generator</INFO> <NODE nodetype="user" author_user="81921" node_id="81921" createtime=" +20010521060818">Vynce</NODE> <NODE nodetype="monkdiscuss" author_user="81921" node_id="87392" creat +etime="20010611020434">the state of perlmonks' perldocs</NODE> <NODE nodetype="note" author_user="81921" node_id="85222" createtime=" +20010602212719" parent_node="85220">Re: Re: Will/Can Perl 6 clean up +the bit-wise operator precedence mess?</NODE> </NEWESTNODES>
I note that currently, the following seem to be all the attributes available for any particular node:
nodetype
presumably something about the type of node -- they're shortened forms of the categories we know (e.g., "monkdiscuss" for "Perl Monks Discussion"), and generally pretty easy to decipher though, as far as i know, there is not, anywhere, a key to them. perhaps this would be wise, but it's not strictly necessary. Note that nodetype "user" indicates a monk's homenode (or the monk herself) and anything which is a reply to something else is a "note".
author_user
the author's homenode's node_id, which serves as a unique identifier for the monk himself.
node_id
unsurprisingly, the node ID number of the node.
createtime
the time at which the node was created. this is a long string of numbers, but it is not epoch time -- it is 'YYYYMMDDhhmmss' format. this is relatively easy for humans to read. it seems to be in UTC or perlmonks server time.
parent_node
if the node is a reply to another node, this attribute will exist and be the node_id of that other node.
(the content of the node element is the node's title. note that the body of the node is not passed anywhere.)

This is all wonderful and really great and shiny, but i notice that there are things available from perlmonks that are not in this little bit of XML; for instance, the content of the node, but that's perhaps excusable. The two new things that i would like to have passed in the XML are:

replies
whether this is just the number of replies, or actually a list of the replies, this would be vaguely useful.
top_ancestor
this is the one i really want. if you go to a node in perlmonks which is a reply to another node, you'll see (probably in the upper right corner, though i suppose you could use bizarre style sheets) a pair of links: "In reply to: ..." and "In thread: ...". what i humbly request of he who makes things go is that "in thread" node_id.
of course, i'm open to other suggestions for the names. thoughts, brethren?

.

Comment on request for another attribute of nodes in XML (node query, newest nodes, etc)
Select or Download Code
Re: request for another attribute of nodes in XML (node query, newest nodes, etc)
by ZZamboni (Curate) on Jun 14, 2001 at 03:09 UTC
    A few quick comments:
    createtime ... seems to be in UTC or perlmonks server time
    It is UTC (GMT).
    anything... which is a reply to something else is a "note".
    Except for 'categorized answer', which is used for... categorized answers :-)

    If you are looking at processing the Newest Nodes, you may want to take a look at the PerlMonks::NewestNodes module, which does threading and all the necessary querying and jumping and hooping. Feel free to use it or portions of it (and give me feedback!) or just to give you a better idea of the types of things that the different XML tickers return.

    --ZZamboni

(tye)Re: request for another attribute of nodes in XML (node query, newest nodes, etc)
by tye (Cardinal) on Jun 14, 2001 at 21:51 UTC

    I can't say with authority, but I suspect that those aren't included because they would require more records to be queried. So it might not be a good idea to include those there.

    But I think it'd be a good idea to offer that information in a separate XML ticker.

            - tye (but my friends call me "Tye")
Re: request for another attribute of nodes in XML (node query, newest nodes, etc)
by Vynce (Friar) on Jun 15, 2001 at 06:21 UTC

    i realize that some external modules might include some of the features i want, but i suspect it is more server-efficient to include that top_ancestor attribute than it would be to keep requesting parents until you find the root of the thread.

    but that aside, node_id=37150 doesn't seem to work for me from LWP. it works from in my browser, but i'm trying to write it into a script, and it seems to not be working, and i can't find any better documentation on it than what i wrote above.

    lwp-request 'http://www.perlmonks.org/index.pl?node_id=30175' # this works and gives me the newest nodes, as expected. lwp-request 'http://www.perlmonks.org/index.pl?node_id=30175&nodes=819 +21' # also works; jsut testing that lwp-request accepts an ampersand. lwp-request 'http://www.perlmonks.org/index.pl?node_id=37149' # gives me a big pile of perlmonks page. lwp-request 'http://www.perlmonks.org/index.pl?node_id=37151' # also gives me a big pile of perlmonks page lwp-request 'http://www.perlmonks.org/index.pl?node_id=37150' # gives me a newline. lwp-request 'http://www.perlmonks.org/index.pl?node_id=37150&nodes=819 +21' # also gives me a newline

    ZZamboni, is there a trick to this node that you know and i don't?

    .

    update: ah, that's it! I thought I tested that, but apparently my browser decided to give me a cached copy. sleep well, vroom.

    .
      If my memory serves me you probably have to be logged in to get at this. Need to get to bed so I can get up at 6:30am tomorrow... ugh.

      vroom | Tim Vroom | vroom@cs.hope.edu

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://88228]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2014-11-29 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (204 votes), past polls