Xml schema won't validate

  • Help! I've created a simple XML schema, required all the attributes, and when I go to validate it with an XML variable, it tells me that I'm missing a required attribute when I'm not... I'm so CONFUSED.

    Help appreciated. Code pasted below:

    CREATE XML SCHEMA COLLECTION ClaimPymtCalcDetails AS '

    '

    --The above uploads fine "Command(s) completed successfully"

    --I'm using random values in the below just to validate the schema

    --collection

    Declare @MyXML as XML (ClaimPymtCalcDetails)

    Set @MyXML = '

    '

    --The error message I get is:

    --Msg 6906, Level 16, State 1, Line 2

    --XML Validation: Required attribute 'SettlementAmt' is missing.

    --Location: /*:ClmCalcDetails[1]

    Thing is, if I remove the 'use="required"' statement from SettlementAmt, it then complains about a total different attribute with the same error message.

    Does anyone have any idea what is wrong? I've counted to make sure I have all my attributes, I've done a side-by-side compare to make sure they're all in the same order, I've verified the datatypes compared to the values I'm trying to stick in.

    HELP! Thanks in advance.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • I couldnot see your schema and xml in your post. So not sure what's happening

  • Well, gosh darnit! The webpage probably parsed it funny... And I forgot to preview it.. Let me try again.

    Hmmm, double-quotes won't work. I'm going to try to attach a text file here with the code in it and see if that works.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • WHOOHOO! Text file worked. At least, it opens for me and displays my code correctly. Let me know if you can't see it.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • Your schema requires more than 10 attributes. Your document has elements.

    <ClmCalcDetails LendPayoff="1.00" CLRefund="2.00"

    .... with other elements as attributes here ...

    ></ClmCalcDetails>

    Russel Loski, MCSE Business Intelligence, Data Platform

  • Oh, DUH! I thought I had to list the attributes separately with an open & close....

    Thanks. I'll try again. @=)

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply