Connecting Tech Pros Worldwide Forums | Help | Site Map

Parsing XML file

ttomes
Guest
 
Posts: n/a
#1: May 8 '06
I'm trying to parse a XML file and extract a few data elements. I'm having
trouble extracting the exact elements. I get the entire content of the XML
file in the text box currently. I can't figure out how to just get the
elements/attirbutes that I want. This is being done in Visual Web Developer
Express.



The code I have so far is:

Dim sr As New System.IO.StreamReader("C:\test123\upload\" +
FileUpload1.FileName)
Dim xr As New System.Xml.XmlTextReader(sr)
Dim m_xmld = New System.Xml.XmlDocument
Dim m_nodelist As System.Xml.XmlNodeList
Dim m_node As System.Xml.XmlNode
'Dim startdate As System.Xml.XmlNode



'Create the XML Document
'Load the Xml file

m_xmld.Load(xr)
m_nodelist =
m_xmld.SelectNodes("/TestMessage/AuthenticatedPublic/MessageId")


TextBox1.Text = m_xmld.getElementsByTagName("MessageId")



The XML file looks like this (partial):

<?xml version="1.0" encoding="UTF-8"?>
<TestMessage xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
xmlns:enc="http://www.w3.org/2001/04/xmlenc#">
<AuthenticatedPublic Id="ID_AuthenticatedPublic">
<MessageId>urn:uuid:efeb77ff-eab6-4f4b-8fc8-d1f7293fec91</MessageId>
<MessageType>http://www.test123.com/PROTO-TEST-KDM-20040311#</MessageType>
<AnnotationText>TEST 123</AnnotationText>
<IssueDate>2006-01-30T21:31:32+00:00</IssueDate>
<Signer>

<dsig:X509IssuerName>/dnQualifier=JIQs8tRZIGKLLlyGkKOqMLonGpw=/O=dc.Root.ca.test_rje_xp_laptop.com/OU=test
RJE_XP_LAPTOP/CN=TMS.Test.2A51FBD4-58C2-4955-82FE-8FB31C15C0F7.v0.2.3.0</dsig:X509IssuerName>
<dsig:X509SerialNumber>b5:c9:ac:0a:83:e2:ef:d4
</dsig:X509SerialNumber>
</Signer> <RequiredExtensions>
<Recipient>
<X509IssuerSerial>
<dsig:X509IssuerName/>
<dsig:X509SerialNumber/>
</X509IssuerSerial> <X509SubjectName/>
</Recipient>
<CompositionPlaylistId>urn:uuid:d2b7595e-f852-f246-8c74-3d9724f923a8</CompositionPlaylistId>
<ContentTitleText>StEM_MM_2k_XYZ_CRYPT</ContentTitleText>

<ContentKeysNotValidBefore>2006-01-31T10:00:00+00:00</ContentKeysNotValidBefore>

<ContentKeysNotValidAfter>2006-02-28T09:59:00+00:00</ContentKeysNotValidAfter>



Chakravarthy
Guest
 
Posts: n/a
#2: May 10 '06

re: Parsing XML file


You are doing a mistake while assiging the .TEXT property of the Text box.
Change the code as mentioned below ...

