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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:41:13+00:00 2026-05-26T03:41:13+00:00

I’m interested in XML files with structure: <resource> <type>STRING</type> <metadata> <ANY_EXTERNAL_ELEMENT1> <value>STRING</value> </ANY_EXTERNAL_ELEMENT1> <ANY_EXTERNAL_ELEMENT2>

  • 0

I’m interested in XML files with structure:

<resource>
    <type>STRING</type>
    <metadata>
        <ANY_EXTERNAL_ELEMENT1>
            <value>STRING</value> 
        </ANY_EXTERNAL_ELEMENT1>
        <ANY_EXTERNAL_ELEMENT2>
            <reference>STRING</reference> 
        </ANY_EXTERNAL_ELEMENT2>
        <ANY_EXTERNAL_ELEMENT3>
            <value>STRING</value> 
        </ANY_EXTERNAL_ELEMENT3>
    </metadata>
</resource>

metadata element need to have at least one ANY_EXTERNAL_ELEMENT child that need to have only one child element with name in set {“reference”, “value”}.

Is it possible to achieve it in XMLSchema?

What I tried:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:element name="resource">
        <xs:complexType>
            <xs:all>
                <xs:element name="type" type="xs:string"/>
                <xs:element name="metadata">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:any minOccurs="1">
                                <xs:complexType>
                                    <xs:choice>
                                        <xs:element name="reference"/>
                                        <xs:element name="value"/>
                                    </xs:choice>
                                </xs:complexType>
                            </xs:any>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:all>
        </xs:complexType>
    </xs:element>

</xs:schema>

But it’s not valid.
I need help.

Thanks in advance.

  • 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-26T03:41:13+00:00Added an answer on May 26, 2026 at 3:41 am

    No, you cannot constrain an “external” element like that. The content model for <any> allows only <annotation>. Wouldn’t it be more natural to kind of invert the structure:

    <resource>
    <type>STRING</type>
    <metadata>
        <external value="STRING">
            <ANY-EXTERNAL-ELEMENT-1/>
        </external>
        <external ref="STRING">
            <ANY-EXTERNAL-ELEMENT-2/>
        </external>
    </metadata>
    </resource>
    

    But, of course, I have no idea what your use case is.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
Specifically, suppose I start with the string string =hello \'i am \' me And
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.