2 Replies Latest reply: Apr 18, 2014 4:04 AM by User772606-Oracle RSS

    How to restrict max children for a node containing different node types

    User772606-Oracle

      Hi,

       

      I have the following XML:

      <categories>
          <category id="hsp">
              <cardUsage id="hsp.approvals">
                  <tabUsage id="hsp.approvals.puListing"/>
                  <tabUsage id="hsp.approvals.puDashboard"/>
              </cardUsage>
              <cardClusterUsage id="hsp.someCluster">
                  <cardUsage id="hsp.someCluster.approvals"/>
              </cardClusterUsage>
          </category>
          <category  id="psb">
          </category>
          <category  id="pfp">
          </category>
          <category  id="cx">
          </category>
      </categories>
      
      
      

       

      I need to put a restriction that node category cannot have more than 16 children (cardUsage nodes + cardClusterUsage nodes).

       

      The way I was thinking to achieve this is, use a new node Usage as child of category. I could set maxOccurs on Usage to 16. And then in Usage use the xs:choice to choose between cardUsage and cardClusterUsage. And setting the maxOccurs to 1.

       

      Please let me know if there is a better way to do this. Or you see any flaws in my proposal.

       

      Thanks for you time in advance,

      Manish.