Link to home
Start Free TrialLog in
Avatar of skrombeen
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:epp-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-13C2B6C9493-F8A4</epp:svTRID>
    </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(document.NameTable)
            nsmgr.AddNamespace("epp", "urn:ietf:params:xml:ns:epp-1.0")
            innerText = document.DocumentElement.SelectSingleNode("epp:response/epp:result/epp:msg", nsmgr).InnerText
        Catch exception1 As Exception
            '           ProjectData.SetProjectError(exception1)
            innerText = "Invalid result."
            '   ProjectData.ClearProjectError()
        End Try
        Return innerText
    End Function
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

if you get that "bad" xml, you have to solve that issue.
either on the send/response part, or otherwise just "remove" that trailing bad character before reading the xml
Avatar of skrombeen
skrombeen

ASKER

hi,

that doesn't work. the character changes every time i get a new response
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
change it as :

 Try
            Dim document As New XmlDocument()
            result = Regex.Replace(result, "^\{[^\<]+<", "{<")
            document.LoadXml(result)

Open in new window