Can relaxng specify an unordered set of elements with the same name, but different attributes?

后端 未结 2 1969
粉色の甜心
粉色の甜心 2021-01-13 09:08

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 cho

2条回答
  •  离开以前
    2021-01-13 09:53

    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 elements using the version of Schematron that is supported by Jing:

    
      
        
          There must be 3 link elements.
          There must be 1 link element wwhere @rel='self' and @type='type1'.
          There must be 1 link element where @rel='download' and @type='type2'.
          There must be 1 link element where @rel='relatedData' and @type='type3'.
        
      
    
    

提交回复
热议问题