我想从xsl模板和xml参数生成pdf,
模板的开头是下一个:
<?xml version =“1.0”encoding =“UTF-8”?> <xsl:stylesheet xmlns:xsl =“http://www.w3.org/1999/XSL/Transform”version =“1.0”xmlns: fo =“http://www.w3.org/1999/XSL/Format”> <xsl:output method =“xml”version =“1.0”omit-xml-declaration =“no”indent =“yes”encoding = “UTF-8”/> **
和xml文件的bebinning:
<?xml version =“1.0”encoding =“UTF-8”?> <GenerationReport> <ValidationResult> <Result> ...
即将发生的错误:
引起:org.xml.sax.SAXParseException; lineNumber:2; columnNumber:1;序言中不能有内容 . at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:244)at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:285)at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder) .java:121)at es.gob.signaturereport.tools.XMLUtils.getDocumentImpl(XMLUtils.java:371)at es.gob.signaturereport.tools.XMLUtils.getDocument(XMLUtils.java:233)... 53更多
1 回答
@ joel-m-lamsen是正确的,你不想在
<?
中有空格 .但是,您也不希望
<
与元素名称之间有空格 . 您的样本应该是(添加换行符以避免滚动条):和:
>
,/>
或?>
之前的空格isn 't a problem. (Just don' t开始在/>
或?>
中添加空格 . )