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 808889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:38:16+00:00 2026-05-15T00:38:16+00:00

Im trying to create a xml the should look like this <?xml version=1.0 encoding=iso-8859-1?>

  • 0

Im trying to create a xml the should look like this

<?xml version="1.0" encoding="iso-8859-1"?>
<MyTestSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Tests>
    <Test>
      <messaure>1</messaure>
      <height>4</height>
    </Test>
    <Test>
      <messaure>4</messaure>
      <height>53</height>
    </Test>
  </Tests>
</MyTestSet>

Its not a problem to create the Tests or Test elements, but what is the best way to Create the “MyTestSet” including the namespaces?
Im using c# XMLDocument

  • 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-05-15T00:38:17+00:00Added an answer on May 15, 2026 at 12:38 am

    This works for me:

    XmlDocument.DocumentElement.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
    XmlDocument.DocumentElement.SetAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
    

    If you want to create the entire document you’ve posted, you might not want to forget the XML declaration:

            XmlDeclaration xml_declaration;
            xml_declaration = XmlDocument.CreateXmlDeclaration("1.0", "ISO-8859-1", "yes");
    
            XmlElement document_element = XmlDocument.DocumentElement;
            XmlDocument.InsertBefore(xml_declaration, document_element);
    

    In certain cases you might need it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm now trying to create a xml-rpc server with the CodeIgniter Framework. <?php $this->load->library('xmlrpc');
I'm trying to create XML record. I started with this: $doc = new DomDocument('1.0',
I'm trying to create this simple layout in Android. A should wrap to fit
I am trying to create an XML file based on data fields from a
I'm trying to create a type in an XML schema to enforce an element
I'm trying to create a sitemap using Linq to Xml, but am getting an
I am trying to create a route that can allow for different formats (html/json/xml
I'm trying to create an in-memory xml document such that the root's child nodes
I am trying to create a Facebook iFrame app. The app should first show
I'm trying to create a custom Android compound view, here is the code: <?xml

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.