aspose file tools*
The moose likes Beginning Java and the fly likes illegal escape charcter error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "illegal escape charcter error" Watch "illegal escape charcter error" New topic
Author

illegal escape charcter error

jyothsna ananthula
Ranch Hand

Joined: Jun 02, 2011
Posts: 33
hi all

please check the following code as illegal escape character.urgent please
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14348
    
  22

The backslash \ character in string literals is the escape character. It allows you to write for example \n for a newline, \t for a tab etc.

If you write "C:\Documents and Settings\JA0084604\Desktop\test1a.xml" then Java is going to complain that \D and \J are illegal escape sequences. If you want to include a literal backslash in your string, you have to write \\ (two backslashes).

So, change the string to: "C:\\Documents and Settings\\JA0084604\\Desktop\\test1a.xml"

Please UseCodeTags when you post source code. Also, please EaseUp.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
jyothsna ananthula
Ranch Hand

Joined: Jun 02, 2011
Posts: 33
thanks alot. i am suffering with since 1 hr.i changed as like that but for only c i did remaining i didnt.

if you know xmldiff classe let me know please.its urgent to me
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19761
    
  20

jyothsna ananthula wrote:thanks alot.

Where did you see an Alot?

i am suffering with since 1 hr.i changed as like that but for only c i did remaining i didnt.

Please UseRealWords: "hour" and "see" (I think) instead of "hr" and "c".

its urgent to me

Please EaseUp.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
jyothsna ananthula
Ranch Hand

Joined: Jun 02, 2011
Posts: 33
In the following code i am getting error at a.setDocuments(xmlDocument1,xmlDocument2); cann't find symbol xmlDocument1 and xmlDocument2




any body help me out please.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11479
    
  16

I added code tags to your post to make it more legible. Next time, just highlight your code and click the little "code" button above - just like you wanted to make something italic or bold (but don't make your code italic or bold...)

To answer your question...

You declare your XMLDocument inside your try block. therefore, as soon as you go out of the try block the document falls out of scope, and thus doesn't exist anymore. The solution would be to declare them outside the try block, but still assign them inside...something like this:



Note: I didn't actually test/compile this, so i'm not 100% sure i have it correct...


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
jyothsna ananthula
Ranch Hand

Joined: Jun 02, 2011
Posts: 33
thanks. you are right i got it.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: illegal escape charcter error