[Clipart] XML hierarchy definitions
Jonadab the Unsightly One
jonadab at bright.net
Mon Sep 27 19:48:41 PDT 2004
Bryce Harrington <bryce at bryceharrington.com> writes:
> Basically, we need to pass in an XML file or filename for it to
> load,
For that part, there are a number of XML-parsing modules on the CPAN.
We should pick one we can work with. You've been using XML::Twig in
e.g. SVG::Metadata -- is it suitable for this, or should we look
elsewhere. I'm afraid my experience with XML modules is up to now
rather lacking, unless you count HTML::Tree (which is awesome; if we
had an equivalent module with basically that same functionality and
interface but generalized for XML that would be ideal).
> then have it iterate through the items in the XML
Or in the resulting data structure...
> and create directories and subdirectories accordingly. As it does
> this, for each directory it should put a call to xms requesting
> documents to put in the subdirectory; I haven't created this routine
> yet, but it'll be something like:
>
> $dir = 'my_daughters_aquarium';
> %criteria = ( 'keywords:required' => ['fish','freshwater'],
> 'keywords:omit' => ['shark','cooked','nazi','profanity']
> );
>
> foreach my $doc_id ($dms->query(%criteria)) {
> $dms->checkout($dir, $doc_id);
> }
Interesting. What does checkout do?
> Still TBD is how to specify that you want just svg's, or svg's plus
> thumbnails, or everything, or...
Those could be options passed to query, either as part of the hash of
criteria or as a separate hash of options. Once you have such a hash
of options, then you can add more options to it later. Any options
not specified get the default behavior.
> Also, I'm iffy on the syntax for the %criteria, so that may change.
Having it be a hash with lists[1] for the values is a good setup, very
flexible. Again, any keys not specified would get default values,
presumably (e.g., if you don't specify a value for 'keywords:omit' the
default would probably be an empty list).
[1] Yeah, I know they're arrayrefs, but we're _using_ them in this
case as lists -- i.e., we're not interested in the ability to do
arithmetic on the integer index and whatnot; we're just interested
in the reading off the values.
--
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
split//,"ten.thgirb\@badanoj$/ --";$\=$ ;-> ();print$/
More information about the clipart
mailing list