Re: sed for XML

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: Kevin Fries
Date:  
To: Main PLUG discussion list
Subject: Re: sed for XML
Xmlstarlet

http://xmlstar.sourceforge.net

Kevin



⁣Sent from BlueMail ​

On Sep 12, 2018, 12:48 AM, at 12:48 AM, "der.hans" <> wrote:
>moin moin,
>
>Actually, sgrep with sed for XML :).
>
>I have a chunk of XML I would like to transform. Any suggestions on how
>to
>do the following from the command line?
>
>----
>     <table:table-row>
>      <table:table-cell table:style-name="Table1.A1"
>office:value-type="string">
>       <text:p text:style-name="Standard">blah content stuff</text:p>
>      </table:table-cell>
>      <table:table-cell table:number-columns-spanned="2"
>office:value-type="string">
>       <text:p text:style-name="Standard"/>
>      </table:table-cell>
>      <table:covered-table-cell/>
>     </table:table-row>
>----

>
>I would like to make the first cell span 3 columns and wipe out the
>second
>cell.
>
>The graphical tool essentially turns it into the following.
>
>----
>     <table:table-row>
>      <table:table-cell table:style-name="Table1.A2"
>table:number-columns-spanned="3" office:value-type="string">
>       <text:p text:style-name="Standard">blah content stuff</text:p>
>      </table:table-cell>
>      <table:covered-table-cell/>
>     </table:table-row>
>----

>
>A new style, Table1.A2, is introduced. That cell is spanned across
>three
>columnts. The table:table-cell object for the second cell is removed.
>
>I can do this with sed, but that invites XML issues. Also, there are
>some
>more complex changes I want to make.
>
>ciao,
>
>der.hans
>--
># https://www.LuftHans.com https://www.PhxLinux.org
># "Metrosexuals notwithstanding, quiche still lacks something." --
>David Brin
>---------------------------------------------------
>PLUG-discuss mailing list -
>To subscribe, unsubscribe, or to change your mail settings:
>http://lists.phxlinux.org/mailman/listinfo/plug-discuss

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss