Friday, March 30, 2012

How to create Schema with FOR XML EXPLICIT option?

Hi,
i have this query:
SELECT 1 as Tag, NULL as Parent,
nomecampo as [label!1!for],
etichetta as [label!1!],
null as [input!2!id],
null as [input!2!type],
null as [input!2!name],
null as [input!2!value]
FROM t_campiaree
UNION ALL
select 2 as tag,
0 as parent,
null as [label!2!for],
null as [label!2!],
id as [input!2!id],
tipointerfaccia as [input!2!type],
nomecampo as [input!2!name],
'' [input!2!value]
from t_campiaree
FOR XML EXPLICIT
and the results is this:
<label for=3D"nome">Nome</label>
<label for=3D"cognome">Cognome</label>
<label for=3D"eta">Et=E0</label>
<input id=3D"1" type=3D"input" name=3D"nome" value=3D"" />
<input id=3D"2" type=3D"input" name=3D"cognome" value=3D"" />
<input id=3D"3" type=3D"input" name=3D"eta" value=3D"" />
now, how i can create schema for this xml file?
the XMLSCHEMA option don't work with EXPLICIT mode right?Hello maurox,

> the XMLSCHEMA option don't work with EXPLICIT mode right?
Nope, not yet anyway. If you can save the query results to a file and if
you have the .NET SDK installed, you can use XSD.EXE to infer a schema.
Thank you,
Kent Tegels
DevelopMentor
http://staff.develop.com/ktegels/|||thank kent.

>Nope, not yet anyway. If you can save the query results to a file and if
>you have the .NET SDK installed, you can use XSD.EXE to infer a schema.
it is the only solution?
i try with xsd.exe but i don't know how set the type of each
attribute..(i.e. attribute 'id' is integer but in the schema generated
is string)...sql

No comments:

Post a Comment