Solved

XML Funny characters

Posted on 2013-01-11
4
374 Views
Last Modified: 2013-01-12
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
0
Comment
Question by:skrombeen
  • 2
4 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 38768840
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
0
 
LVL 1

Author Comment

by:skrombeen
ID: 38768906
hi,

that doesn't work. the character changes every time i get a new response
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 38769576
you should develop the "character" removal dynamically.
as the "true" xml string has to start with <?xml, remove everything before that.
0
 
LVL 9

Expert Comment

by:sognoct
ID: 38769922
change it as :

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

Open in new window

0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now