Solved

XML Funny characters

Posted on 2013-01-11
4
365 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]
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
change it as :

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

Open in new window

0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

772 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

11 Experts available now in Live!

Get 1:1 Help Now