Error inserting data into typed XML (Much less code to look at than other posts of mine)

  • This is the schema I am using.

    CREATE

    XML SCHEMA COLLECTION TestSchemaCollection AS

    N'<?xml version="1.0" encoding="UTF-16"?>

    <xsd:schema targetNamespace="BuySideStaff"

    xmlns ="BuySideStaff" 

    elementFormDefault="qualified" 

    attributeFormDefault="unqualified"

    xmlns:xsd="http://www.w3.org/2001/XMLSchema" >

         <xsd:element name="TestDefinition1" type="xsd:string" />

         <xsd:element name="TestDefinitionID1" type="xsd:integer" />

         <xsd:element name="TestValue1" type="xsd:string" />

    </xsd:schema>'

    I try to insert a row using this command:

    INSERT

    INTO T1 (col1,col2)

    SELECT

    14538 AS PeopleID, '<TestDefinition1>Genesis</TestDefinition1>

    <TestDefinitionID1>81</TestDefinitionID1>

    <TestValue1>2000 One on One</TestValue1>'

    AS CDFXML

    And I get this error:

    Msg 6913, Level 16, State 1, Line 1

    XML Validation: Declaration not found for element 'TestDefinition1'. Location: /*:TestDefinition1[1]

    Why do I get this error?  Is my XML not formed properly?  Or is the schema wrong?

     

    Robert W. Marda
    Billing and OSS Specialist - SQL Programmer
    MCL Systems

  • This was removed by the editor as SPAM

  • Can you please list the definition for the "T1" table.

     

  • John Jakob:

    Thanks for responding to my inquiry.  Please forgive me for not replying sooner.  I think I found the answer soon after I posted the question and that launched me into a whole new set of XML things to learn that kept me very busy.

     

    For anyone else who runs into the same problem.  I learned that I had to provide the namespace name as an attribute in the XML I was trying to insert and then it would accept it.

    Robert W. Marda
    Billing and OSS Specialist - SQL Programmer
    MCL Systems

Viewing 4 posts - 1 through 3 (of 3 total)

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