我是 xquery 的新手,我正在寻找一个快速解决这个问题的方法。
我有一个 xml 文档,我想在文档中找到所有堂兄弟对和所有堂兄弟对。
请查看下面的 xml 并指导我如何继续,或者您是否可以提供任何将被高度应用的代码片段。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE GEDCOM SYSTEM "file:/Users/indiwarafernando/Downloads/family.dtd">
<GEDCOM>
<HeaderRec>
<FileCreation Date=""></FileCreation>
<Submitter>
<Link Target="" Ref="FM001"/>
</Submitter>
</HeaderRec>
<FamilyRec Id="FM001">
<HusbFath>
<Link Target="IndividualRec" Ref="IN001"/>
</HusbFath>
<WifeMoth>
<Link Target="IndividualRec" Ref="IN002"/>
</WifeMoth>
<Child>
<Link Target="IndividualRec" Ref="IN004"/>
</Child>
<Child>
<Link Target="IndividualRec" Ref="IN007"/>
</Child>
</FamilyRec>
<FamilyRec Id="FM002">
<HusbFath>
<Link Target="IndividualRec" Ref="IN004"/>
</HusbFath>
<WifeMoth>
<Link Target="IndividualRec" Ref="IN005"/>
</WifeMoth>
<Child>
<Link Target="IndividualRec" Ref="IN006"/>
</Child>
</FamilyRec>
<FamilyRec Id="FM003">
<HusbFath>
<Link Target="IndividualRec" Ref="IN007"/>
</HusbFath>
<WifeMoth>
<Link Target="IndividualRec" Ref="IN008"/>
</WifeMoth>
<Child>
<Link Target="IndividualRec" Ref="IN009"/>
</Child>
</FamilyRec>
<IndividualRec Id="IN001">
<IndivName>Fathers name</IndivName> <!-- This tag used for father of c1 or husband of w1 -->
<Gender>Male</Gender>
<AssocIndiv>
<Link Target="" Ref="IN002"/>
<Association>Wife</Association>
</AssocIndiv>
</IndividualRec>
<IndividualRec Id="IN002"> <!-- This tag used for mother of c1 or wife of h1 -->
<IndivName>Mother s name</IndivName>
<Gender>Male</Gender>
<AssocIndiv>
<Link Target="IndividualRec" Ref="IN001"/>
<Association>Husband</Association>
</AssocIndiv>
</IndividualRec>
<IndividualRec Id="IN003"> <!-- This tag used for a child to h1 or w1 or grand son to gm1 or gf1 -->
<IndivName>Child 1 name</IndivName>
<Gender>Male</Gender>
<AssocIndiv>
<Link Target="IndividualRec" Ref="IN001"/>
<Association>Father</Association>
</AssocIndiv>
<AssocIndiv>
<Link Target="IndividualRec" Ref="IN002"/>
<Association>Mother</Association>
</AssocIndiv>
</IndividualRec>
<IndividualRec Id="IN005"> <!-- This tag used for grand mother -->
<IndivName>Grand mother's name</IndivName>
<Gender>Male</Gender>
<AssocIndiv>
<Link Target="IndividualRec" Ref="IN004"/>
<Association>Husband</Association>
</AssocIndiv>
</IndividualRec>
<IndividualRec Id="IN004"> <!-- This tag used for grand father -->
<IndivName>Grand father's name</IndivName>
<Gender>Male</Gender>
<AssocIndiv>
<Link Target="IndividualRec" Ref="IN005"/>
<Association>Grand Father's Wife</Association>
</AssocIndiv>
</IndividualRec>
<IndividualRec Id="IN006"> <!-- This tag used for a child to h1 or w1 or grand son to gm1 or gf1 -->
<IndivName>Child 1 name</IndivName>
<Gender>Male</Gender>
<AssocIndiv>
<Link Target="IndividualRec" Ref="IN004"/>
<Association>Father</Association>
</AssocIndiv>
<AssocIndiv>
<Link Target="IndividualRec" Ref="IN005"/>
<Association>Mother</Association>
</AssocIndiv>
</IndividualRec>
<IndividualRec Id="IN007"> <!-- This tag used for grand mother -->
<IndivName>Grand mother's name</IndivName>
<Gender>Female</Gender>
<AssocIndiv>
<Link Target="IndividualRec" Ref="IN008"/>
<Association>Husband</Association>
</AssocIndiv>
</IndividualRec>
<IndividualRec Id="IN008"> <!-- This tag used for grand father -->
<IndivName>Grand father's name</IndivName>
<Gender>Male</Gender>
<AssocIndiv>
<Link Target="IndividualRec" Ref="IN007"/>
<Association>Grand Father's Wife</Association>
</AssocIndiv>
</IndividualRec>
<IndividualRec Id="IN009"> <!-- This tag used for a child to h1 or w1 or grand son to gm1 or gf1 -->
<IndivName>Child 1 name</IndivName>
<Gender>Male</Gender>
<AssocIndiv>
<Link Target="IndividualRec" Ref="IN007"/>
<Association>Father</Association>
</AssocIndiv>
<AssocIndiv>
<Link Target="IndividualRec" Ref="IN008"/>
<Association>Mother</Association>
</AssocIndiv>
</IndividualRec>
</GEDCOM>
*示例输出:* 一对堂兄的示例输出是 IN006 和 IN009
问候费里德