-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't find element when source document contain an xsd #1
Comments
I had the same issue. After troubleshooting for a while, I found the following approach to work using a function as an argument and explicitly changing the root element. var gulp = require('gulp'),
fs = require('fs'),
xeditor = require('gulp-xml-editor');
gulp.task('xeditor', function () {
// using fs to prevent caching
var pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
return gulp.src('./config.xml')
.pipe(xeditor(function(xml, xmljs) {
xml.root().attr({
version: pkg.version
});
return xml.toString();
}))
.pipe(gulp.dest('./'));
}); |
I can't understand this problem. I think @matthew-b-payne takes same document like following.
What is problem? Please give me more detailed situation. |
Hi.. i have problem usign config.xml in ionicframework project.. this is the original:
using this the gulp script failed with this errors: without the attributes : xmlns e xmlns:cdv.... works Fine! Can you help me? |
Take document:
this is namegulp.task('xmlmod', function() {
gulp.src("./text.xml")
.pipe(xeditor([
{path: '//name', text: 'new names2'},
{path: '//version', attr: {'major': '2'}}
]))
.pipe(gulp.dest("./dest"));
});
Works !!!
Change document to:
this is nameThe task then errors with:
Error in plugin 'gulp-xml-editor'
Can't find element at "//widget"
at D:\exp\ionic-cordova-seed\node_modules\gulp-xml-editor\index.js:20:26
at Array.forEach (native)
at editByObject (D:\exp\ionic-cordova-seed\node_modules\gulp-xml-editor\index.js:17:12)
at Transform._transform (D:\exp\ionic-cordova-seed\node_modules\gulp-xml-editor\index.js:64:34)
at Transform._read (D:\exp\ionic-cordova-seed\node_modules\gulp-xml-editor\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:184:10)
at Transform._write (D:\exp\ionic-cordova-seed\node_modules\gulp-xml-editor\node_modules\through2\node_modules\readable-stream\lib_stream_transform.js:172:12)
at doWrite (D:\exp\ionic-cordova-seed\node_modules\gulp-xml-editor\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:237:10)
at writeOrBuffer (D:\exp\ionic-cordova-seed\node_modules\gulp-xml-editor\node_modules\through2\node_modules\readable-stream\lib_stream_writable.js:227:5)
The text was updated successfully, but these errors were encountered: