Hi Samuel,

On Thu, 20 Dec 2012 22:37:13 +0100
samuel desseaux <sdesse...@gmail.com> wrote:

> Hi,
> 
> It's the first time i work with data from ldap. I know some methods in
> python  but not in perl.
> 
> The case:
> 
> I've exported my datas from ldap in an xml format and it gives this (it's
> an extract).
[SNIP]
> 
> I would like change the structure and the name of the balises
> 
> Here is my new structure and comments
> 
> <PERSON>
>       <CN>Joseph Stephanie</CN>   ----> is it possible to break this balise
> in
> <surname>Joseph</surname>
> <firstname>Stephanie</firstname>
> 
> 
>       <CIVILITE>Mme</CIVILITE>   --->to drop
>       <OU>employee</OU>  ----> become <categorycode>employee</categorycode>
>       <LOGIN>josephs</LOGIN> --->become <login>xxxx</login>
>       <ACHMAIL>stephanie.jos...@ecp.fr</ACHMAIL>  -->become <email>
> x...@ecp.fr</email>
>       <UID>2009josephs</UID>  -->become <userid>2009josephs</userid>
>       <LEC_NUM>20018</LEC_NUM>  -->become <cardnumber>xxxx</cardnumber>
> 
> the following balises can be dropped
>       <ECP_BADGE>P5704</ECP_BADGE>
>       <DATEFIN>2100-01-01</DATEFIN>
>       <CAT>CAT2</CAT>
>       <ECP_CHAMBRE></ECP_CHAMBRE>
>       <LEC_CATEG_PORTAIL>ABOP</LEC_CATEG_PORTAIL>
>       <LEC_AUTORISE>1</LEC_AUTORISE>
>    </PERSON>
> 

That sounds like a job for XSLT:

* http://en.wikipedia.org/wiki/XSLT

* http://zvon.org/xxl/XSLTutorial/Output/

* https://metacpan.org/release/XML-LibXSLT

If that's not what you want, see http://perl-begin.org/uses/xml/ .

(Warning: I now maintain both XML::LibXML and XML::LibXSLT, so I may be a bit
biased.)

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
List of Text Editors and IDEs - http://shlom.in/IDEs

If the mountain will not come to Muhammad, then Muhammad will go to the
mountain. If the mountain will not come to Chuck Norris, then the mountain
will suffer Norris’s wrath for not complying with his whims.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to