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="http://www.verizonwireless.com/oas" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.verizonwireless.com/oas http://durbdd02.ddc.vzwcorp.com:8085/schema/reseller.xsd"> <messageHeader>  </messageHeader> <order>  <orderTimeStamp>01/05/2002 00:00:00</orderTimeStamp>  <accountNumber>1123</accountNumber>  <subOrder>  </subOrder> </order></resellerOrder>"};
ANISHKA1Asked:
Who is Participating?
 
ksivananthConnect With a Mentor Commented:
you need to escape the double quotes!

for e.g.,

" should be replaced with \"
0
 
ANISHKA1Author Commented:
Thanks.
0
 
ksivananthCommented:
try this,

String xmlData = "<?xml version=\"1.0\" encoding=\"utf-8\"?><resellerOrder xmlns=\"http://www.verizonwireless.com/oas\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.verizonwireless.com/oas http://durbdd02.ddc.vzwcorp.com:8085/schema/reseller.xsd\"> <messageHeader>  </messageHeader> <order>  <orderTimeStamp>01/05/2002 00:00:00</orderTimeStamp>  <accountNumber>1123</accountNumber>  <subOrder>  </subOrder> </order></resellerOrder>" ;
0
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.