Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7806591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:35:08+00:00 2026-06-02T02:35:08+00:00

I am trying to get communicate to a payment processor. When I use XmlSerializer.Serialize

  • 0

I am trying to get communicate to a payment processor. When I use XmlSerializer.Serialize
on my object I get

<?xml version=\"1.0\" encoding=\"utf-16\"?>
<txn xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">
  <ssl_merchant_id>xxxxxx</ssl_merchant_id>
  <ssl_user_id>xxxxxx</ssl_user_id>
  <ssl_pin>xxxxxx</ssl_pin>
  <ssl_test_mode>True</ssl_test_mode>
  <ssl_transaction_type>ccavsonly</ssl_transaction_type>
  <ssl_card_number>4111111111111111</ssl_card_number>
  <ssl_exp_date>0612</ssl_exp_date>
  <ssl_avs_address>101 Main St.</ssl_avs_address>
  <ssl_avs_zip>90210</ssl_avs_zip>
</txn>

Prior to using that method, I manually built the XML for testing and this worked:

<txn>
  <ssl_merchant_id>xxxxxx</ssl_merchant_id>
  <ssl_user_id>xxxxxx</ssl_user_id>
  <ssl_pin>xxxxxx</ssl_pin>
  <ssl_test_mode>True</ssl_test_mode>
  <ssl_transaction_type>ccavsonly</ssl_transaction_type>
  <ssl_card_number>4111111111111111</ssl_card_number>
  <ssl_exp_date>0612</ssl_exp_date>
  <ssl_avs_address>101 Main St.</ssl_avs_address>
  <ssl_avs_zip>90210</ssl_avs_zip>
</txn>

How would I go about stripping out the <?xml version=\"1.0\" encoding=\"utf-16\"?> and xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"> from the XML or not have the serializer generate it to begin with?

My object looks like:

[XmlRoot(ElementName="txn")]
public class AvsTransmission
{
    [XmlElement]
    public string ssl_merchant_id { get; set; }
    [XmlElement]
    public string ssl_user_id { get; set; }
    [XmlElement]
    public string ssl_pin { get; set; }
    [XmlElement]
    public string ssl_test_mode { get; set; }
    [XmlElement]
    public string ssl_transaction_type { get; set; }
    [XmlElement]
    public string ssl_card_number { get; set; }
    [XmlElement]
    public string ssl_exp_date { get; set; }
    [XmlElement]
    public string ssl_avs_address { get; set; }
    [XmlElement]
    public string ssl_avs_zip { get; set; }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T02:35:09+00:00Added an answer on June 2, 2026 at 2:35 am

    My first answer was only half of the problem, you also have to remove the declaration as has been mentioned.

    Here is an example:

    XmlWriterSettings settings = new XmlWriterSettings();
    settings.OmitXmlDeclaration = true;
    
    MemoryStream ms = new MemoryStream();
    XmlWriter writer = XmlWriter.Create(ms, settings);
    
    XmlSerializerNamespaces names = new XmlSerializerNamespaces();
    names.Add("", "");
    
    XmlSerializer cs = new XmlSerializer(typeof(Cat));
    
    cs.Serialize(writer, new Cat { Lives = 9 }, names);
    
    ms.Flush();
    ms.Seek(0, SeekOrigin.Begin);
    StreamReader sr = new StreamReader(ms);
    var xml = sr.ReadToEnd();
    

    The string xml now contains:

    <cat><Lives>9</Lives></cat>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get this message when trying to communicate with software that communicates with SOAP?
I am trying to get jquery to communicate with a web service!! function Test(item)
Just trying to get some opinions on whether or not CommandHandlers can/should communicate with
I'm trying to get a Samsung Galaxy Ace with Android to communicate with a
I am trying to get an iframe B communicate with site A. I've searched
I'm trying to get the Arduino to communicate with my computer using a simple
I'm trying to get my app to communicate with a WCF. I have already
I'm trying to get a user-level program to communicate with the kernel via /proc.
We are trying to get two programs to communicate with each other in a
I'm trying to get a Java Client to communicate with a WCF wshttpbinding WebService.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.