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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:02:48+00:00 2026-06-09T12:02:48+00:00

Im working to automate the testing of an API which takes and returns XML,

  • 0

Im working to automate the testing of an API which takes and returns XML, so I want to translate the documented return data of the API into schema as much as possible. I chose RelaxNG for this task based on ease of use and learning.

Before I throw in all the info, here’s the question:

Is it possible to describe “unordered set of elements, with the same name but different attributes” ?

Here is a sample object for what I’m having trouble describing:

<item>
    <id>d395136e-d060-4a6e-887c-c0337dd7ad09</id>
    <name>The item has a name</name>
    <link rel="self" type="type1" href="url" />
    <link rel="download" type="type2" href="url" />
    <link rel="relatedData" type="type3" href="url" />
</item>

The link objects are the bit that I’m getting hung up on. Here is the problem:

  • The order of elements inside item is not guaranteed, so I am trying to put all elements in <interleave> structure.
  • There will be multiple <link> elements inside <item>, with different sets of attributes (ie, <item> MUST have a ‘self’ link, a ‘download’ link, and a ‘relatedData’ link to be valid).
  • One of each link type is required, but again order is not guaranteed.

I tried to describe the schema like so:

<element name="item">
    <interleave>
        <element name="id"><text/></element>
        <element name="name"><text/></element>
        <ref name="selfLink"/>
        <ref name="launchLink"/>
        <ref name="thumbnailLink"/>
    </interleave>
</element>

the ‘link’ references are defined elsewhere like so:

 <define name="selfLink">
 <element name="link">
     <attribute name="href"><text/></attribute>
     <attribute name="rel"><value>self</value></attribute>
     <attribute name="type"><value>type1</value></attribute>
 </element>
 </define>

The parser is not pleased about this – from jing I get error: the element "link" can occur in more than one operand of "interleave". I can see what its getting at but I hoped it could handle the idea of ‘elements with the same name but different attributes’ as unique items.

Moving the link refs out of interleave gets it to parse, but I’ll be waiting for the validator to blow up whenever the order changes in the returned data.

Any ideas, or is this impossible?
Is there an inherent issue with the XML I am processing that will require me to move some of this up to higher processing logic in my test application (manually check for each link type after running a more generic XML validation?)

  • 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-09T12:02:49+00:00Added an answer on June 9, 2026 at 12:02 pm

    It looks like you have stumbled upon a restriction on interleave in RELAX NG. I would try to do this in Schematron, or perhaps a combination of RELAX NG and Schematron.

    Here is a snippet that checks your <link> elements using the version of Schematron that is supported by Jing:

    <schema xmlns="http://www.ascc.net/xml/schematron">
      <pattern name="link pattern">
        <rule context="item">
          <assert test='count(link) = 3'>There must be 3 link elements.</assert>
          <assert test="count(link[@rel = 'self' and @type ='type1']) = 1">There must be 1 link element wwhere @rel='self' and @type='type1'.</assert>
          <assert test="count(link[@rel = 'download' and @type ='type2']) = 1">There must be 1 link element where @rel='download' and @type='type2'.</assert>
          <assert test="count(link[@rel = 'relatedData' and @type = 'type3']) = 1">There must be 1 link element where @rel='relatedData' and @type='type3'.</assert>
        </rule>
      </pattern>
    </schema>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had just started working on some automated testing tools, namely test complete, which
I am working on an application to automate testing for SQL injection vulnerability. It
Currently working on a VBScript to automate some of the dirty PST ingestion work
I am working on a project to automate the calibration tests for some usints
I am working on a project where I need to automate some workflows in
Hai i want to generated an automated click event. I am working in php
Working with an undisclosed API, I found a function that can set the number
I am developing automated testing tool type application in which it get window handle
I want to load test the web application that we're working on? Can you
I am working on function testing using selenium. But on GUI testing I need

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.