nmsmith22389 / vscode-incrementor

Advanced increment / decrement actions for (almost) anything.
13 stars 10 forks source link

Possible to use incrementor as part of a search and replace in xml? #21

Open psyciknz opened 3 years ago

psyciknz commented 3 years ago

I have a bunch of xml elements an array (could be applied to json as well). They would have a known path - the report-type:deliverySubject.

<?xml version="1.0" encoding="utf-8"?>
<report-type:ManifestReportFile xsi:schemaLocation="http://ad.cc.exstream.hp.com/report-manifest/2011/02/xsd/ManifestReportFile1.1.xsd"
    xmlns:report-type="http://ad.cc.exstream.hp.com/report-manifest/2011/02/xsd/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <report-type:customer>
        <report-type:customerName></report-type:customerName>
        <report-type:customerRecordHandler handlerName="unique_id" handlerValue="000001_1"></report-type:customerRecordHandler>
        <report-type:deliveryChannel>
            <report-type:preferredChannelType>smtp_email</report-type:preferredChannelType>
            <report-type:outputFilePath>000001_1.pdf</report-type:outputFilePath>
            <report-type:channelData>
                <report-type:channelMetadata>
                    <report-type:key>email_from</report-type:key>
                    <report-type:keyValue>from@email.address.com</report-type:keyValue>
                </report-type:channelMetadata>
                <report-type:channelMetadata>
                    <report-type:key>email_id</report-type:key>
                    <report-type:keyValue>to@email.address.com</report-type:keyValue>
                </report-type:channelMetadata>
                <report-type:channelMetadata>
                    <report-type:key>email_headers</report-type:key>
                    <report-type:keyValue>X-MSYS-API:{"campaign_id":"1", "metadata":{"account_number":"000001","app_id":"ABC","file_name":"abc","date":"20160531","customer_name":"INT-ZONE-2","customer_number":"000001"} }</report-type:keyValue>
                </report-type:channelMetadata>
            </report-type:channelData>
            <report-type:deliverySubject>Statement for 31 May 2016 - 1</report-type:deliverySubject>
            <report-type:emailBody contentType="text/html">000001_1.html</report-type:emailBody>
        </report-type:deliveryChannel>
        <report-type:status></report-type:status>
        <report-type:customerRecordId>1</report-type:customerRecordId>
        <report-type:isLastChannel></report-type:isLastChannel>
    </report-type:customer>
    <report-type:customer>
        <report-type:customerName></report-type:customerName>
        <report-type:customerRecordHandler handlerName="unique_id" handlerValue="000002_1"></report-type:customerRecordHandler>
        <report-type:deliveryChannel>
            <report-type:preferredChannelType>smtp_email</report-type:preferredChannelType>
            <report-type:outputFilePath>000002_1.pdf</report-type:outputFilePath>
            <report-type:channelData>
                <report-type:channelMetadata>
                    <report-type:key>email_from</report-type:key>
                    <report-type:keyValue>from@email.address.com</report-type:keyValue>
                </report-type:channelMetadata>
                <report-type:channelMetadata>
                    <report-type:key>email_id</report-type:key>
                    <report-type:keyValue>to@email.address.com</report-type:keyValue>
                </report-type:channelMetadata>
                <report-type:channelMetadata>
                    <report-type:key>email_headers</report-type:key>
                    <report-type:keyValue>X-MSYS-API:{"campaign_id":"1", "metadata":{"account_number":"000002","app_id":"ABC","file_name":"abc","date":"20160531","customer_name":"INT-ZONE-1","customer_number":"000002"} }</report-type:keyValue>
                </report-type:channelMetadata>
            </report-type:channelData>
            <report-type:deliverySubject>Statement for 31 May 2016 - 2</report-type:deliverySubject>
            <report-type:emailBody contentType="text/html">000002_1.html</report-type:emailBody>
        </report-type:deliveryChannel>
        <report-type:status></report-type:status>
        <report-type:customerRecordId>2</report-type:customerRecordId>
        <report-type:isLastChannel></report-type:isLastChannel>
    </report-type:customer>

What Would be useful is to be able to look for a path, and to set it to increment, or text + increment. As I've done here where I've manually added -1 and -2

Is something like this possible? Or can extensions like this only tend to work via selections?