Results 1 to 6 of 6

Thread: XML Schema

  1. #1
    Join Date
    May 2012
    Posts
    4

    Unanswered: XML Schema

    I have designed an XML schema in which defines the data structures expected in an xml file that our software will import. This is used to validate the files.

    The current problem is that the validation passes any correctly formatted xml file that does not contain any of our data structures. Is it possible to put something in the schema that says that at least one instance of our toplevel datatype must be included in the file?. I know using minOccurs="1" but I can only see how to use with a definition of a datatype - not the xml file itself.

    Thanks

  2. #2
    Join Date
    May 2012
    Posts
    4
    ...or can someone suggest a more appropriate place for this question ?
    Thanks

  3. #3
    Join Date
    Oct 2009
    Location
    221B Baker St.
    Posts
    486
    This is probably as good as anyplace on this forum.

    Why is there data that is other than the data structures you want? Hopefully, the file can be set up to be empty or contain only "your" data.

  4. #4
    Join Date
    May 2012
    Posts
    4
    Somebody used a simple XML file from a different system and tried to validate it with my schema and it passed - because it contained no data structures that were defined in the schema. I wondered if the schema can be modified to detect this situation.

    I can modify my import code to report when the file contains no relevant data - but I would really like the schema to catch this situation when the file is validated using a standard Microsoft validation function.

  5. #5
    Join Date
    Oct 2009
    Location
    221B Baker St.
    Posts
    486

    ensuring xml contains usable data

    Suggest you modify the import to ensure there something usable in the input. This will give you more control if the "rules" ever change.

  6. #6
    Join Date
    May 2012
    Posts
    4
    Yes, I've done that now. Shame it can't be done in the schema though.
    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •