Copyright (C) 2000-2012 |
Manpages Net::LDAP::DSMLSection: User Contributed Perl Documentation (3)Updated: 2001-08-21 Index Return to Main Contents NAMENet::LDAP::DSML - A DSML Writer and Reader for Net::LDAPSYNOPSISuse Net::LDAP; use Net::LDAP::DSML; use IO::File; my $server = "localhost"; my $file = "testdsml.xml"; my $ldap = Net::LDAP->new($server); $ldap->bind(); my $dsml = Net::LDAP::DSML->new(); my $file = "testdsml.xml"; my $io = IO::File->new($file,"w") or die ("failed to open $file as filehandle.$!\n"); $dsml->open($io) or die ("DSML problems opening $file.$!\n"); ; #or open (IO,">$file") or die("failed to open $file.$!"); $dsml->open(*IO) or die ("DSML problems opening $file.$!\n"); my $mesg = $ldap->search( base => 'o=airius.com', scope => 'sub', filter => 'ou=accounting', callback => sub { my ($mesg,$entry) =@_; $dsml->write($entry) if (ref $entry eq 'Net::LDAP::Entry'); } ); die ("search failed with ",$mesg->code(),"\n") if $mesg->code(); $dsml->write($schema); $dsml->finish(); print "Finished printing DSML\n"; print "Starting to process DSML\n"; $dsml = new Net::LDAP::DSML(); $dsml->process($file, entry => \&processEntry); #future when schema support is available will be #$dsml->process($file, entry => \&processEntry, schema => \&processSchema); sub processEntry { my $entry = shift; $entry->dump(); } DESCRIPTIONDirectory Service Markup Language (DSML) is the XML standard for representing directory service information in XML.At the moment this module only reads and writes DSML entry entities. It cannot process any schema entities because schema entities are processed differently than elements. Eventually this module will be a full level 2 consumer and producer enabling you to give you full DSML conformance. The module uses callbacks to improve performance (at least the appearance of improving performance ;) and to reduce the amount of memory required to parse large DSML files. Every time a single entry or schema is processed we pass the Net::LDAP object (either an Entry or Schema object) to the callback routine. AUTHORMark Wilcox mark@mwjilcox.comSEE ALSONet::LDAP, XML::ParserCOPYRIGHTCopyright (c) 2000 Graham Barr and Mark Wilcox. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
IndexThis document was created by man2html, using the manual pages. Time: 15:42:44 GMT, April 26, 2024 |