簡體   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