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

  • Home
  • SEARCH
  • 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 522965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:24:31+00:00 2026-05-13T08:24:31+00:00

Basically if this was .NET, it would look like this: ISomething { string A

  • 0

Basically if this was .NET, it would look like this:

ISomething
{
  string A { get; }
  int B { get; }
}

var somethings = new List<ISomething>();
something.Add(new SomethingSomething());
something.Add(new AnotherSomething());
something.Add(new AnythingSomething());

Basically I want the sequence of elements to be named anything they want to be, as long as their complex type is an extension of a complex type I define.

So it may look something like:

<somethings>
  <something-something a="foo" b="0" />
  <another-something a="bar" b="1" />
  <example:anything-something a="baz" b="2" />
</somethings>

I’m sure this is possible, the alternative I guess is composition, where I have a standard element that can contain a single child that is at least a ‘Something’..

Thanks in advance, xsd isn’t my strong point.


Edit, ok the closest thing I’ve found so far is basically:

<somethings>
  <something xsi:type="something-something" a="foo" b="0" />
  <something xsi:type="another-something" a="bar" b="1" />
  <something xsi:type="example:anything-something" a="baz" b="2" />
</somethings>

I guess this is the only way this is handled? if so this isn’t so bad, and vs intellisense seems to understand this well enough.

Thanks.

  • 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-13T08:24:31+00:00Added an answer on May 13, 2026 at 8:24 am

    This is a good question. You could do a sequence of “any”, which would allow you have arbitrarily named elements inside – but that won’t constrain them in any way. Alternately, the schema below constrains the name and the attributes, but nothing else (as in your second example)

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    
      <xs:complexType name="somethingsType" >
        <xs:complexContent>    
          <xs:restriction base="xs:anyType">
           <xs:attribute name="a" type="xs:string"/>
           <xs:attribute name="b" type="xs:string"/>
          </xs:restriction>
        </xs:complexContent>
      </xs:complexType>
    
      <xs:complexType name="somethingsSeq" >
        <xs:sequence>
          <xs:element name="something" type="somethingsType"/>
        </xs:sequence>
      </xs:complexType>
    
      <xs:element name="somethings"  type="somethingsSeq"/> 
    
    </xs:schema>
    

    I can’t find a way to constrain the type but not the element name.

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

Sidebar

Ask A Question

Stats

  • Questions 373k
  • Answers 373k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I've modified your code slightly and don't have any issues… May 14, 2026 at 7:34 pm
  • Editorial Team
    Editorial Team added an answer belongsTo and hasMany are a pair and express a one-to-many… May 14, 2026 at 7:34 pm
  • Editorial Team
    Editorial Team added an answer Animation1 - scrollTo() - Animation2 May 14, 2026 at 7:34 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.