简体   繁体   English

Google Soy模板库是否可能存在xml问题?

[英]Is it possible that Google Soy template library has problems with xml?

I am attempting to build an XML document using Soy and get the following error: 我正在尝试使用Soy构建XML文档并出现以下错误:

com.google.template.soy.parsepasses.contextautoesc.SoyAutoescapeException: In file C:\\Users\\jeff\\workspaceEMC\\PAC\\target\\classes\\templates\\XML_template.soy:33:24, template vulcan.xml.body: Failed to compute an output context for raw text `... com.google.template.soy.parsepasses.contextautoesc.SoyAutoescapeException:在文件C:\\ Users \\ jeff \\ workspaceEMC \\ PAC \\ target \\ classes \\ templates \\ XML_template.soy:33:24中,模板vulcan.xml.body:无法执行计算原始文本的输出上下文

I am wondering if the slashes etc. in the XML (this error happens prior to the tags being assigned values) throw off the parser. 我想知道XML中的斜杠等(此错误发生在为标签分配值之前)是否脱离了解析器。 I am stepping through the Soy code in the debugger but this is very tough for me. 我正在调试器中逐步执行Soy代码,但这对我来说很难。

To clarify what I am trying, my .soy template file simply looks like {$bar}... 为了弄清楚我正在尝试什么,我的.soy模板文件看起来像是{$ bar} ...

It does not fail immediately but someplace parsing deep within the template it always gives that exception. 它不会立即失败,但是会在模板内的某个位置进行深入解析,因此总是会产生该异常。

I was able to find the answers in the documentation which is not called anything like Soy. 我能够在未称为Soy的文档中找到答案。 Here is a link: https://developers.google.com/closure/templates/index . 这是一个链接: https : //developers.google.com/closure/templates/index My particular problem was solved using {template .body autoescape="deprecated-noautoescape"} as the first line of the template. 我的特定问题已通过使用{template .body autoescape =“ deprecated-noautoescape”}作为模板的第一行来解决。 The difference was the addition of the autoescape option in that line and then the error no longer occurred; 区别在于在该行中添加了自动转义选项,然后不再发生该错误; not sure exactly what is happening under the covers but glad it works now. 不知道幕后到底发生了什么,但很高兴它现在可以工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM