Curiosities during an XML file exploitation
up vote
-3
down vote
favorite
My purpose is an easy string find and replace in an XML File.
But in this file I have several lines with this characters pattern: <!
. When my command for /F "tokens=* delims=" %%r in ('myfile.xml)
meet this pattern the value of %%r
has not the beginning of block:
The second line of my file is:
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by MTPI (MTPI) -->
and I get the value (//www.xmlspy.com) by MTPI (MTPI) -->
in my variable row (%%r
)
The second curiosity is about the using variables with the replace syntax:
row=!row:%searchPattern%=%replacePattern%!
where searchPattern = ^<Debug^>1^</Debug^>
and replacePattern = ^<Debug/^>!
The using variables doesn't work or my write is wrong I must use the hard values
I would like to use variables
Could you help me for the first anomaly the partial line retrieving?
xml windows batch-file cmd
add a comment |
up vote
-3
down vote
favorite
My purpose is an easy string find and replace in an XML File.
But in this file I have several lines with this characters pattern: <!
. When my command for /F "tokens=* delims=" %%r in ('myfile.xml)
meet this pattern the value of %%r
has not the beginning of block:
The second line of my file is:
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by MTPI (MTPI) -->
and I get the value (//www.xmlspy.com) by MTPI (MTPI) -->
in my variable row (%%r
)
The second curiosity is about the using variables with the replace syntax:
row=!row:%searchPattern%=%replacePattern%!
where searchPattern = ^<Debug^>1^</Debug^>
and replacePattern = ^<Debug/^>!
The using variables doesn't work or my write is wrong I must use the hard values
I would like to use variables
Could you help me for the first anomaly the partial line retrieving?
xml windows batch-file cmd
2
Sorry, but your question is pretty unclear... You should list a section of your file, the desired output and the real output because we can not see your screen from here... About the second "curiosity" (please, don't call this way the things you don't understand) just enclose in quotes the variable and its value:set "row=!row:%searchPattern%=%replacePattern%!"
(I assumed that you are using aset
command. Why you didn't show it?).
– Aacini
Nov 7 at 10:56
I have never heard of this MS-DOS replace syntax. What command are you using, and are you actually running this under DOS and not under a commandline in Windows?
– Bernhard Eriksson
Nov 7 at 11:22
That code has nothing to do with MS-DOS or Windows batch, and your question is very unclear. I have no idea what your problem is here, or what the random link to XMLSpy is supposed to provide, and I don't know what the anomaly is that you're asking for help with here.
– Ken White
Nov 7 at 13:38
I would highly advise you to use a different scripting language to do changes to an XML file. Powershell, Jscript and Vbscript all have native methods to read and write XML files. You basically have to brute force it with batch files.
– Squashman
Nov 7 at 16:23
add a comment |
up vote
-3
down vote
favorite
up vote
-3
down vote
favorite
My purpose is an easy string find and replace in an XML File.
But in this file I have several lines with this characters pattern: <!
. When my command for /F "tokens=* delims=" %%r in ('myfile.xml)
meet this pattern the value of %%r
has not the beginning of block:
The second line of my file is:
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by MTPI (MTPI) -->
and I get the value (//www.xmlspy.com) by MTPI (MTPI) -->
in my variable row (%%r
)
The second curiosity is about the using variables with the replace syntax:
row=!row:%searchPattern%=%replacePattern%!
where searchPattern = ^<Debug^>1^</Debug^>
and replacePattern = ^<Debug/^>!
The using variables doesn't work or my write is wrong I must use the hard values
I would like to use variables
Could you help me for the first anomaly the partial line retrieving?
xml windows batch-file cmd
My purpose is an easy string find and replace in an XML File.
But in this file I have several lines with this characters pattern: <!
. When my command for /F "tokens=* delims=" %%r in ('myfile.xml)
meet this pattern the value of %%r
has not the beginning of block:
The second line of my file is:
<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by MTPI (MTPI) -->
and I get the value (//www.xmlspy.com) by MTPI (MTPI) -->
in my variable row (%%r
)
The second curiosity is about the using variables with the replace syntax:
row=!row:%searchPattern%=%replacePattern%!
where searchPattern = ^<Debug^>1^</Debug^>
and replacePattern = ^<Debug/^>!
The using variables doesn't work or my write is wrong I must use the hard values
I would like to use variables
Could you help me for the first anomaly the partial line retrieving?
xml windows batch-file cmd
xml windows batch-file cmd
edited Nov 7 at 16:16
Ross Ridge
27.1k54578
27.1k54578
asked Nov 7 at 10:28
Philippe GODEFROY
102
102
2
Sorry, but your question is pretty unclear... You should list a section of your file, the desired output and the real output because we can not see your screen from here... About the second "curiosity" (please, don't call this way the things you don't understand) just enclose in quotes the variable and its value:set "row=!row:%searchPattern%=%replacePattern%!"
(I assumed that you are using aset
command. Why you didn't show it?).
– Aacini
Nov 7 at 10:56
I have never heard of this MS-DOS replace syntax. What command are you using, and are you actually running this under DOS and not under a commandline in Windows?
– Bernhard Eriksson
Nov 7 at 11:22
That code has nothing to do with MS-DOS or Windows batch, and your question is very unclear. I have no idea what your problem is here, or what the random link to XMLSpy is supposed to provide, and I don't know what the anomaly is that you're asking for help with here.
– Ken White
Nov 7 at 13:38
I would highly advise you to use a different scripting language to do changes to an XML file. Powershell, Jscript and Vbscript all have native methods to read and write XML files. You basically have to brute force it with batch files.
– Squashman
Nov 7 at 16:23
add a comment |
2
Sorry, but your question is pretty unclear... You should list a section of your file, the desired output and the real output because we can not see your screen from here... About the second "curiosity" (please, don't call this way the things you don't understand) just enclose in quotes the variable and its value:set "row=!row:%searchPattern%=%replacePattern%!"
(I assumed that you are using aset
command. Why you didn't show it?).
– Aacini
Nov 7 at 10:56
I have never heard of this MS-DOS replace syntax. What command are you using, and are you actually running this under DOS and not under a commandline in Windows?
– Bernhard Eriksson
Nov 7 at 11:22
That code has nothing to do with MS-DOS or Windows batch, and your question is very unclear. I have no idea what your problem is here, or what the random link to XMLSpy is supposed to provide, and I don't know what the anomaly is that you're asking for help with here.
– Ken White
Nov 7 at 13:38
I would highly advise you to use a different scripting language to do changes to an XML file. Powershell, Jscript and Vbscript all have native methods to read and write XML files. You basically have to brute force it with batch files.
– Squashman
Nov 7 at 16:23
2
2
Sorry, but your question is pretty unclear... You should list a section of your file, the desired output and the real output because we can not see your screen from here... About the second "curiosity" (please, don't call this way the things you don't understand) just enclose in quotes the variable and its value:
set "row=!row:%searchPattern%=%replacePattern%!"
(I assumed that you are using a set
command. Why you didn't show it?).– Aacini
Nov 7 at 10:56
Sorry, but your question is pretty unclear... You should list a section of your file, the desired output and the real output because we can not see your screen from here... About the second "curiosity" (please, don't call this way the things you don't understand) just enclose in quotes the variable and its value:
set "row=!row:%searchPattern%=%replacePattern%!"
(I assumed that you are using a set
command. Why you didn't show it?).– Aacini
Nov 7 at 10:56
I have never heard of this MS-DOS replace syntax. What command are you using, and are you actually running this under DOS and not under a commandline in Windows?
– Bernhard Eriksson
Nov 7 at 11:22
I have never heard of this MS-DOS replace syntax. What command are you using, and are you actually running this under DOS and not under a commandline in Windows?
– Bernhard Eriksson
Nov 7 at 11:22
That code has nothing to do with MS-DOS or Windows batch, and your question is very unclear. I have no idea what your problem is here, or what the random link to XMLSpy is supposed to provide, and I don't know what the anomaly is that you're asking for help with here.
– Ken White
Nov 7 at 13:38
That code has nothing to do with MS-DOS or Windows batch, and your question is very unclear. I have no idea what your problem is here, or what the random link to XMLSpy is supposed to provide, and I don't know what the anomaly is that you're asking for help with here.
– Ken White
Nov 7 at 13:38
I would highly advise you to use a different scripting language to do changes to an XML file. Powershell, Jscript and Vbscript all have native methods to read and write XML files. You basically have to brute force it with batch files.
– Squashman
Nov 7 at 16:23
I would highly advise you to use a different scripting language to do changes to an XML file. Powershell, Jscript and Vbscript all have native methods to read and write XML files. You basically have to brute force it with batch files.
– Squashman
Nov 7 at 16:23
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53187625%2fcuriosities-during-an-xml-file-exploitation%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Sorry, but your question is pretty unclear... You should list a section of your file, the desired output and the real output because we can not see your screen from here... About the second "curiosity" (please, don't call this way the things you don't understand) just enclose in quotes the variable and its value:
set "row=!row:%searchPattern%=%replacePattern%!"
(I assumed that you are using aset
command. Why you didn't show it?).– Aacini
Nov 7 at 10:56
I have never heard of this MS-DOS replace syntax. What command are you using, and are you actually running this under DOS and not under a commandline in Windows?
– Bernhard Eriksson
Nov 7 at 11:22
That code has nothing to do with MS-DOS or Windows batch, and your question is very unclear. I have no idea what your problem is here, or what the random link to XMLSpy is supposed to provide, and I don't know what the anomaly is that you're asking for help with here.
– Ken White
Nov 7 at 13:38
I would highly advise you to use a different scripting language to do changes to an XML file. Powershell, Jscript and Vbscript all have native methods to read and write XML files. You basically have to brute force it with batch files.
– Squashman
Nov 7 at 16:23