COMO FACO PARA COPIAR UM TAG INTEIRO DE UM XML
Tenho este XML
<retConsSitCTe versao=[Ô]1.03[Ô] xmlns=[Ô]http://www.portalfiscal.inf.br/cte[Ô]>
<tpAmb>2</tpAmb>
<verAplic>1.03</verAplic>
<cStat>100</cStat>
<xMotivo>Autorizado o uso da CT-e</xMotivo>
<cUF>51</cUF>
- <protCTe versao=[Ô]1.03[Ô]>
- <infProt>
<tpAmb>2</tpAmb>
<verAplic>1.03</verAplic>
<chCTe>51100215950025000123570000000000109028601582</chCTe>
<dhRecbto>2010-03-01T16:45:11</dhRecbto>
<nProt>151100000465904</nProt>
<digVal>dUQMFVZgUNdD/qHAib9pjXgpe84=</digVal>
<cStat>100</cStat>
<xMotivo>Autorizado o uso da CT-e</xMotivo>
</infProt>
</protCTe>
</retConsSitCTe>
e quero copiar so esta parte
[txt-color=#e80000] <protCTe versao=[Ô]1.03[Ô]>
<infProt>
<tpAmb>2</tpAmb>
<verAplic>1.03</verAplic>
<chCTe>51100215950025000123570000000000109028601582</chCTe>
<dhRecbto>2010-03-01T16:45:11</dhRecbto>
<nProt>151100000465904</nProt>
<digVal>dUQMFVZgUNdD/qHAib9pjXgpe84=</digVal>
<cStat>100</cStat>
<xMotivo>Autorizado o uso da CT-e</xMotivo>
</infProt>
</protCTe>
[/txt-color]
Dim ds As New DataSet
Doc.LoadXml(resultado1.OuterXml)
Doc.Save(Application.StartupPath & [Ô] mp.xml[Ô])
ds.ReadXml(Application.StartupPath & [Ô] mp.xml[Ô])
Protoc = ds.Tables(2).Rows(0)([Ô]nProt[Ô]).ToString()
DataHora = ds.Tables(2).Rows(0)([Ô]dhRecbto[Ô]).ToString()
<retConsSitCTe versao=[Ô]1.03[Ô] xmlns=[Ô]http://www.portalfiscal.inf.br/cte[Ô]>
<tpAmb>2</tpAmb>
<verAplic>1.03</verAplic>
<cStat>100</cStat>
<xMotivo>Autorizado o uso da CT-e</xMotivo>
<cUF>51</cUF>
- <protCTe versao=[Ô]1.03[Ô]>
- <infProt>
<tpAmb>2</tpAmb>
<verAplic>1.03</verAplic>
<chCTe>51100215950025000123570000000000109028601582</chCTe>
<dhRecbto>2010-03-01T16:45:11</dhRecbto>
<nProt>151100000465904</nProt>
<digVal>dUQMFVZgUNdD/qHAib9pjXgpe84=</digVal>
<cStat>100</cStat>
<xMotivo>Autorizado o uso da CT-e</xMotivo>
</infProt>
</protCTe>
</retConsSitCTe>
e quero copiar so esta parte
[txt-color=#e80000] <protCTe versao=[Ô]1.03[Ô]>
<infProt>
<tpAmb>2</tpAmb>
<verAplic>1.03</verAplic>
<chCTe>51100215950025000123570000000000109028601582</chCTe>
<dhRecbto>2010-03-01T16:45:11</dhRecbto>
<nProt>151100000465904</nProt>
<digVal>dUQMFVZgUNdD/qHAib9pjXgpe84=</digVal>
<cStat>100</cStat>
<xMotivo>Autorizado o uso da CT-e</xMotivo>
</infProt>
</protCTe>
[/txt-color]
Dim ds As New DataSet
Doc.LoadXml(resultado1.OuterXml)
Doc.Save(Application.StartupPath & [Ô] mp.xml[Ô])
ds.ReadXml(Application.StartupPath & [Ô] mp.xml[Ô])
Protoc = ds.Tables(2).Rows(0)([Ô]nProt[Ô]).ToString()
DataHora = ds.Tables(2).Rows(0)([Ô]dhRecbto[Ô]).ToString()
Aqui um exemplo:
strRetorno = wsMsg.nfeRecepcaoLote(wsCabecMsg, Notas)
[ô]DESMEMBRA RETORNO XML
Dim StrRetNota As RetEnvio = Nothing
Dim XmlText As XmlDocument = New XmlDocument
XmlText.LoadXml(strRetorno)
Dim nodelist As XmlNodeList = XmlText.DocumentElement.ChildNodes
For Each outerNode As XmlNode In nodelist
For Each InnerNode As XmlNode In outerNode.ChildNodes
If (InnerNode.Name = [Ô]verAplic[Ô] Or outerNode.Name = [Ô]verAplic[Ô]) Then
StrRetNota.verAplic = InnerNode.InnerText
End If
If (InnerNode.Name = [Ô]cStat[Ô] Or outerNode.Name = [Ô]cStat[Ô]) Then
StrRetNota.cStat = InnerNode.InnerText
End If
If (InnerNode.Name = [Ô]xMotivo[Ô] Or outerNode.Name = [Ô]xMotivo[Ô]) Then
StrRetNota.xMotivo = InnerNode.InnerText
End If
If (InnerNode.Name = [Ô]cUF[Ô] Or outerNode.Name = [Ô]cUF[Ô]) Then
StrRetNota.cUF = InnerNode.InnerText
End If
If (InnerNode.Name = [Ô]nRec[Ô] Or outerNode.Name = [Ô]nRec[Ô]) Then
StrRetNota.nRec = InnerNode.InnerText
End If
If (InnerNode.Name = [Ô]dhRecbto[Ô] Or outerNode.Name = [Ô]dhRecbto[Ô]) Then
StrRetNota.dhRecbto = InnerNode.InnerText
End If
If (InnerNode.Name = [Ô]tMed[Ô] Or outerNode.Name = [Ô]tMed[Ô]) Then
StrRetNota.tMed = InnerNode.InnerText
End If
Next
Next
Estou mostrando o processo inteiro
strRetorno = wsMsg.nfeRecepcaoLote(wsCabecMsg, Notas)
[ô]DESMEMBRA RETORNO XML
Dim StrRetNota As RetEnvio = Nothing
Dim XmlText As XmlDocument = New XmlDocument
XmlText.LoadXml(strRetorno)
Dim nodelist As XmlNodeList = XmlText.DocumentElement.ChildNodes
For Each outerNode As XmlNode In nodelist
For Each InnerNode As XmlNode In outerNode.ChildNodes
If (InnerNode.Name = [Ô]verAplic[Ô] Or outerNode.Name = [Ô]verAplic[Ô]) Then
StrRetNota.verAplic = InnerNode.InnerText
End If
If (InnerNode.Name = [Ô]cStat[Ô] Or outerNode.Name = [Ô]cStat[Ô]) Then
StrRetNota.cStat = InnerNode.InnerText
End If
If (InnerNode.Name = [Ô]xMotivo[Ô] Or outerNode.Name = [Ô]xMotivo[Ô]) Then
StrRetNota.xMotivo = InnerNode.InnerText
End If
If (InnerNode.Name = [Ô]cUF[Ô] Or outerNode.Name = [Ô]cUF[Ô]) Then
StrRetNota.cUF = InnerNode.InnerText
End If
If (InnerNode.Name = [Ô]nRec[Ô] Or outerNode.Name = [Ô]nRec[Ô]) Then
StrRetNota.nRec = InnerNode.InnerText
End If
If (InnerNode.Name = [Ô]dhRecbto[Ô] Or outerNode.Name = [Ô]dhRecbto[Ô]) Then
StrRetNota.dhRecbto = InnerNode.InnerText
End If
If (InnerNode.Name = [Ô]tMed[Ô] Or outerNode.Name = [Ô]tMed[Ô]) Then
StrRetNota.tMed = InnerNode.InnerText
End If
Next
Next
Estou mostrando o processo inteiro
OK muito obrgado pela ajuda.
Tópico encerrado , respostas não são mais permitidas