StringBuilder

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Why is the following code producing the below resuts

Dim msMessage(0) = New StringBuilder(

msMessage(0).Insert(0, "<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'"
msMessage(0).Insert(1, "xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'"
msMessage(0).Insert(2, "xmlns:xsd='http://www.w3.org/1999/XMLSchema'>"
============================================================================
<xxmlns:xsd='http://www.w3.org/1999/XMLSchema'>mlns:xsi='http://www.w3.org/1999/XMLSchema-instance'SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/

Why is everything going in backwards?
 
Jason said:
Why is the following code producing the below resuts?

Dim msMessage(0) = New StringBuilder()

msMessage(0).Insert(0, "<SOAP-ENV:Envelope
xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'")
msMessage(0).Insert(1,
"xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'")
msMessage(0).Insert(2,
"xmlns:xsd='http://www.w3.org/1999/XMLSchema'>")
=============================================================================
<xxmlns:xsd='http://www.w3.org/1999/XMLSchema'>mlns:xsi='http://www.w
3.org/1999/XMLSchema-instance'SOAP-ENV:Envelope
xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'

Why is everything going in backwards?

Because you're using StringBuilder.Insert when I think you really want
StringBuilder.Append. Look carefully at the docs for
StringBuilder.Insert.
 
Back
Top