救命! XSLTranform和XMLTextWriter错误 [英] HELP! XSLTranform and XMLTextWriter Error

查看:74
本文介绍了救命! XSLTranform和XMLTextWriter错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已尝试过这一切!


我收到一条错误,指出索引超出了数组范围


我的代码看起来像这样....


xmlDoc =新的XmlDocument()

xmlDoc.Load(" xml.doc")


xslDoc =新的XslTransform()

xslDoc.Load(" xsl.doc")


Dim TWrtr作为新的XmlTextWriter (" c:\ somelocation.doc",

System.Text.Encoding.UTF8)

xslDoc.Transform(xmlDoc,Nothing,TWrtr)

TWrtr.Close()

xmlDoc =没什么

xslDoc =没什么


i不想要发布XSL / XML,因为它有客户数据,而且它的价格非常长。


我已尝试使用此代码的其他XSL / XML它运行得很好。


XSl和XML低于2 GB,所以我知道这不是问题。


如果有人有任何问题解决方案,请告诉我。


谢谢,

解决方案

我看不出你的代码有什么问题,虽然它会更多

高效使用XPathDocument类代替XmlDoxument。这个

表示Xml / Xsl文件有问题。


您是否尝试过使用XmlSpy执行相同的Xml / Xsl转换(或者

其他)申请?


Pete


" Amanda" <德***** @ hotmail.com>在留言中写道

news:55 ************************** @ posting.google.c om ...

我已经尝试了一切!

我收到一条错误,指出索引超出了数组的范围

我的代码看起来像这样....

xmlDoc = New XmlDocument()
xmlDoc.Load(" xml.doc")

xslDoc = New XslTransform()
xslDoc.Load(" xsl.doc")
将Dim TWrtr作为新的XmlTextWriter(" c:\ somelocation.doc",
System.Text.Encoding.UTF8) )

xslDoc.Transform(xmlDoc,Nothing,TWrtr)
TWrtr.Close()
xmlDoc = Nothing
xslDoc = Nothing

我不想发布XSL / XML,因为它有客户数据,而且它非常长。

我已经尝试过使用此代码的其他XSL / XML,它工作得很好。

XSl和XML低于2 GB,所以我知道这不是p roblem。

如果有人对此有任何解决方案,请告诉我。

谢谢,



< blockquote>我猜你的xsl里面有一些错误的xpath。值得

下载一个好的xpath测试程序,例如Nauman Leghari的
http://www.axisebusiness.com/nleghari/visualxpath.zip

" Amanda" <德***** @ hotmail.com>在留言中写道

news:55 ************************** @ posting.google.c om ...

我已经尝试了一切!

我收到一条错误,指出索引超出了数组的范围

我的代码看起来像这样....

xmlDoc = New XmlDocument()
xmlDoc.Load(" xml.doc")

xslDoc = New XslTransform()
xslDoc.Load(" xsl.doc")
将Dim TWrtr作为新的XmlTextWriter(" c:\ somelocation.doc",
System.Text.Encoding.UTF8) )

xslDoc.Transform(xmlDoc,Nothing,TWrtr)
TWrtr.Close()
xmlDoc = Nothing
xslDoc = Nothing

我不想发布XSL / XML,因为它有客户数据,而且它非常长。

我已经尝试过使用此代码的其他XSL / XML,它工作得很好。

XSl和XML低于2 GB,所以我知道这不是问题所在/>
如果有人对此有任何解决方案,请告诉我。

谢谢,



Amanda写道:

我收到一条错误,指出索引超出了数组的范围




我记得有一些具有此类症状的XslTransform中的错误。升级

到最新的.NET,并尝试最小化你的样式表,这样我们就可以得到

一些复制品。


-

Oleg Tkachenko [XML MVP]
http://blog.tkachenko .com


I have tried everything with this!

I get an error stating "Index was outside the bounds of the array"

My code looks like this....

xmlDoc = New XmlDocument()
xmlDoc.Load("xml.doc")

xslDoc = New XslTransform()
xslDoc.Load("xsl.doc")

Dim TWrtr As New XmlTextWriter("c:\somelocation.doc",
System.Text.Encoding.UTF8)

xslDoc.Transform(xmlDoc, Nothing, TWrtr)
TWrtr.Close()
xmlDoc = Nothing
xslDoc = Nothing

i do not want to post the XSL/XML as it has customer data in it and it
is extremely long.

I have tried other XSL/XML with this code and it works just fine.

The XSl and XML is under 2 GBs so I know that is not the problem.

If anyone has any solutions to this, please let me know.

Thanks,

解决方案

I can''t see anything wrong with your code, although it would be more
effcient to use the XPathDocument class in place of the XmlDoxument. This
suggests that there is something wrong with the Xml / Xsl file.

Have you tried performing the same Xml / Xsl translation using XmlSpy (or
other) application?

Pete

"Amanda" <de*****@hotmail.com> wrote in message
news:55**************************@posting.google.c om...

I have tried everything with this!

I get an error stating "Index was outside the bounds of the array"

My code looks like this....

xmlDoc = New XmlDocument()
xmlDoc.Load("xml.doc")

xslDoc = New XslTransform()
xslDoc.Load("xsl.doc")

Dim TWrtr As New XmlTextWriter("c:\somelocation.doc",
System.Text.Encoding.UTF8)

xslDoc.Transform(xmlDoc, Nothing, TWrtr)
TWrtr.Close()
xmlDoc = Nothing
xslDoc = Nothing

i do not want to post the XSL/XML as it has customer data in it and it
is extremely long.

I have tried other XSL/XML with this code and it works just fine.

The XSl and XML is under 2 GBs so I know that is not the problem.

If anyone has any solutions to this, please let me know.

Thanks,



I would guess you''ve got some faulty xpath inside your xsl. It is worth
downloading a good xpath tester eg Nauman Leghari''s
http://www.axisebusiness.com/nleghari/visualxpath.zip
"Amanda" <de*****@hotmail.com> wrote in message
news:55**************************@posting.google.c om...

I have tried everything with this!

I get an error stating "Index was outside the bounds of the array"

My code looks like this....

xmlDoc = New XmlDocument()
xmlDoc.Load("xml.doc")

xslDoc = New XslTransform()
xslDoc.Load("xsl.doc")

Dim TWrtr As New XmlTextWriter("c:\somelocation.doc",
System.Text.Encoding.UTF8)

xslDoc.Transform(xmlDoc, Nothing, TWrtr)
TWrtr.Close()
xmlDoc = Nothing
xslDoc = Nothing

i do not want to post the XSL/XML as it has customer data in it and it
is extremely long.

I have tried other XSL/XML with this code and it works just fine.

The XSl and XML is under 2 GBs so I know that is not the problem.

If anyone has any solutions to this, please let me know.

Thanks,



Amanda wrote:

I get an error stating "Index was outside the bounds of the array"



I remember there was some bug in XslTransform with such symptom. Upgrade
to the latest .NET and try to minimize your stylesheet so we can get
some repro.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com


这篇关于救命! XSLTranform和XMLTextWriter错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