eksemel

command module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 13 Imported by: 0

README

An XML file manipulator

Go Report Card MIT License

eksemel

Add, update and delete from an XML file by XPath.

An example (Windows batchfile)

<?xml version="1.0" standalone="yes"?>
<xml>
    <command name="add">
        <options>
            <option name="xpath">
                <required required="true" />
                <desc>An XPath to the parent</desc>
            </option>
            <option name="name">
                <desc>The name of added node</desc>
            </option>
            <option name="value">
                <desc>@attrname, '#cdata-section', '#text' and '#comment' can have --value</desc>
            </option>
        </options>
    </command>
    <command name="replace">
        <options>
            <option name="xpath">
                <required required="true" />
                <desc>An XPath to the target</desc>
            </option>
            <option name="value">
                <desc>new value</desc>
            </option>
            <option name="dummy">
                <desc>this is a false</desc>
            </option>
            <synopsis>eksemel replace --xpath "//a/b/c/text()" --value "new text"</synopsis>
        </options>
    </command>
</xml>
eksemel add --xpath \"//command[@name='add']//option[@name='name']\" --name #comment --value "ADD" help_wip.xml | ^
eksemel add --xpath \"//command[@name='add']/options\" --ennet "\"option[name=ennet]{emmet-like abbreviation}\"" | ^
eksemel delete --xpath \"//command[@name='replace']//option[@name='dummy']\" | ^
eksemel replace --xpath \"/xml\" --value eksemel > help.xml

eksemel get --xpath \"//desc/text()\" --multiple help.xml

Install

GitHub Releases

https://github.com/shu-go/eksemel/releases

Go install

go install github.com/shu-go/eksemel@latest

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL