Solved

XML Funny characters

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
imap read mail 1 28
Winform Module - What is the ASP.Net equiv 2 19
vb.net 1 month apart 11 28
Client Validating 2 date fields, required & comparison 1 24
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…
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 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