Kevin Riff
Kevin Riff

Reputation: 1

What is a "TBS chunk"?

I'm planning to write a SAX2 XML parser and I would like to support as many standard options as I can. However, I'm really scratching my head trying to understand what the http://xml.org/sax/properties/xml-string property is supposed to be. The documentation (from the JavaDocs for the org.xml.sax package) reads:

Readable only during a parser callback, this exposes a TBS chunk of characters responsible for the current event.

What on Earth is a "TBS chunk"?

I've tried Googling various combinations of "tbs chunk", "sax", and "xml-string" but I'm not finding any useful results. Mostly it's pages about how to parse a chunk of XML using SAX. Surely someone has better Google-fu than I do?

Upvotes: 0

Views: 36

Answers (1)

Thomas Kläger
Thomas Kläger

Reputation: 21435

Addendum: TBS could be the acronym for "To Be Specified" (https://www.allacronyms.com/TBS).

In that case a "TBS chunk of characters" would translate to a "to be specified chunk of characters" - i.e. nobody ever cared to specify what the value of this property should be.


The JDK contains several class that implement parser configurations:

And all of these classes specify the same behaviour for the xml-string property:

    // special cases
    if (propertyId.startsWith(Constants.SAX_PROPERTY_PREFIX)) {
        final int suffixLength = propertyId.length() - Constants.SAX_PROPERTY_PREFIX.length();

        //
        // http://xml.org/sax/properties/xml-string
        // Value type: String
        // Access: read-only
        //   Get the literal string of characters associated with the
        //   current event.  If the parser recognises and supports this
        //   property but is not currently parsing text, it should return
        //   null (this is a good way to check for availability before the
        //   parse begins).
        //
        if (suffixLength == Constants.XML_STRING_PROPERTY.length() &&
            propertyId.endsWith(Constants.XML_STRING_PROPERTY)) {
            // REVISIT - we should probably ask xml-dev for a precise
            // definition of what this is actually supposed to return, and
            // in exactly which circumstances.
            return PropertyState.NOT_SUPPORTED;
        }
    }

The default SAX parsers of Java do not support this property.


If you still want to support it I found the following traces of the "xml-string" property in Python:

Upvotes: 0

Related Questions