.net - SqlServer Xml Data Type - How to Force Full End Elements -
i have table in sql server...
[id] [int] identity(1,1) not null, [firstname] [nvarchar](100) null, [lastname] [nvarchar](100) null, [dataitemsxml] [xml] null,
which has xml column. want store xml in column in following format...
<data> <item-1>some data here</item-1> <item-2></item-2> </data>
notice empty element item-2. need store in manner support code cannot modify.
even when pass xml in insert or update statement in format, sql server appears convert empty elements item-2 following...
<data> <item-1>some data here</item-1> <item-2 /> </data>
i understand valid xml, need have sql server store in first format, full end tags elements, empty elements.
i cannot figure out how this.
any ideas? thanks!
sql server preserves content of xml instance, not preserve aspects of xml instance not considered significant in xml data model. means retrieved xml instance might not identical instance stored in server, contain same information.
i can't find options force sql server expand elements wish.
if need store xml rather querying it, could store varchar(max)
field, avoid reparsing. alternatively, if needs actual xml
field, convert text when retrieving it, converting compact representation end-element form using string manipulation. although it's theoretically possible such string manipulation in sql server, it's better idea in clr procedure or in application if can.
Comments
Post a Comment