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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:57:11+00:00 2026-05-23T16:57:11+00:00

I am struggling with trying to develop a schema which allows attributes from mixed

  • 0

I am struggling with trying to develop a schema which allows attributes from mixed namespaces.

Here is xxx_schema2.xsd:

<?xml version="1.0" encoding="UTF-8"?>
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  elementFormDefault="qualified"
  attributeFormDefault="qualified"  
  targetNamespace="http://www.mrbouffant.com/schema2"
  xmlns:xxx="http://www.mrbouffant.com/schema2"> 

  <xs:attributeGroup name="schema2AttributeGroup">
    <xs:attribute name="schema2Attribute1 " type="xs:string"/>
    <xs:attribute name="schema2Attribute2 " type="xs:string"/>
  </xs:attributeGroup>

</xs:schema>

Here is xxx_schema1.xsd which imports xxx_schema2:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified"
xmlns:xxx="http://www.mrbouffant.com/schema2">

  <xs:import namespace="http://www.mrbouffant.com/schema2" schemaLocation="xxx_schema2.xsd"/>

  <!-- ROOT ELEMENT -->
  <xs:element name="rootElement" type="rootElementType" />

  <!-- COMPLEX TYPES -->
  <xs:complexType name="rootElementType">
    <xs:simpleContent>
        <xs:extension base="xs:string">
            <xs:attributeGroup ref="xxx:schema2AttributeGroup"/>  
            <xs:attribute name="schema1Attribute1" type="xs:string"/>
        </xs:extension>
     </xs:simpleContent>
  </xs:complexType>
</xs:schema>

Here is the XML document which I would like to validate against xxx_schema1.xsd:

<?xml version="1.0" encoding="UTF-8"?>
  <rootElement xmlns:xxx='http://www.mrbouffant.com/schema2/' 
schema1Attribute1="foo"
xxx:schema2Attribute1="bar"
xxx:schema2Attribute2="far" />

When the Saxon-EE parser attempts to validate the XML document against the schema, the errors it generates are literally:

Engine name: Saxon-EE 9.3.0.5
Severity: error
Description: Attribute @xxx:schema2Attribute1 is not allowed on element <rootElement>
(it would be allowed in namespace http://www.mrbouffant.com/schema2)

AND

Engine name: Saxon-EE 9.3.0.5
Severity: error
Description: Attribute @xxx:schema2Attribute2 is not allowed on element <rootElement>
(it would be allowed in namespace http://www.mrbouffant.com/schema2)

Please can you help me understand what I have done wrong in my schema definitions or XML document which prevent the validation from being successful? Thank you.

  • 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-23T16:57:11+00:00Added an answer on May 23, 2026 at 4:57 pm

    The namespace declaration for http://www.mrbouffant.com/schema2 in your instance XML has a trailing slash and does not match your Schema’s declared namespace.

    Remove the trailing slash and it validates just fine:

    <?xml version="1.0" encoding="UTF-8"?>
      <rootElement xmlns:xxx='http://www.mrbouffant.com/schema2' 
    schema1Attribute1="foo"
    xxx:schema2Attribute1="bar"
    xxx:schema2Attribute2="far" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Erlang version: R13B01 Currently I'm struggling trying to make Erlang work with SSL. The
I am trying to read the following xml stream but am really struggling. <channelSnapshot
I'm struggling while trying to write generic methods to save and load data from
I'm trying to develop a small Stripes project that allows the user to uoload
I'm struggling trying to make a cron job run. Here is what I have:
Currently I'm trying to develop some simple plot prototype and I'm struggling with some
Thanks for reading! I am currently trying to develop an application which will backup
I'm struggling trying to teach myself Mockito. Consider the following method, hasInventory() , which
I am struggling trying to pick apart the OAuth Service Provider example which is
I am struggling trying to perform what I would think would be a relatively

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.