Questions tagged [keyref]

The keyref element specifies that an attribute or element value correspond to those of the specified key or unique element in order to perform validation checks

36 questions
10
votes
2 answers

XSD key/keyref beginner question

I'm trying to implement a very simple XML schema constraint. The idref attribute on elements of type should only be allowed to have a value that matches the id attribute on at least one element . If that doesn't make any sense…
razorline
  • 103
  • 1
  • 2
  • 4
8
votes
3 answers

XSD key/keyref intellisense validation support in Visual Studio 2010

I've been searching for the answer and could not find one: Is there a XSD key/keyref validation support via Intellisense in Visual Studio 2010? If so, how to make it work? If no, is there a (built-in) way in Visual Studio to do key/references…
Trident D'Gao
  • 18,973
  • 19
  • 95
  • 159
6
votes
1 answer

How to create an xml schema with key/keyrefs for nested elements of the same type

I work with some XML files on a regular basis and want to have better validation then a DTD can provide. So I started reading about schemas to see if would help me out. So far I've been able to create something that works almost like I need except…
Chuck
  • 159
  • 4
4
votes
2 answers

How to use unique and keyref properly in XML schema?

I have this XML schema but I don't know how to complete it in order to achieve what I need. I searched a lot online about unique and keyref usage, but all I can find are basic examples. This is my schema:
Manuel Durando
  • 1,493
  • 3
  • 19
  • 30
3
votes
1 answer

XML Schema Identity constraints - Can I use absolute path in XPath in selector?

I want to implement referential integrity in a xml document using key & keyref in a XML Schema. Let's say my XML looks like this: XXX XXX
rodrunner
  • 1,860
  • 4
  • 23
  • 34
2
votes
1 answer

XSD Schema Reference Integrity xs:keyref

I have an xsd named Event containing two lists ("AccountStructures" and "Events") of types AccountStructureItem and EventItem. There is a property: SourceId in the AccountStructureItem defined as unique and key. The EventItem type has also a…
2
votes
1 answer

XML, XSD xs:keyref within recursive complex type defintion

I have some xml data with a list of allowed types at the top and a recursive list type of objects and sub-objects that refer to the allowed types:
Arth
  • 12,789
  • 5
  • 37
  • 69
2
votes
0 answers

XML Schema validator for key / keyref

Is there an online XML validator that reports errors for key and keyref violations? From my trying, with corefiling for example, it does not work. It seems to me that it just ignores the key and keyref specifications. What I want is to validate an…
Terry
  • 14,529
  • 13
  • 63
  • 88
1
vote
1 answer

XML Schema keyref problems, possibly problem with recursive elements

Ok I've been banging my head against this one so long, I think I've damaged my brain so much I forgot Shakespeare. It's ok, I don't use him that much. Here's my problem. I have a list of fruit at the top of an xml document. This is the "lookup…
decoy
  • 341
  • 2
  • 13
1
vote
1 answer

XSD Key/KeyRef and how to reference

We use XML to define a model which we later use to generate code. The file looks something like this:
Tobias
  • 4,999
  • 7
  • 34
  • 40
1
vote
0 answers

Using keyRef in XSD : How to refer a key located in a different XSD (out of scope error)

My system parses two XML files (via JAXB unmarshalling and xjc generated code) componentModel.xml : generated from a modeling tool detailedDesign.xml : manual, to add informations In order to avoid to code checks upon content and structures,…
MatthG
  • 13
  • 5
1
vote
2 answers

XML Schema: keyref to hierarchically lower element

My XML structure is the following: ROOT |_ SetOfBandC (*) | |_ SetOfB (1) | | |_ ElementB (*) | | |_ ElementB__Key | |_ SetOfC (1) | …
RVKS
  • 147
  • 3
  • 16
1
vote
0 answers

XSD/XML key not found for identity constraint

First for all, I am a beginner in XSD/XML. In general, the problem is that I didn't understand very well how to use the xpath attribute. In particular, I can't match the "keyref elements" with the correspondent "key elements". XSD Schema
shogitai
  • 1,823
  • 1
  • 23
  • 50
1
vote
1 answer

xsd – can I restrict an attribute to a key OR enumeration?

I want to allow example.xml s.t. the only possible values of //refer-to-def/@n are the ones…
unhammer
  • 4,306
  • 2
  • 39
  • 52
1
vote
1 answer

XML Schema: keyref with optional field

I wonder if it's possible to use keyref element with optional fields. e.g. Given the following schema:
gentooise
  • 416
  • 3
  • 8
1
2 3