SAX XML Java Entities problem

I've a problem with SAX and Java.

I'm parsing the dblp digital library database xml file (which enumerates journal, conferences, paper). The XML file is very large (> 700MB).

However, my problem is that when the callback characters() returns, if the string retrieved contains several entities, the method only returns the string starting from the last entity characters found.

i.e.: R&uuml;diger Mecke is the original author name held between <author> tags

├╝diger Mecke is the result

(The String returned from characters (ch[], start, length) method).

I would like to know:

  1. how to prevent the PArser to automatically resolve entities?
  2. how to solve the truncated characters problem previously described?


characters() is not guaranteed to return of all the characters in a single call. From the Javadoc:

The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks.

You need to append the characters returned in all of the calls, something like:

private StringBuffer tempValue = new StringBuffer();

    tempValue.setLength(0); // clear buffer...

characters(characters(char[] ch, int start, int length)
    tempValue.append(ch, start, length); // append to buffer

    String value = tempValue.toString(); // use characters in buffer...

  1. I don't think you can turn off entity resolution.

  2. The characters method can be called multiple times for a single tag, and you have to collect the characters across the multiple calls rather than expecting them all to arrive at once.

Need Your Help

URL Variable passing into Curl

c++ curl

I'm new to cURL and needed it for my assignment. And I'm using C++ for this.

How to print #(sharp sign) in a Makefile

makefile escaping

Suppose you have a variable which is set as:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.