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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:14:39+00:00 2026-06-02T05:14:39+00:00

I have my xml document containing several elements which have an attribute xml:lang. I

  • 0

I have my xml document containing several elements which have an attribute xml:lang.

I want to restrict the values which are allowable for the attribute’s value; i.e. only allow “en-US, en-CA”.

I’ve tried adding a restriction, but since the value is referenced that doesn’t seem to be valid:

<xs:element name="translation">
<xs:complexType>
    <xs:sequence>
    <xs:element ref="name" />
    </xs:sequence>
    <xs:attribute ref="xml:lang" use="required"/>
</xs:complexType>
</xs:element>

Getting the namespace to import was difficult enough and I can’t seem to find any good resources on adding restrictions/enumerations to it =(

  • 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-02T05:14:41+00:00Added an answer on June 2, 2026 at 5:14 am

    Unfortunately, there is no easy way to achieve it. The options you have are definitely not that used.

    A quick (and dirty) way is to copy the original xml.xsd on your local machine; edit the xml.xsd file to have the definition you want for the xml:lang attribute; and through some generic mechanism (e.g. catalogs if you want to use dangling types), or simply xsd:import to your modified file, instruct your stack/tooling to use the amended definition. It might not even work in some cases, since some tools may be stubborn enough to use an internal, cached copy, of the xml.xsd; can’t comment, since you have not indicated the stack you’re on.

    There is no clean way to do it in XSD 1.0, simply because xsd:redefine only works for types, and groups of particles and attributes. Since xml:lang is of xsd:language type, there is no way to redefine that to constrain it only to the enumerations you want.

    xsd:override in XSD 1.1 would allow for unconstrained replacement; unfortunately, I would be surprised to see a mainstream implementation of the new XSD version.

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

Sidebar

Related Questions

I have an XML document with a bunch of elements, each containing a timestamp
I have a string containing field/value pairs in xml format and want to parse
I want to convert an XML document containing many elements within a node (around
I have an XML document containing contact information as seen below: <contact type=individual> <firstname>Some</firstname>
I have a string containing XML document using LinqtoXML What is the best way
Have a source xml document that uses namespace containing prefixes and a default namespace.
I have an XML document, and I want to print the tag names and
I have an XML document that looks like this <Elements> <Element> <DisplayName /> <Type
I have a simple XML document containing two city id's. <?xml version=1.0 encoding=ISO-8859-1?> <config>
I have an XML document with a node containing the escaped XML serialization of

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.