skrombeen
asked on
XML Funny characters
HI,
i am writing a epp client. which sends xml files to a server containing commands and i get a xml file back with a response.
below is the response i am getting, but i cannot read the xml with the "v" value in it and sometimes it is a W aswell, it looks like it has something to do with 32bit, but i have no idea
please assist me, with some vb.net code to read.under the xml is my reading xml code:
{ v<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<epp:epp xmlns:epp="urn:ietf:params :xml:ns:ep p-1.0">
<epp:response>
<epp:result code="1000">
<epp:msg>Access granted</epp:msg>
</epp:result>
<epp:trID>
<epp:clTRID>#clTRID#</epp: clTRID>
<epp:svTRID>COZA-EPP-13C2B 6C9493-F8A 4</epp:svT RID>
</epp:trID>
</epp:response>
</epp:epp>
}
----
reading code
----
Private Function ParseResut(result As String) As Object
Dim innerText As Object
Try
Dim document As New XmlDocument()
document.LoadXml(result)
Dim nsmgr As New XmlNamespaceManager(docume nt.NameTab le)
nsmgr.AddNamespace("epp", "urn:ietf:params:xml:ns:ep p-1.0")
innerText = document.DocumentElement.S electSingl eNode("epp :response/ epp:result /epp:msg", nsmgr).InnerText
Catch exception1 As Exception
' ProjectData.SetProjectErro r(exceptio n1)
innerText = "Invalid result."
' ProjectData.ClearProjectEr ror()
End Try
Return innerText
End Function
i am writing a epp client. which sends xml files to a server containing commands and i get a xml file back with a response.
below is the response i am getting, but i cannot read the xml with the "v" value in it and sometimes it is a W aswell, it looks like it has something to do with 32bit, but i have no idea
please assist me, with some vb.net code to read.under the xml is my reading xml code:
{ v<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<epp:epp xmlns:epp="urn:ietf:params
<epp:response>
<epp:result code="1000">
<epp:msg>Access granted</epp:msg>
</epp:result>
<epp:trID>
<epp:clTRID>#clTRID#</epp:
<epp:svTRID>COZA-EPP-13C2B
</epp:trID>
</epp:response>
</epp:epp>
}
----
reading code
----
Private Function ParseResut(result As String) As Object
Dim innerText As Object
Try
Dim document As New XmlDocument()
document.LoadXml(result)
Dim nsmgr As New XmlNamespaceManager(docume
nsmgr.AddNamespace("epp", "urn:ietf:params:xml:ns:ep
innerText = document.DocumentElement.S
Catch exception1 As Exception
' ProjectData.SetProjectErro
innerText = "Invalid result."
' ProjectData.ClearProjectEr
End Try
Return innerText
End Function
ASKER
hi,
that doesn't work. the character changes every time i get a new response
that doesn't work. the character changes every time i get a new response
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
change it as :
Try
Dim document As New XmlDocument()
result = Regex.Replace(result, "^\{[^\<]+<", "{<")
document.LoadXml(result)
either on the send/response part, or otherwise just "remove" that trailing bad character before reading the xml