validation - How can I constrain XML content to other content in the XML (as a reference)? -


I want to be valid if and only when there is id = * from > Method / Key and {*} in substrings method / call .

  1. Valid because each {*} corresponds exactly with id = * and vice versa.

      & lt; Format & gt; & Lt; Phone & gt; / Tags / {1} / top-ask / {2} & lt; / Call & gt; & Lt; Major id = "1" & gt; & Lt; Name & gt; Tag & lt; / Name & gt; For site & lt; Discussion & gt; Tag & lt; / Discussion & gt; & Lt; / Key & gt; & Lt; Major id = "2" & gt; & Lt; Name & gt; Period & lt; / Name & gt; & Lt; / Key & gt; & Lt; / Format & gt; Invalid  
  2. because there is no id = * no related {*} .

      & lt; Format & gt; & Lt; Phone & gt; / Tags / {1} & lt; / Call & gt; & Lt; Major id = "1" & gt; & Lt; Name & gt; Tag & lt; / Name & gt; For site & lt; Discussion & gt; Tag & lt; / Discussion & gt; & Lt; / Key & gt; & Lt; Major id = "2" & gt; & Lt; Name & gt; Period & lt; / Name & gt; & Lt; / Key & gt; & Lt; / Format & gt;    
  3. Invalid because there is not a {*} any id = * .

      & lt; Format & gt; & Lt; Phone & gt; / Tags / {1} / top-ask / {2} & lt; / Call & gt; & Lt; Major id = "1" & gt; & Lt; Name & gt; Tag & lt; / Name & gt; For site & lt; Discussion & gt; Tag & lt; / Discussion & gt; & Lt; / Key & gt; & Lt; / Format & gt;    
  4. Ideally, I should also be able to do this, that is, any of the contents of {*} can be < Code> [^} {] .

      & lt; Format & gt; & Lt; Phone & gt; / Tag / {tag} / top-ask / {2} & lt; / Call & gt; & Lt; Major id = "tag" & gt; & Lt; Name & gt; Tag & lt; / Name & gt; For site & lt; Discussion & gt; Tag & lt; / Discussion & gt; & Lt; / Key & gt; & Lt; Major id = "2" & gt; & Lt; Name & gt; Period & lt; / Name & gt; & Lt; / Key & gt; & Lt; / Format & gt;     

    I have seen the w3schools reference for the XML schema, but it seems that there is no list of such capabilities. This is definitely not a complete reference to the imagery, though. Is it possible within the XML schema?

    Update

    @jiraka has provided the following expression which is solved (2) (and (4)) but not (3): $ / / / key return

         for matches ($ key /../ call, contact ("\ {", $ key / @ id, "\}" P> 

    In IMO, XSD 1.0, this is not possible. Of course there are some basic obstacles (xs: unique, xs: key). It is defined using an XPath expression, but this expression is only a subset of the entire XPath language (see Chapter 9.2.5). The most limited fact in this case is that function calls are not allowed and you may need some string manipulation function, because the "call" element is content string.

    If you can use XSD 1.1, then some other capabilities, to express more complex restrictions, especcialy is "xs: emphasis" in my mind I think the Xpath function is XSD 1.1 Can be said in.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -