The Parse JSON activity may throw "ValidationException: An invalid XML character..." exception when paring json string with "\f" or "\b"

The Parse JSON activity may throw "ValidationException: An invalid XML character..." exception when paring json string with "\f" or "\b"

book

Article ID: KB0082557

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for REST and JSON 2.0.0, 2.0.1, 2.1.0

Description

Some customers may encounter below exception when using REST JSON Plugin Parse JSON activity to parse json string contains "\f" or "\b", for example {"key":"test\f"}

============
An error occurred while converting json to xml:  cn.techlab.datar.exception.ValidationException: An invalid XML character
        <?tibco-char C?>
......
at cn.techlab.datar.xml.XmlChar.validateText(XmlChar.java:774)
    at cn.techlab.datar.xml.validator.DefaultValidator.validateValue(DefaultValidator.java:60)
    at cn.techlab.datar.xml.validator.DefaultValidator.validateText(DefaultValidator.java:72)
    at cn.techlab.datar.xml.validator.ValidatorChain.validateText(ValidatorChain.java:54)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleText(JSONParserHandler.java:613)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleSubElement(JSONParserHandler.java:486)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleSubElements(JSONParserHandler.java:459)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleObject(JSONParserHandler.java:241)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleXml(JSONParserHandler.java:157)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleSubElement(JSONParserHandler.java:490)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleSubElements(JSONParserHandler.java:459)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleObject(JSONParserHandler.java:241)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleXml(JSONParserHandler.java:157)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleSubElement(JSONParserHandler.java:490)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleSubElements(JSONParserHandler.java:459)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleObject(JSONParserHandler.java:241)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleXml(JSONParserHandler.java:157)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleSubElement(JSONParserHandler.java:490)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleSubElements(JSONParserHandler.java:439)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleObject(JSONParserHandler.java:241)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.handleXml(JSONParserHandler.java:157)
    at com.tibco.plugin.json.runtime.parser.handler.JSONParserHandler.endDocument(JSONParserHandler.java:101)
    at cn.techlab.datar.json.JSONParser.parse(JSONParser.java:87)
    at cn.techlab.datar.json.JSONParser.parse(JSONParser.java:69)
============
 

Issue/Introduction

The Parse JSON activity may throw "ValidationException: An invalid XML character..." exception when paring json string with "\f" or "\b"

Environment

Operation System: All

Resolution

This issue is related to XML specifications. As per XML specifications, XML processor must accept any characters from below mentioned valid character range : 

============
Char : x9|#xA|#xD|x20-#xD7FF|xE000-#xFFFD|x10000-#x10FFFF
============

Please note "\b" has code #x8, "\f" has code "#xC" which does not fit into this range, hence they are unsupported in the XML, "\b" and "\f" are not handled in the Parse JSON activity.

To avoid this issue, customer can replace "\b" or "\f" with other valid values.
 

Additional Information

https://www.w3.org/TR/xml/#charsets