File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes Firing of Character method of Defualt Handler Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Firing of Character method of Defualt Handler" Watch "Firing of Character method of Defualt Handler" New topic
Author

Firing of Character method of Defualt Handler

Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
I have written SAX parser to parse XML document.
Which has been working on my local machine having Windows platform.

When I moved the same code to our Unix box it behaves different.

For document like this --

<?xml version="1.0" encoding="UTF-8"?>
<root>
<EMP>
<EMP_ID>201188</EMP_ID>
<CREATED_DT>2005-04-14T07:05:09.257</CREATED_DT>
<LAST_MOD_DT>2005-04-14T07:05:09.257</LAST_MOD_DT>
</EMP>
</root>

public void characters( ... )
method is fired for <EMP>
in windows.
Where as on Unix this method is not fired.

Why this inconsustency?
Work around other than changing the code?

Thanks
Gemini
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12836
    
    5
Presumably the parser on Unix is "ignoring" whitespace - namely the crlf right after the EMP element.
Bill
Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
Your are right. But can I know why is it ignoring it in Unix and not in Windows.

This is needing me to change my code significantly!!

Your inputs are appreciated.

Thanks!
Gemini
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12836
    
    5
I would guess that the parser is reading some default settings - possibly environment values, and that these are not the same in the two systems? Since you don't say anything about the Java version or where the SAX parser is coming from, thats about all I can say.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Firing of Character method of Defualt Handler