繁体   English   中英

XML文档结构必须在同一实体内开始和结束。 使用xslt将xml转换为html

[英]XML document structures must start and end within the same entity. xml to html using xslt

我在尝试使用xslt将xml转换为html时遇到问题。 以下是我用来解析的虚拟代码

**TransformerFactory tFactory = TransformerFactory.newInstance();
            Source xslDoc = new StreamSource( xsltPath );
            Source xmlDoc = new StreamSource( xmlPath );
            oFileOutputStream=new FileOutputStream( htmlOutputPath );
            htmlFile = oFileOutputStream;
            Transformer transformer = tFactory.newTransformer( xslDoc );
            transformer.transform( xmlDoc, new StreamResult( htmlFile ) );**

得到错误如下

错误:“ XML文档结构必须在同一实体内开始和结束。” 错误:“ com.sun.org.apache.xml.internal.utils.WrappedRuntimeException:XML文档结构必须在同一实体内开始和结束。” |#]任何想法

看来您在变压器仍在工作时已关闭流。 请检查您是否尚未关闭任何流资源。

暂无
暂无

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

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