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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:43:35+00:00 2026-05-29T17:43:35+00:00

Suppose I have such elements in my XML document: <xs:appinfo> <CustomXML> <Something>something</Something> </CustomXML> </xs:appinfo>

  • 0

Suppose I have such elements in my XML document:

<xs:appinfo>
  <CustomXML>
    <Something>something</Something>
  </CustomXML>
</xs:appinfo>

“xs” is declared as the default schema namespace. My question is: how would a parser interpret the inner elements of xs:appinfo? In which namespace do they belong?

I ask because I’m parsing the code in C# and it keeps adding “xmlns=”” ” to the CustomXML element, which makes me assume that otherwise it’d treat these elements as schema elements.

  • 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-29T17:43:46+00:00Added an answer on May 29, 2026 at 5:43 pm

    According to §6.2 Namespace Defaulting of Namespaces in XML 1.0 (Third Edition):

    The scope of a default namespace declaration extends from the beginning of the start-tag in which it appears to the end of the corresponding end-tag, excluding the scope of any inner default namespace declarations. […]

    A default namespace declaration applies to all unprefixed element names within its scope.

    That means that elements with no namespace prefix are interpreted as being in the default namespace. Default namespace is usually defined on the first element of the document and look like this:

    <element xmlns="namespace-uri">
    

    The library redefines the default namespace when it’s necessary, that is, when you add an element to the document with no namespace. In other words, such element is not in the default namespace, so the library solves this by adding xmlns="" to that element, which redefined the default namespace for this element and all its descendants to "no namespace".

    If you want to add element that is in the default namespace, you have to specify it explicitly. For example, in LINQ to XML:

    XDocument doc = …;
    
    var ns = doc.Root.GetDefaultNamespace();
    
    var newElement = new XElement(ns + "foo"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose you have an unsorted array, how will you find 2 equal elements such
Suppose I have this (outrageously) simplified XML schema: <xsd:complexType name=Person> <xsd:sequence> <xsd:element ref=FirstName/> <xsd:element
Suppose I have a system where I have metadata such as: table: ====== key
Suppose I have an IEnumerable such as a List(TValue) and I want to keep
Suppose I have code that maintains a parent/children structure. In such a structure I
Suppose I have a structure in C or C++, such as: struct ConfigurableElement {
Suppose I'm implementing an MVP pattern and I have a view interface as such:
Suppose I have this XML: <?xml version=1.0 encoding=UTF-8?> <root xmlns:foo=http://www.foo.com> <foo:one>Alpha</foo:one> <two foo:Dog=Yorkie>Bravo</two> <three>foo:Delta</three>
Suppose I have two containers of elements: std::vector<std::string> foo = { aa, bb, cc
Suppose I have a hypothetical html layout such as this (while hypothetical, I'm implementing

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.