Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Detect XML document encodings with SAX

Reply
Thread Tools

Detect XML document encodings with SAX

 
 
Gene Wirchenko
Guest
Posts: n/a
 
      12-13-2012
On Wed, 12 Dec 2012 21:09:32 -0500, Arne Vajhøj <>
wrote:

>On 12/12/2012 9:03 PM, Gene Wirchenko wrote:
>> On Sun, 25 Nov 2012 16:30:20 -0500, Arne Vajhøj <>
>> wrote:
>>
>> [snip]
>>
>>> If you don't want input files, then ask for a MSSSCCE and link

>> ^^^^^^^
>>> to the rules for that.

>>
>> Please expand your new acronym.

>
>MarkSpace SSCCE
>
>


Thank you.

Sincerely,

Gene Wirchenko
 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      12-13-2012
Arne Vajhøj wrote:
> Lew wrote:
>> Apparently the OP gave up on getting help and was unwilling to provide the
>> materials requested.

>
> ????
>
> Steven Simpson solved the problem with the provided information.
>
> And OP acknowledged it.


I stand corrected.

--
Lew
 
Reply With Quote
 
 
 
 
Stanimir Stamenkov
Guest
Posts: n/a
 
      12-16-2012
Wed, 21 Nov 2012 15:32:19 +0100, /Sebastian/:

> I discovered this post:
> http://www.ibm.com/developerworks/library/x-tipsaxxni/
>
> and implemented both approaches (SAX and Xerces XNI).
>
> Unfortunately, for the attached XML file, both methods
> output an encoding of UTF-8, while looking at the file
> makes it clear that it is not UTF-8 encoded (all characters,
> including the umlaut and the Euro-sign, take one byte, and the
> declared encoding also is not UTF-.
>
> Does anyone have an idea why that is so? And how I could
> go about making some XML parser determine the correct encoding?


Sorry if this has been answered already elsewhere in the thread.
The XML specification has a guideline for detecting the source encoding:

http://www.w3.org/TR/xml/#sec-guessing

and this is basically what parsers do. One-byte encodings are
basically indistinguishable from each other and they could be only
reliably detected in presence of an explicit encoding
information/declaration.

--
Stanimir
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
Print XML parsing to JspWriter (out) Class org.xml.sax.helpers.NewInstance can not access a member of class javax.xml.parsers.SAXParser with modifiers "protected" Per Magnus L?vold Java 0 11-15-2004 02:27 PM
Help on including one XML document within another XML document using XML Schemas Tony Prichard XML 0 12-12-2003 03:18 PM
Re: OutOfMemoryError when using SAX to process an XML document Robert Olofsson Java 3 07-03-2003 10:36 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57