Monday, March 26, 2012

How create XMLSXHEMA with FOR XML EXPLICIT

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],
(seleas [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?Since you already know the structure that you want, best is to create your
XML Schema a priori using for example the VisualStudio schema designer. You
can even use an example document to infer much of the schema structure...
Best regards
Michael
"maurox" <mrago@.inwind.it> wrote in message
news:1141917666.744839.229840@.j33g2000cwa.googlegroups.com...
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],
(seleas [input!2!value]
from t_campiaree
FOR XML EXPLICIT
and the results is this:
<label for="nome">Nome</label>
<label for="cognome">Cognome</label>
<label for="eta">Et</label>
<input id="1" type="input" name="nome" value="" />
<input id="2" type="input" name="cognome" value="" />
<input id="3" type="input" name="eta" value="" />
now, how i can create schema for this xml file?
the XMLSCHEMA option don't work with EXPLICIT mode right?

No comments:

Post a Comment