Adding a new unique key to a schema.
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 1
- Joined: Sun May 13, 2018 1:52 am
Adding a new unique key to a schema.
Post by babynapoleon »
Hello,
I have a load of large XML files that I need to process into a database on a continual basis. The XML schema is not great as I can't use the "key" to link the data together because it doesnt extend through the elements. I have tried to add a unique identifier to the schema with Oxygen and I can't
The "Keys" element is not linked through the schema so the data doesnt relate properly in a database; please can you give me a hand figuring out what to do with this schema as it is causing me big problems
Thank you so much for helping and for your advice.
Here is the schema:
I have a load of large XML files that I need to process into a database on a continual basis. The XML schema is not great as I can't use the "key" to link the data together because it doesnt extend through the elements. I have tried to add a unique identifier to the schema with Oxygen and I can't

The "Keys" element is not linked through the schema so the data doesnt relate properly in a database; please can you give me a hand figuring out what to do with this schema as it is causing me big problems

Thank you so much for helping and for your advice.
Here is the schema:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="persons">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="person"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element ref="keys"/>
<xs:element ref="sex"/>
<xs:element ref="names"/>
<xs:element minOccurs="0" ref="cb"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="mm"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="pb"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="fm"/>
<xs:element minOccurs="0" ref="bb"/>
<xs:element minOccurs="0" ref="literacy"/>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="pbb"/>
<xs:element minOccurs="0" ref="sbb"/>
<xs:element minOccurs="0" ref="trades"/>
<xs:element minOccurs="0" ref="abodes"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="keys">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="key"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="key" type="xs:NCName"/>
<xs:element name="sex" type="xs:string"/>
<xs:element name="names">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="name"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="name">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="prename"/>
<xs:element ref="surname"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="cb">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="father-name"/>
<xs:element minOccurs="0" ref="mother-name"/>
<xs:element minOccurs="0" ref="year-of-birth"/>
<xs:element minOccurs="0" ref="year-of-baptism"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="father-name">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="prename"/>
<xs:element ref="surname"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="mother-name">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="prename"/>
<xs:element ref="surname"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="mm">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="spouse-name"/>
<xs:element ref="year-of-marriage"/>
<xs:element minOccurs="0" ref="age-at-marriage"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="age-at-marriage" type="xs:integer"/>
<xs:element name="pb">
<xs:complexType>
<xs:sequence>
<xs:element ref="spouse-name"/>
<xs:element ref="child-name"/>
<xs:element minOccurs="0" ref="year-of-birth"/>
<xs:element minOccurs="0" ref="year-of-baptism"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="fm">
<xs:complexType>
<xs:sequence>
<xs:element ref="child-name"/>
<xs:element ref="year-of-marriage"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="bb">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="spouse-name"/>
<xs:element minOccurs="0" ref="year-of-death"/>
<xs:element ref="year-of-burial"/>
<xs:element minOccurs="0" ref="age-at-death"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="age-at-death" type="xs:integer"/>
<xs:element name="literacy">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="literate"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="literate">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:boolean">
<xs:attribute name="date" use="required" type="xs:NMTOKEN"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="pbb">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="spouse-name"/>
<xs:element ref="child-name"/>
<xs:element minOccurs="0" ref="year-of-death"/>
<xs:element ref="year-of-burial"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="sbb">
<xs:complexType>
<xs:sequence>
<xs:element ref="spouse-name"/>
<xs:element minOccurs="0" ref="year-of-death"/>
<xs:element ref="year-of-burial"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="trades">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="trade"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="trade">
<xs:complexType mixed="true">
<xs:attribute name="date" use="required" type="xs:NMTOKEN"/>
</xs:complexType>
</xs:element>
<xs:element name="abodes">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="abode"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="abode">
<xs:complexType mixed="true">
<xs:attribute name="country"/>
<xs:attribute name="county"/>
<xs:attribute name="date" use="required" type="xs:NMTOKEN"/>
<xs:attribute name="house"/>
<xs:attribute name="locale"/>
<xs:attribute name="town"/>
<xs:attribute name="village"/>
<xs:attribute name="way"/>
</xs:complexType>
</xs:element>
<xs:element name="prename" type="xs:NCName"/>
<xs:element name="surname">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:NCName">
<xs:attribute name="alias" type="xs:NCName"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<xs:element name="year-of-birth" type="xs:integer"/>
<xs:element name="year-of-baptism" type="xs:integer"/>
<xs:element name="spouse-name">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="prename"/>
<xs:element minOccurs="0" ref="surname"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="year-of-marriage" type="xs:integer"/>
<xs:element name="child-name">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" ref="prename"/>
<xs:element ref="surname"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="year-of-death" type="xs:integer"/>
<xs:element name="year-of-burial" type="xs:integer"/>
</xs:schema>
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service