0

I am writing a command line executable that performs XML operations. I want the ability to pass in an XML string directly as a parameter in the command line, but I am having difficulty dealing with the double quotes (") used in the XML attributes. I tried using the escape character (^"), but that does not seem to work. How do I format the parameter to pass in correctly?

Here is an example of what isn't working so far:

"<?xml version=^"1.0^" encoding=^"UTF-8^"?><sbml xmlns=^"http://www.sbml.org/sbml/level2/version4^" level=^"2^" version=^"4^"><model metaid=^"_case00001^" id=^"case00001^" name=^"case00001^"></model></sbml>"

<?xml version="1.0" encoding="UTF-8"?><sbml xmlns="http://www.sbml.org/sbml/level2/version4" level="2" version="4"><model metaid="_case00001" id="case00001" name="case00001"></model></sbml>
user1027169
  • 2,627
  • 3
  • 27
  • 50

2 Answers2

1

Normally backslash is used to escape dbl quotes for strings, not the same as parsing xml so try using \", or, replace them with single quotes where you can.

0

Try to excape not the qoutes but '<' and '>': This works on my tests in cmd's command line:

  somecommand.exe "^<?xml version="1.0" encoding="UTF-8"?^>^<sbml xmlns="http://www.sbml.org/sbml/level2/version4" level="2" version="4"^>^<model metaid="_case00001" id="case00001" name="case00001"^>^</model^>^</sbml^>"
barbalion
  • 165
  • 7