how xsd can represent different xml file?

前端 未结 3 616
心在旅途
心在旅途 2021-01-28 11:57

if I have this XML data Main.xml

  
 
  11 
  1 
 
 &         


        
3条回答
  •  粉色の甜心
    2021-01-28 12:52

    It looks to me as if you should make the content model for SigmodRecord be an xs:choice with the two alternatives being Authors or Issue.

    You'll get much more reusability of the definitions in the schema if you use more global top-level element (and perhaps type) declarations. A deeply nested schema like this, with only one top-level element declaration, can only describe one input document format - there's no provision for elements such as Author or Affiliation appearing in different places in different messages.

    Some people like to make use of the xsi:type attribute for this kind of scenario: two alternative types for the SigmodRecord element, selected in the instance by using or .

提交回复
热议问题