Need help to declare String variable in Java

I have String variable to declare.Input value is  XML data  and i want to declare it as string. but  iyt is giving syntax error :i have put dounle quotes between string.
Here is  String declaration:
String xmlData="<?xml version="1.0" encoding="utf-8"?><resellerOrder xmlns="" xmlns:xsi="" xsi:schemaLocation=""> <messageHeader>  </messageHeader> <order>  <orderTimeStamp>01/05/2002 00:00:00</orderTimeStamp>  <accountNumber>1123</accountNumber>  <subOrder>  </subOrder> </order></resellerOrder>"};
Who is Participating?
ksivananthConnect With a Mentor Commented:
you need to escape the double quotes!

for e.g.,

" should be replaced with \"
ANISHKA1Author Commented:
try this,

String xmlData = "<?xml version=\"1.0\" encoding=\"utf-8\"?><resellerOrder xmlns=\"\" xmlns:xsi=\"\" xsi:schemaLocation=\"\"> <messageHeader>  </messageHeader> <order>  <orderTimeStamp>01/05/2002 00:00:00</orderTimeStamp>  <accountNumber>1123</accountNumber>  <subOrder>  </subOrder> </order></resellerOrder>" ;
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.