Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] newbie regex question

Expand Messages
  • merlyn@stonehenge.com
    ... mdowsz Hey list mdowsz could anyone on the list give me some hints on creating a quick and mdowsz dirty script to transform sgml code to xml compliant
    Message 1 of 3 , Nov 1, 2003
    • 0 Attachment
      >>>>> "mdowsz" == mdowsz <mdowsz@...> writes:

      mdowsz> Hey list
      mdowsz> could anyone on the list give me some hints on creating a quick and
      mdowsz> dirty script to transform sgml code to xml compliant code. In the case
      mdowsz> of the data I'm working with i really just need to switch all caps
      mdowsz> within tags to their lowercased equivelents, nothing fancy.

      mdowsz> so for example i would like this

      mdowsz> <DSC TYPE="IN-DEPTH">
      mdowsz> <HEAD>Collection Listing</HEAD>
      mdowsz> <C01 LEVEL="SERIES">
      mdowsz> <DID><UNITTITLE>my title</UNITTITLE></DID>
      mdowsz> </C01>
      mdowsz> .....
      mdowsz> to become this
      mdowsz> .......

      mdowsz> <dsc type="in-depth">
      mdowsz> <head>Collection Listing</head>
      mdowsz> <c01 level="series">
      mdowsz> <did><unittitle>my title</unittitle></did>
      mdowsz> </c01>
      mdowsz> </dsc>
      mdowsz> .........

      mdowsz> I'm working on learning regex, but havent had much luck yet.
      mdowsz> any perspective would be appreciated.

      Using "xsh" (see xsh.sourceforge.net), this would be as simple
      as:

      open d = "originalfile.sgml";
      rename { $_ = lc $_ } //*;
      # if you want attributes lowercased as well as elements, make that:
      # rename { $_ = lc $_ } //*|//@*;
      save d "newfile.xml";

      xsh rocks.

      --
      Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
      <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
      Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
      See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
    • mdowsz
      looks great thanks! ... 777 0095 ... training!
      Message 2 of 3 , Nov 3, 2003
      • 0 Attachment
        looks great thanks!


        > Using "xsh" (see xsh.sourceforge.net), this would be as simple
        > as:
        >
        > open d = "originalfile.sgml";
        > rename { $_ = lc $_ } //*;
        > # if you want attributes lowercased as well as elements, make that:
        > # rename { $_ = lc $_ } //*|//@*;
        > save d "newfile.xml";
        >
        > xsh rocks.
        >
        > --
        > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503
        777 0095
        > <merlyn@s...> <URL:http://www.stonehenge.com/merlyn/>
        > Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
        > See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
        training!
      Your message has been successfully submitted and would be delivered to recipients shortly.