Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Update

Status
Not open for further replies.

dBjason

Programmer
Mar 25, 2005
355
US
Hello,

I'm a complete noob with XML. Here's what I'm trying to do:



UPDATE ltrVars SET LetterVarXML = '<xml version="1.0" encoding="utf-8" standalone="yes"?>
<LetterVariables>
<Occupant>
<VarType>Text</VarType>
<Name></Name>
</Occupant>
<AccidentDate>
<VarType>DateTime</VarType>
<Date></Date>
</AccidentDate>
<InjuryAmount>
<VarType>Currency</VarType>
<Amount></Amount>
</InjuryAmount>
</LetterVariabels>'

WHERE VarPK = 1


...But I keep getting this:
Msg 9410, Level 16, State 1, Line 4
XML parsing: line 1, character 53, whitespace expected


Google has been of no help whatsoever. Any help or direction would be greatly appreciated.

Thanks,
Jason
 
Obviously the TSQL parser/XML parser is complaining about your XML. While playing with this, I discovered 2 problems that I will highlight below.

Code:
UPDATE ltrVars SET LetterVarXML = '<[!]?[/!]xml version="1.0" encoding="utf-8" standalone="yes"?>
<LetterVariables>
    <Occupant>
        <VarType>Text</VarType>
        <Name></Name>
    </Occupant>
    <AccidentDate>
        <VarType>DateTime</VarType>
        <Date></Date>
    </AccidentDate>
    <InjuryAmount>
        <VarType>Currency</VarType>
        <Amount></Amount>
    </InjuryAmount>
</LetterVariab[!]le[/!]s>'

WHERE VarPK = 1

You were missing a ? in the first line of XML and LetterVariables was misspelled in the last line.

-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
My ability to hose up a query is only surpassed by my ability to generate typos.

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top