EDN Admin
Well-known member
I am trying to read the following XML doc
<div style="color:black; background-color:white
<pre><span style="color:blue <<span style="color:#a31515 Docs<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 MPI <span style="color:red Listing<span style="color:blue =<span style="color:black "<span style="color:blue 20413889<span style="color:black "<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 PDF <span style="color:red ID<span style="color:blue =<span style="color:black "<span style="color:blue 3719000038160<span style="color:black " <span style="color:blue />
<span style="color:blue </<span style="color:#a31515 MPI<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 MPI <span style="color:red Listing<span style="color:blue =<span style="color:black "<span style="color:blue 20428793<span style="color:black "<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 PDF <span style="color:red ID<span style="color:blue =<span style="color:black "<span style="color:blue 3719000010413<span style="color:black " <span style="color:blue />
<span style="color:blue <<span style="color:#a31515 PDF <span style="color:red ID<span style="color:blue =<span style="color:black "<span style="color:blue 3719000010414<span style="color:black " <span style="color:blue />
<span style="color:blue <<span style="color:#a31515 PDF <span style="color:red ID<span style="color:blue =<span style="color:black "<span style="color:blue 3719000010415<span style="color:black " <span style="color:blue />
<span style="color:blue <<span style="color:#a31515 PDF <span style="color:red ID<span style="color:blue =<span style="color:black "<span style="color:blue 3719000010416<span style="color:black " <span style="color:blue />
<span style="color:blue </<span style="color:#a31515 MPI<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 Docs<span style="color:blue >
[/code]
and my code to read the above file is
<div style="color:black; background-color:white
<pre><span style="color:blue var fileName = <span style="color:blue from c <span style="color:blue in order.Element(<span style="color:#a31515 "docs")
.Elements(<span style="color:#a31515 "MPI")
.Elements(<span style="color:#a31515 "PDF")
<span style="color:blue where c.Parent.Attribute(<span style="color:#a31515 "Listing").Value.ToString() == sFileName
<span style="color:blue select c.Attribute(<span style="color:#a31515 "id").Value;
[/code]
I am getting this error message
Object Reference not set to an instance of an object.
Then I modified the code like so:
select new { pdfid = c.Attribute("id").Value };
and still getting the same error.
thanks for the help.I am getting this error message
Object Reference not set to an instance of an object.
<br/>
View the full article
<div style="color:black; background-color:white
<pre><span style="color:blue <<span style="color:#a31515 Docs<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 MPI <span style="color:red Listing<span style="color:blue =<span style="color:black "<span style="color:blue 20413889<span style="color:black "<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 PDF <span style="color:red ID<span style="color:blue =<span style="color:black "<span style="color:blue 3719000038160<span style="color:black " <span style="color:blue />
<span style="color:blue </<span style="color:#a31515 MPI<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 MPI <span style="color:red Listing<span style="color:blue =<span style="color:black "<span style="color:blue 20428793<span style="color:black "<span style="color:blue >
<span style="color:blue <<span style="color:#a31515 PDF <span style="color:red ID<span style="color:blue =<span style="color:black "<span style="color:blue 3719000010413<span style="color:black " <span style="color:blue />
<span style="color:blue <<span style="color:#a31515 PDF <span style="color:red ID<span style="color:blue =<span style="color:black "<span style="color:blue 3719000010414<span style="color:black " <span style="color:blue />
<span style="color:blue <<span style="color:#a31515 PDF <span style="color:red ID<span style="color:blue =<span style="color:black "<span style="color:blue 3719000010415<span style="color:black " <span style="color:blue />
<span style="color:blue <<span style="color:#a31515 PDF <span style="color:red ID<span style="color:blue =<span style="color:black "<span style="color:blue 3719000010416<span style="color:black " <span style="color:blue />
<span style="color:blue </<span style="color:#a31515 MPI<span style="color:blue >
<span style="color:blue </<span style="color:#a31515 Docs<span style="color:blue >
[/code]
and my code to read the above file is
<div style="color:black; background-color:white
<pre><span style="color:blue var fileName = <span style="color:blue from c <span style="color:blue in order.Element(<span style="color:#a31515 "docs")
.Elements(<span style="color:#a31515 "MPI")
.Elements(<span style="color:#a31515 "PDF")
<span style="color:blue where c.Parent.Attribute(<span style="color:#a31515 "Listing").Value.ToString() == sFileName
<span style="color:blue select c.Attribute(<span style="color:#a31515 "id").Value;
[/code]
I am getting this error message
Object Reference not set to an instance of an object.
Then I modified the code like so:
select new { pdfid = c.Attribute("id").Value };
and still getting the same error.
thanks for the help.I am getting this error message
Object Reference not set to an instance of an object.
<br/>
View the full article