Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Primary key - Foreign Key relationship

 
Hemant Kamat
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you establish a primary key - foreign key relationship in two different XML files?
-- e.g In one XML file (Person.xml) I have a Persons tag. This tag can have any number of Person elements which have one attribute id. I need the value of this id attribute to be present in the other xml file (Directory.xml)
Person.xml
<Persons>
<Person ID=1>
<LName>x</LName>
<FName>f</FName>
</Person>
<Person ID=3>
<LName>w</LName>
<FName>z</FName>
</Person>
</Persons>

Directory.xml
<Directory>
<PersonList>
<PersonId>1</PersonId>
<PersonId>2</PersonId>
</PersonList>
</Directory>
Now since Person with ID=2 is not present in person.xml, I should not be able to use this number in PersonList. I want to put a restriction. I know xsd:key and xsd:keyref works but i think - it works if both the elements are in one xml file. I want to put the data in 2 separate xml files and establish primary key- foreign key relationship. How do i do that?
Any help will be greatly appreciated.
Thanks a lot in Advance
Hemant
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic