This repository has been archived by the owner. It is now read-only.
Gulp port of grunt-xmlpoke
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
LICENSE
README.md
index.js
package.json

README.md

gulp-xmlpoke

Gulp port of grunt-xmlpoke

Simple replacement

gulp.src('/path/to/file.xml')
    .pipe(xmlpoke({
      replacements : [{
          xpath : "//foo"        
        , value: "bar"
       }]
     }))
    .pipe(gulp.dest('/path/to/dest/file.xml'));

Replacing with a function

gulp.src('/path/to/file.xml')
    .pipe(xmlpoke({
      replacements : [{
          xpath : "//foo"        
        , value : function(node) { 
          var nodeValue = node.firstChild.data;          
          return nodeValue + "Bar";
       }]
     }))
    .pipe(gulp.dest('/path/to/dest/file.xml'));

Using Namespaces

gulp.src('/path/to/file.xml')
    .pipe(xmlpoke({
      replacements : [{
          xpath : "//foo:bar"
        , namespaces : {"foo" : "http://schemas.example.com/foo.xsd"}
        , value: "bar"
       }]
     }))
    .pipe(gulp.dest('/path/to/dest/file.xml'));