XmlDocument xdTe = new XmlDocument();
xdTe.PreserveWhitespace=true;
xdTe.Load(("C:\test123\upload\" + FileUpload1.FileName);
TextBox1.Clear();
XmlNodeList xnlItems = xdSmp.SelectNodes('//MessageId');
foreach(XmlNode xnSmp in xnlItems)
{
TextBox1.AppendText(xnSmp.InnerXml);
TextBox1.AppendText(Environment.NewLine);
}

Hope this works, it worked for me...
Cheers,
--
Every thing is perfect, as long as you share!!!


"ttomes" wrote:
[color=blue]
> I'm trying to parse a XML file and extract a few data elements. I'm having
> trouble extracting the exact elements. I get the entire content of the XML
> file in the text box currently. I can't figure out how to just get the
> elements/attirbutes that I want. This is being done in Visual Web Developer
> Express.
>
>
>
> The code I have so far is:
>
> Dim sr As New System.IO.StreamReader("C:\test123\upload\" +
> FileUpload1.FileName)
> Dim xr As New System.Xml.XmlTextReader(sr)
> Dim m_xmld = New System.Xml.XmlDocument
> Dim m_nodelist As System.Xml.XmlNodeList
> Dim m_node As System.Xml.XmlNode
> 'Dim startdate As System.Xml.XmlNode
>
>
>
> 'Create the XML Document
> 'Load the Xml file
>
> m_xmld.Load(xr)
> m_nodelist =
> m_xmld.SelectNodes("/TestMessage/AuthenticatedPublic/MessageId")
>
>
> TextBox1.Text = m_xmld.getElementsByTagName("MessageId")
>
>
>
> The XML file looks like this (partial):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <TestMessage xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
> xmlns:enc="http://www.w3.org/2001/04/xmlenc#">
> <AuthenticatedPublic Id="ID_AuthenticatedPublic">
> <MessageId>urn:uuid:efeb77ff-eab6-4f4b-8fc8-d1f7293fec91</MessageId>
> <MessageType>http://www.test123.com/PROTO-TEST-KDM-20040311#</MessageType>
> <AnnotationText>TEST 123</AnnotationText>
> <IssueDate>2006-01-30T21:31:32+00:00</IssueDate>
> <Signer>
>
> <dsig:X509IssuerName>/dnQualifier=JIQs8tRZIGKLLlyGkKOqMLonGpw=/O=dc.Root.ca.test_rje_xp_laptop.com/OU=test
> RJE_XP_LAPTOP/CN=TMS.Test.2A51FBD4-58C2-4955-82FE-8FB31C15C0F7.v0.2.3.0</dsig:X509IssuerName>
> <dsig:X509SerialNumber>b5:c9:ac:0a:83:e2:ef:d4
> </dsig:X509SerialNumber>
> </Signer> <RequiredExtensions>
> <Recipient>
> <X509IssuerSerial>
> <dsig:X509IssuerName/>
> <dsig:X509SerialNumber/>
> </X509IssuerSerial> <X509SubjectName/>
> </Recipient>
> <CompositionPlaylistId>urn:uuid:d2b7595e-f852-f246-8c74-3d9724f923a8</CompositionPlaylistId>
> <ContentTitleText>StEM_MM_2k_XYZ_CRYPT</ContentTitleText>
>
> <ContentKeysNotValidBefore>2006-01-31T10:00:00+00:00</ContentKeysNotValidBefore>
>
> <ContentKeysNotValidAfter>2006-02-28T09:59:00+00:00</ContentKeysNotValidAfter>
>
>[/color]
ttomes
Guest
 
Posts: n/a
#3: May 10 '06

re: Parsing XML file


I changed the code but I still get the entire XML file as the value for the
text box. Can this be a problem with Visual Web Developer 2005 Express
Edition?

I now have the following code:


Dim m_xmld = New System.Xml.XmlDocument
m_xmld.PreserveWhitespace = True
Dim m_nodelist As System.Xml.XmlNodeList
Dim m_node As System.Xml.XmlNode


'Create the XML Document
'Load the Xml file

m_xmld.Load("C:\test123\upload\" + FileUpload1.FileName)
m_nodelist = m_xmld.SelectNodes("//MessageId")

'Loop through the nodes

For Each m_node In m_nodelist
TextBox1.Text = m_xmld.InnerXml
Next

"Chakravarthy" wrote:
[color=blue]
> You are doing a mistake while assiging the .TEXT property of the Text box.
> Change the code as mentioned below ...
>
> XmlDocument xdTe = new XmlDocument();
> xdTe.PreserveWhitespace=true;
> xdTe.Load(("C:\test123\upload\" + FileUpload1.FileName);
> TextBox1.Clear();
> XmlNodeList xnlItems = xdSmp.SelectNodes('//MessageId');
> foreach(XmlNode xnSmp in xnlItems)
> {
> TextBox1.AppendText(xnSmp.InnerXml);
> TextBox1.AppendText(Environment.NewLine);
> }
>
> Hope this works, it worked for me...
> Cheers,
> --
> Every thing is perfect, as long as you share!!!
>
>
> "ttomes" wrote:
>[color=green]
> > I'm trying to parse a XML file and extract a few data elements. I'm having
> > trouble extracting the exact elements. I get the entire content of the XML
> > file in the text box currently. I can't figure out how to just get the
> > elements/attirbutes that I want. This is being done in Visual Web Developer
> > Express.
> >
> >
> >
> > The code I have so far is:
> >
> > Dim sr As New System.IO.StreamReader("C:\test123\upload\" +
> > FileUpload1.FileName)
> > Dim xr As New System.Xml.XmlTextReader(sr)
> > Dim m_xmld = New System.Xml.XmlDocument
> > Dim m_nodelist As System.Xml.XmlNodeList
> > Dim m_node As System.Xml.XmlNode
> > 'Dim startdate As System.Xml.XmlNode
> >
> >
> >
> > 'Create the XML Document
> > 'Load the Xml file
> >
> > m_xmld.Load(xr)
> > m_nodelist =
> > m_xmld.SelectNodes("/TestMessage/AuthenticatedPublic/MessageId")
> >
> >
> > TextBox1.Text = m_xmld.getElementsByTagName("MessageId")
> >
> >
> >
> > The XML file looks like this (partial):
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <TestMessage xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
> > xmlns:enc="http://www.w3.org/2001/04/xmlenc#">
> > <AuthenticatedPublic Id="ID_AuthenticatedPublic">
> > <MessageId>urn:uuid:efeb77ff-eab6-4f4b-8fc8-d1f7293fec91</MessageId>
> > <MessageType>http://www.test123.com/PROTO-TEST-KDM-20040311#</MessageType>
> > <AnnotationText>TEST 123</AnnotationText>
> > <IssueDate>2006-01-30T21:31:32+00:00</IssueDate>
> > <Signer>
> >
> > <dsig:X509IssuerName>/dnQualifier=JIQs8tRZIGKLLlyGkKOqMLonGpw=/O=dc.Root.ca.test_rje_xp_laptop.com/OU=test
> > RJE_XP_LAPTOP/CN=TMS.Test.2A51FBD4-58C2-4955-82FE-8FB31C15C0F7.v0.2.3.0</dsig:X509IssuerName>
> > <dsig:X509SerialNumber>b5:c9:ac:0a:83:e2:ef:d4
> > </dsig:X509SerialNumber>
> > </Signer> <RequiredExtensions>
> > <Recipient>
> > <X509IssuerSerial>
> > <dsig:X509IssuerName/>
> > <dsig:X509SerialNumber/>
> > </X509IssuerSerial> <X509SubjectName/>
> > </Recipient>
> > <CompositionPlaylistId>urn:uuid:d2b7595e-f852-f246-8c74-3d9724f923a8</CompositionPlaylistId>
> > <ContentTitleText>StEM_MM_2k_XYZ_CRYPT</ContentTitleText>
> >
> > <ContentKeysNotValidBefore>2006-01-31T10:00:00+00:00</ContentKeysNotValidBefore>
> >
> > <ContentKeysNotValidAfter>2006-02-28T09:59:00+00:00</ContentKeysNotValidAfter>
> >
> >[/color][/color]
Chakravarthy
Guest
 
Posts: n/a
#4: May 10 '06

re: Parsing XML file


Hey,

Look .... there is a small issue with the code... check your foreach look
once again... you should have m_node.innerxml instead of m_xmld.innerxml...

What do you say?
--
Every thing is perfect, as long as you share!!!


"ttomes" wrote:
[color=blue]
> I changed the code but I still get the entire XML file as the value for the
> text box. Can this be a problem with Visual Web Developer 2005 Express
> Edition?
>
> I now have the following code:
>
>
> Dim m_xmld = New System.Xml.XmlDocument
> m_xmld.PreserveWhitespace = True
> Dim m_nodelist As System.Xml.XmlNodeList
> Dim m_node As System.Xml.XmlNode
>
>
> 'Create the XML Document
> 'Load the Xml file
>
> m_xmld.Load("C:\test123\upload\" + FileUpload1.FileName)
> m_nodelist = m_xmld.SelectNodes("//MessageId")
>
> 'Loop through the nodes
>
> For Each m_node In m_nodelist
> TextBox1.Text = m_xmld.InnerXml
> Next
>
> "Chakravarthy" wrote:
>[color=green]
> > You are doing a mistake while assiging the .TEXT property of the Text box.
> > Change the code as mentioned below ...
> >
> > XmlDocument xdTe = new XmlDocument();
> > xdTe.PreserveWhitespace=true;
> > xdTe.Load(("C:\test123\upload\" + FileUpload1.FileName);
> > TextBox1.Clear();
> > XmlNodeList xnlItems = xdSmp.SelectNodes('//MessageId');
> > foreach(XmlNode xnSmp in xnlItems)
> > {
> > TextBox1.AppendText(xnSmp.InnerXml);
> > TextBox1.AppendText(Environment.NewLine);
> > }
> >
> > Hope this works, it worked for me...
> > Cheers,
> > --
> > Every thing is perfect, as long as you share!!!
> >
> >
> > "ttomes" wrote:
> >[color=darkred]
> > > I'm trying to parse a XML file and extract a few data elements. I'm having
> > > trouble extracting the exact elements. I get the entire content of the XML
> > > file in the text box currently. I can't figure out how to just get the
> > > elements/attirbutes that I want. This is being done in Visual Web Developer
> > > Express.
> > >
> > >
> > >
> > > The code I have so far is:
> > >
> > > Dim sr As New System.IO.StreamReader("C:\test123\upload\" +
> > > FileUpload1.FileName)
> > > Dim xr As New System.Xml.XmlTextReader(sr)
> > > Dim m_xmld = New System.Xml.XmlDocument
> > > Dim m_nodelist As System.Xml.XmlNodeList
> > > Dim m_node As System.Xml.XmlNode
> > > 'Dim startdate As System.Xml.XmlNode
> > >
> > >
> > >
> > > 'Create the XML Document
> > > 'Load the Xml file
> > >
> > > m_xmld.Load(xr)
> > > m_nodelist =
> > > m_xmld.SelectNodes("/TestMessage/AuthenticatedPublic/MessageId")
> > >
> > >
> > > TextBox1.Text = m_xmld.getElementsByTagName("MessageId")
> > >
> > >
> > >
> > > The XML file looks like this (partial):
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <TestMessage xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
> > > xmlns:enc="http://www.w3.org/2001/04/xmlenc#">
> > > <AuthenticatedPublic Id="ID_AuthenticatedPublic">
> > > <MessageId>urn:uuid:efeb77ff-eab6-4f4b-8fc8-d1f7293fec91</MessageId>
> > > <MessageType>http://www.test123.com/PROTO-TEST-KDM-20040311#</MessageType>
> > > <AnnotationText>TEST 123</AnnotationText>
> > > <IssueDate>2006-01-30T21:31:32+00:00</IssueDate>
> > > <Signer>
> > >
> > > <dsig:X509IssuerName>/dnQualifier=JIQs8tRZIGKLLlyGkKOqMLonGpw=/O=dc.Root.ca.test_rje_xp_laptop.com/OU=test
> > > RJE_XP_LAPTOP/CN=TMS.Test.2A51FBD4-58C2-4955-82FE-8FB31C15C0F7.v0.2.3.0</dsig:X509IssuerName>
> > > <dsig:X509SerialNumber>b5:c9:ac:0a:83:e2:ef:d4
> > > </dsig:X509SerialNumber>
> > > </Signer> <RequiredExtensions>
> > > <Recipient>
> > > <X509IssuerSerial>
> > > <dsig:X509IssuerName/>
> > > <dsig:X509SerialNumber/>
> > > </X509IssuerSerial> <X509SubjectName/>
> > > </Recipient>
> > > <CompositionPlaylistId>urn:uuid:d2b7595e-f852-f246-8c74-3d9724f923a8</CompositionPlaylistId>
> > > <ContentTitleText>StEM_MM_2k_XYZ_CRYPT</ContentTitleText>
> > >
> > > <ContentKeysNotValidBefore>2006-01-31T10:00:00+00:00</ContentKeysNotValidBefore>
> > >
> > > <ContentKeysNotValidAfter>2006-02-28T09:59:00+00:00</ContentKeysNotValidAfter>
> > >
> > >[/color][/color][/color]
ttomes
Guest
 
Posts: n/a
#5: May 10 '06

re: Parsing XML file


Ah...those minor details..... Thank you very much for your help.

"Chakravarthy" wrote:
[color=blue]
> Hey,
>
> Look .... there is a small issue with the code... check your foreach look
> once again... you should have m_node.innerxml instead of m_xmld.innerxml...
>
> What do you say?
> --
> Every thing is perfect, as long as you share!!!
>
>
> "ttomes" wrote:
>[color=green]
> > I changed the code but I still get the entire XML file as the value for the
> > text box. Can this be a problem with Visual Web Developer 2005 Express
> > Edition?
> >
> > I now have the following code:
> >
> >
> > Dim m_xmld = New System.Xml.XmlDocument
> > m_xmld.PreserveWhitespace = True
> > Dim m_nodelist As System.Xml.XmlNodeList
> > Dim m_node As System.Xml.XmlNode
> >
> >
> > 'Create the XML Document
> > 'Load the Xml file
> >
> > m_xmld.Load("C:\test123\upload\" + FileUpload1.FileName)
> > m_nodelist = m_xmld.SelectNodes("//MessageId")
> >
> > 'Loop through the nodes
> >
> > For Each m_node In m_nodelist
> > TextBox1.Text = m_xmld.InnerXml
> > Next
> >
> > "Chakravarthy" wrote:
> >[color=darkred]
> > > You are doing a mistake while assiging the .TEXT property of the Text box.
> > > Change the code as mentioned below ...
> > >
> > > XmlDocument xdTe = new XmlDocument();
> > > xdTe.PreserveWhitespace=true;
> > > xdTe.Load(("C:\test123\upload\" + FileUpload1.FileName);
> > > TextBox1.Clear();
> > > XmlNodeList xnlItems = xdSmp.SelectNodes('//MessageId');
> > > foreach(XmlNode xnSmp in xnlItems)
> > > {
> > > TextBox1.AppendText(xnSmp.InnerXml);
> > > TextBox1.AppendText(Environment.NewLine);
> > > }
> > >
> > > Hope this works, it worked for me...
> > > Cheers,
> > > --
> > > Every thing is perfect, as long as you share!!!
> > >
> > >
> > > "ttomes" wrote:
> > >
> > > > I'm trying to parse a XML file and extract a few data elements. I'm having
> > > > trouble extracting the exact elements. I get the entire content of the XML
> > > > file in the text box currently. I can't figure out how to just get the
> > > > elements/attirbutes that I want. This is being done in Visual Web Developer
> > > > Express.
> > > >
> > > >
> > > >
> > > > The code I have so far is:
> > > >
> > > > Dim sr As New System.IO.StreamReader("C:\test123\upload\" +
> > > > FileUpload1.FileName)
> > > > Dim xr As New System.Xml.XmlTextReader(sr)
> > > > Dim m_xmld = New System.Xml.XmlDocument
> > > > Dim m_nodelist As System.Xml.XmlNodeList
> > > > Dim m_node As System.Xml.XmlNode
> > > > 'Dim startdate As System.Xml.XmlNode
> > > >
> > > >
> > > >
> > > > 'Create the XML Document
> > > > 'Load the Xml file
> > > >
> > > > m_xmld.Load(xr)
> > > > m_nodelist =
> > > > m_xmld.SelectNodes("/TestMessage/AuthenticatedPublic/MessageId")
> > > >
> > > >
> > > > TextBox1.Text = m_xmld.getElementsByTagName("MessageId")
> > > >
> > > >
> > > >
> > > > The XML file looks like this (partial):
> > > >
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > <TestMessage xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
> > > > xmlns:enc="http://www.w3.org/2001/04/xmlenc#">
> > > > <AuthenticatedPublic Id="ID_AuthenticatedPublic">
> > > > <MessageId>urn:uuid:efeb77ff-eab6-4f4b-8fc8-d1f7293fec91</MessageId>
> > > > <MessageType>http://www.test123.com/PROTO-TEST-KDM-20040311#</MessageType>
> > > > <AnnotationText>TEST 123</AnnotationText>
> > > > <IssueDate>2006-01-30T21:31:32+00:00</IssueDate>
> > > > <Signer>
> > > >
> > > > <dsig:X509IssuerName>/dnQualifier=JIQs8tRZIGKLLlyGkKOqMLonGpw=/O=dc.Root.ca.test_rje_xp_laptop.com/OU=test
> > > > RJE_XP_LAPTOP/CN=TMS.Test.2A51FBD4-58C2-4955-82FE-8FB31C15C0F7.v0.2.3.0</dsig:X509IssuerName>
> > > > <dsig:X509SerialNumber>b5:c9:ac:0a:83:e2:ef:d4
> > > > </dsig:X509SerialNumber>
> > > > </Signer> <RequiredExtensions>
> > > > <Recipient>
> > > > <X509IssuerSerial>
> > > > <dsig:X509IssuerName/>
> > > > <dsig:X509SerialNumber/>
> > > > </X509IssuerSerial> <X509SubjectName/>
> > > > </Recipient>
> > > > <CompositionPlaylistId>urn:uuid:d2b7595e-f852-f246-8c74-3d9724f923a8</CompositionPlaylistId>
> > > > <ContentTitleText>StEM_MM_2k_XYZ_CRYPT</ContentTitleText>
> > > >
> > > > <ContentKeysNotValidBefore>2006-01-31T10:00:00+00:00</ContentKeysNotValidBefore>
> > > >
> > > > <ContentKeysNotValidAfter>2006-02-28T09:59:00+00:00</ContentKeysNotValidAfter>
> > > >
> > > >[/color][/color][/color]
Chakravarthy
Guest
 
Posts: n/a
#6: May 11 '06

re: Parsing XML file


Did my post answer your question?
Was this helpful to you?

If the answer is yes, why dont you click the below buttons?
--
Every thing is perfect, as long as you share!!!


"ttomes" wrote:
[color=blue]
> Ah...those minor details..... Thank you very much for your help.
>
> "Chakravarthy" wrote:
>[color=green]
> > Hey,
> >
> > Look .... there is a small issue with the code... check your foreach look
> > once again... you should have m_node.innerxml instead of m_xmld.innerxml...
> >
> > What do you say?
> > --
> > Every thing is perfect, as long as you share!!!
> >
> >
> > "ttomes" wrote:
> >[color=darkred]
> > > I changed the code but I still get the entire XML file as the value for the
> > > text box. Can this be a problem with Visual Web Developer 2005 Express
> > > Edition?
> > >
> > > I now have the following code:
> > >
> > >
> > > Dim m_xmld = New System.Xml.XmlDocument
> > > m_xmld.PreserveWhitespace = True
> > > Dim m_nodelist As System.Xml.XmlNodeList
> > > Dim m_node As System.Xml.XmlNode
> > >
> > >
> > > 'Create the XML Document
> > > 'Load the Xml file
> > >
> > > m_xmld.Load("C:\test123\upload\" + FileUpload1.FileName)
> > > m_nodelist = m_xmld.SelectNodes("//MessageId")
> > >
> > > 'Loop through the nodes
> > >
> > > For Each m_node In m_nodelist
> > > TextBox1.Text = m_xmld.InnerXml
> > > Next
> > >
> > > "Chakravarthy" wrote:
> > >
> > > > You are doing a mistake while assiging the .TEXT property of the Text box.
> > > > Change the code as mentioned below ...
> > > >
> > > > XmlDocument xdTe = new XmlDocument();
> > > > xdTe.PreserveWhitespace=true;
> > > > xdTe.Load(("C:\test123\upload\" + FileUpload1.FileName);
> > > > TextBox1.Clear();
> > > > XmlNodeList xnlItems = xdSmp.SelectNodes('//MessageId');
> > > > foreach(XmlNode xnSmp in xnlItems)
> > > > {
> > > > TextBox1.AppendText(xnSmp.InnerXml);
> > > > TextBox1.AppendText(Environment.NewLine);
> > > > }
> > > >
> > > > Hope this works, it worked for me...
> > > > Cheers,
> > > > --
> > > > Every thing is perfect, as long as you share!!!
> > > >
> > > >
> > > > "ttomes" wrote:
> > > >
> > > > > I'm trying to parse a XML file and extract a few data elements. I'm having
> > > > > trouble extracting the exact elements. I get the entire content of the XML
> > > > > file in the text box currently. I can't figure out how to just get the
> > > > > elements/attirbutes that I want. This is being done in Visual Web Developer
> > > > > Express.
> > > > >
> > > > >
> > > > >
> > > > > The code I have so far is:
> > > > >
> > > > > Dim sr As New System.IO.StreamReader("C:\test123\upload\" +
> > > > > FileUpload1.FileName)
> > > > > Dim xr As New System.Xml.XmlTextReader(sr)
> > > > > Dim m_xmld = New System.Xml.XmlDocument
> > > > > Dim m_nodelist As System.Xml.XmlNodeList
> > > > > Dim m_node As System.Xml.XmlNode
> > > > > 'Dim startdate As System.Xml.XmlNode
> > > > >
> > > > >
> > > > >
> > > > > 'Create the XML Document
> > > > > 'Load the Xml file
> > > > >
> > > > > m_xmld.Load(xr)
> > > > > m_nodelist =
> > > > > m_xmld.SelectNodes("/TestMessage/AuthenticatedPublic/MessageId")
> > > > >
> > > > >
> > > > > TextBox1.Text = m_xmld.getElementsByTagName("MessageId")
> > > > >
> > > > >
> > > > >
> > > > > The XML file looks like this (partial):
> > > > >
> > > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > > <TestMessage xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
> > > > > xmlns:enc="http://www.w3.org/2001/04/xmlenc#">
> > > > > <AuthenticatedPublic Id="ID_AuthenticatedPublic">
> > > > > <MessageId>urn:uuid:efeb77ff-eab6-4f4b-8fc8-d1f7293fec91</MessageId>
> > > > > <MessageType>http://www.test123.com/PROTO-TEST-KDM-20040311#</MessageType>
> > > > > <AnnotationText>TEST 123</AnnotationText>
> > > > > <IssueDate>2006-01-30T21:31:32+00:00</IssueDate>
> > > > > <Signer>
> > > > >
> > > > > <dsig:X509IssuerName>/dnQualifier=JIQs8tRZIGKLLlyGkKOqMLonGpw=/O=dc.Root.ca.test_rje_xp_laptop.com/OU=test
> > > > > RJE_XP_LAPTOP/CN=TMS.Test.2A51FBD4-58C2-4955-82FE-8FB31C15C0F7.v0.2.3.0</dsig:X509IssuerName>
> > > > > <dsig:X509SerialNumber>b5:c9:ac:0a:83:e2:ef:d4
> > > > > </dsig:X509SerialNumber>
> > > > > </Signer> <RequiredExtensions>
> > > > > <Recipient>
> > > > > <X509IssuerSerial>
> > > > > <dsig:X509IssuerName/>
> > > > > <dsig:X509SerialNumber/>
> > > > > </X509IssuerSerial> <X509SubjectName/>
> > > > > </Recipient>
> > > > > <CompositionPlaylistId>urn:uuid:d2b7595e-f852-f246-8c74-3d9724f923a8</CompositionPlaylistId>
> > > > > <ContentTitleText>StEM_MM_2k_XYZ_CRYPT</ContentTitleText>
> > > > >
> > > > > <ContentKeysNotValidBefore>2006-01-31T10:00:00+00:00</ContentKeysNotValidBefore>
> > > > >
> > > > > <ContentKeysNotValidAfter>2006-02-28T09:59:00+00:00</ContentKeysNotValidAfter>
> > > > >
> > > > >[/color][/color][/color]
Closed Thread