Java 将XML从JSF textarea传递到Bean

Java 将XML从JSF textarea传递到Bean,java,xml,jsf,tomcat,jsf-2,Java,Xml,Jsf,Tomcat,Jsf 2,我需要从JSFtextarea传递XMLstring。问题是XML被编码,而I无法将其传递到验证中。我的验证方法如下所示: public boolean validate(String data) { Source xmlFile = new StreamSource(data); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); try

我需要从
JSF
textarea传递
XML
string。问题是
XML
被编码,而I无法将其传递到验证中。我的验证方法如下所示:

public boolean validate(String data) {
    Source xmlFile = new StreamSource(data);
    SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    try {
        URL kenexaSchema = getClass().getClassLoader().getResource("KenexaXMLConfiguration.xsd");
        Schema schema = schemaFactory.newSchema(kenexaSchema);
        Validator validator = schema.newValidator();
        validator.validate(xmlFile);
        LOGGER.debug(xmlFile.getSystemId() + " is valid");
        return true;
    } catch (SAXException ex) {
        LOGGER.error(xmlFile.getSystemId() + " is not valid.", ex);
        LOGGER.error("Reason: " + ex.getLocalizedMessage());
        return false;
    } catch (IOException ex) {
        LOGGER.error("IO Exception occurred while validating proivder data.", ex);
        LOGGER.error("Reason: " + ex.getLocalizedMessage());
        return false;
    }
}
输入参数
数据
XML
字符串
。当
schemaFactory
调用方法
newSchema
时,我得到错误:

java.net.MalformedURLException: no protocol: %3C?xml%20version=%221.0%22%20encoding=%22UTF-8%22?%3E%0D%0A%3Cxmlresults%3E%0D%0A%20%20%20%20%3Cdata%3E%0D%0A%20%20%20%20%20%20%20%20%3Cid%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Crespondentdata%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Ctestid%3E22000%3C/testid%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Crespondentid%3Ermtest13%3C/respondentid%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Ctestsessionid%3E5981%3C/testsessionid%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Ctestinstanceid%3E136485%3C/testinstanceid%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cexample%3E0%3C/example%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cstatus_code%3E0%3C/status_code%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cstatus_desc%3ECOMPLETED%20SUCCESSFULLY%3C/status_desc%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cstart_time%3E14/08/06%2016:22:32%3C/start_time%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cend_time%3E14/08/06%2016:23:42%3C/end_time%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%3C/respondentdata%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%3Cresultdata%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cscale%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cscalename%3ESocial%3C/scalename%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Craw_score%3E28.00%3C/raw_score%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Ct-score%3E44%3C/t-score%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Csten_scrore%3E4%3C/sten_scrore%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Ctime_taken%3E65686%3C/time_taken%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Citems_attempted%3E80%3C/items_attempted%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfinal_score%3E26%3C/final_score%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C/scale%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cscale%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cscalename%3ELeader%3C/scalename%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Craw_score%3E23.00%3C/raw_score%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Ct-score%3E27%3C/t-score%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Csten_scrore%3E1%3C/sten_scrore%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Ctime_taken%3E658654%3C/time_taken%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Citems_attempted%3E80%3C/items_attempted%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Cfinal_score%3E26%3C/final_score%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C/scale%3E%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%3C/resultdata%3E%0D%0A%20%20%20%20%20%20%20%20%3C/id%3E%0D%0A%20%20%20%20%3C/data%3E%0D%0A%3C/xmlresults%3E
是否有某种方法可以从
JSF
textArea传递未编码的
XML

我使用的是
JSF2.0
,应用程序部署在Tomcat6上。

很抱歉出现错误警报。问题不是JSF textarea,而是这一行:

URL kenexaSchema = getClass().getClassLoader().getResource("KenexaXMLConfiguration.xsd");
我找到了以不同的方式获取XSD的方法,现在它开始工作了