Solved

XML Funny characters

Posted on 2013-01-11
4
382 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 143

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 143

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Generate Unique ID in VB.NET 21 99
asp web application 3 35
xml files 7 53
Cannot kill Excel from taskmgr after Excel Export in VB 2014 6 35
Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

679 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