Reusing XSD information for full and update record

Discussion in 'XML' started by Greg, Jul 9, 2009.

  1. Greg

    Greg Guest

    Hi everyone!

    I want to exchange full and partial records with XML. Example:

    <person>
    <id>12</id>
    <lastname>Miller</lastname>
    <firstname>Bob</firstname>
    </person>

    Another type of element to change that record's person's first name:

    <personUpdate>
    <id>12</id>
    <firstname>John</firstname>
    </personUpdate>

    So in the full record, all elements must be present, while the update
    version only has to contain the id, and everything else is optional
    (well, there should be at least one element).

    In the schema definition, I don't have to have different element types
    for a full record and an update record, but I'm doing that right now,
    with the same sequence of child elements (id, lastname, firstname), only
    that in the update version, there is minOccurs=0 maxOccurs=1 for
    everything but the id while in the full version both attributes are 1 to
    make all elements mandatory.

    Is there a better way to express this? Whenever fields are added,
    removed or modified I have to edit .xsd files in two places, the type of
    the full and the update record. This is error-prone.

    Thanks in advance!
    Greg, Jul 9, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bernd Oninger
    Replies:
    1
    Views:
    524
    Henry S. Thompson
    Jun 30, 2004
  2. pauld
    Replies:
    2
    Views:
    1,018
    pauld
    Jun 3, 2008
  3. Replies:
    0
    Views:
    303
  4. Jimmy Tran
    Replies:
    1
    Views:
    233
    Dan Brussee
    Oct 3, 2003
  5. Maximus
    Replies:
    2
    Views:
    193
    Bob Barrows [MVP]
    Apr 12, 2007
Loading...

Share This Page