在这里,我需要将xml作为参数传递给XSLT。所以我尝试去访问stringXML toXDM节点,我得到了nullprointerexception。下面是我的代码和输入字符串and。
有人能在这方面帮我一下吗?
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
JobDTO jobDTO = null; //DB bean class
Processor m_saxon = null;
XdmNode d = null;
using (DBManager db = new DBManager())// connecting to DB
{
string m_jobId ="59d0ae8e-b03a-4d0e-a2c2-3f048375f759"; //DB primary key cloumn value
jobDTO = db.GetJob(m_jobId); //getting row from DB
using (XmlReader xr = XmlReader.Create(new StringReader(jobDTO.JobXml))) //job.JobXml have the stringxml value
{
d = m_saxon.NewDocumentBuilder().Build(xr);//here getting null pointer exception.because of xr is None
}
}
}
} }
stringXML如下所示
<renderItem processItem="true">
<callerid xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">0</callerid>
<coredataitem xmlns="http://services.lexisnexis.com/shared/xmlschema/coredataitem/2">
<status>
<statusvalue>Success</statusvalue>
</status>
<itemtype>document</itemtype>
<title>doclist</title>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">pageCount</detailname>
<detailvalue xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">1</detailvalue>
</coredataitemdetail>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">statusMessage</detailname>
</coredataitemdetail>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">subItemsShouldMerge</detailname>
</coredataitemdetail>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">subitemsAreIndependent</detailname>
</coredataitemdetail>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">rendertype</detailname>
<detailvalue xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">XPP</detailvalue>
</coredataitemdetail>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">ssafailedstatuscode</detailname>
<detailvalue xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">0</detailvalue>
</coredataitemdetail>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">ssadownloadtime</detailname>
<detailvalue xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">0</detailvalue>
</coredataitemdetail>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">ssauploadtime</detailname>
<detailvalue xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">0</detailvalue>
</coredataitemdetail>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">apollodownloadtime</detailname>
<detailvalue xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">0</detailvalue>
</coredataitemdetail>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">apolloitemcount</detailname>
<detailvalue xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">0</detailvalue>
</coredataitemdetail>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">preprocessingtime</detailname>
<detailvalue xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">1</detailvalue>
</coredataitemdetail>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">renderingtime</detailname>
<detailvalue xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">2823</detailvalue>
</coredataitemdetail>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">totalprocessingtime</detailname>
<detailvalue xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">2824</detailvalue>
</coredataitemdetail>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">processed</detailname>
<detailvalue xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">yes</detailvalue>
</coredataitemdetail>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">xhtmlCreationTime</detailname>
<detailvalue xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">99</detailvalue>
</coredataitemdetail>
<coredataitemdetail group="Renderer">
<detailname xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">ssastatuscode</detailname>
<detailvalue xmlns="http://services.lexisnexis.com/shared/xmlschema/servicescommon/2">0</detailvalue>
</coredataitemdetail>
</coredataitem>
</renderItem>发布于 2014-06-21 04:00:33
根据记录,Martin Honnen确定了解决方案:保存Saxon处理器的变量被单一化。
https://stackoverflow.com/questions/24285293
复制相似问题