Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6836087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:18:47+00:00 2026-05-26T23:18:47+00:00

How to correctly define an element in XML schema representing a primary key implemented

  • 0

How to correctly define an element in XML schema representing a primary key implemented as autoincrementing integer number in a database table?

For example, consider table:

Person (
 person_id int identity primary key,
 person_name nvarchar(64) null
)

On one hand the XML schema should enforce the key person_id element (I suppose minOccurs=1, nillable=false). On the other hand new documents (yet to be persisted) should validate without the person_id element.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:18:47+00:00Added an answer on May 26, 2026 at 11:18 pm

    Do you have to use the same schema for inbound and outbound (could these be separate schemas)?

    Assuming the answer to the first is yes, I’d bet tempted to make the person_id optional – because that’s what it is.

    We have a rules where we use nillable=”true” in the definition of XML elements that should always be present in instances conforming to the schema. Use of xsi:nil allows a processing application to differentiate between XML instances that are unintentionally invalid against a schema, and those which have been constructed and submitted correctly, but that have information missing.

    You could use nillable here, but this seems counter intuitive as really the information (at the point of loading) is not required. I would personally prefer to see two schemas – one for the “request”, one for the “response”.

    Also, what is the business purpose of the schema validation? Is there a reason to have a schema post loading into the database?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mapping from xml schema(number) to copybook, copybook field is a number
I'm generating a table in a pdf document using xml-fo. The number of columns
In using XML Schema 1.1, I'd like to define an attribute group that occurs
I have an XML schema, where element Calling1 is defined like this: <xsd:element name=Calling1
I have the following start of an XSD: <?xml version=1.0 encoding=UTF-8?> <xs:schema xmlns:xs=http://www.w3.org/2001/XMLSchema xmlns:no=http://www.sychophants.com>
I have this schema and i'm using JAXB to generate java stub files. <?xml
I have given the local name of an element or attribute and the schema
I am taking my first steps in XML-schema land, using XSD, and I'm trying
I have a custom XML schema defined for page display that puts elements on
This tutorial shows how to Define a Custom Workflow to Deploy a Database from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.