Creating tags that reference an external XSD element with FOR XML EXPLICIT

Creating tags that reference an external XSD element with FOR XML EXPLICIT

Post by Marc Espi » Sun, 23 Jun 2002 02:27:23



I am having a problem creating tags whose syntax represent
an element from an XSD other than the XSD used to create
the XML.  In other words, one of my tags needs to be:
<nggs:GameNum>
When I run my stored procedure in Query Analyzer, the
resulting XML shows the correct tag (<nggs:GameNum>).  
However, in my ActiveX script, when I run the stored
procedure and load it into a DOM tree, then write it to a
file, the file is empty.  If I remove the 'nggs:' portion
of the tag in my store procedure, so that the tag is
simply <GameNum>, the DOM tree gets loaded and the
resulting file is created correctly.  Has anyone seen
this?  If so, how can I work around it?  Thanks in advance.
Marc Espin

 
 
 

Creating tags that reference an external XSD element with FOR XML EXPLICIT

Post by Bryant Like » Wed, 26 Jun 2002 06:45:58



[snip]

Quote:> When I run my stored procedure in Query Analyzer, the
> resulting XML shows the correct tag (<nggs:GameNum>).
> However, in my ActiveX script, when I run the stored
> procedure and load it into a DOM tree, then write it to a
> file, the file is empty.  If I remove the 'nggs:' portion
> of the tag in my store procedure, so that the tag is
> simply <GameNum>, the DOM tree gets loaded and the
> resulting file is created correctly.  Has anyone seen
> this?  If so, how can I work around it?

Does your resulting XML contain the namespace declaration for the nggs
namespace?

Also you can find why it isn't loaded by checking the contents of
DOM.parseError.reason to see the reason it was unable to load your XML.

--
Bryant

 
 
 

Creating tags that reference an external XSD element with FOR XML EXPLICIT

Post by Vikrant V Dalwale [M » Wed, 26 Jun 2002 10:06:27


For best answers Please redirect this post to XML:MSXML-WebRelease.

Thanks,

Vikrant Dalwale

Microsoft SQL Server Support Professional

This posting is provided "AS IS" with no warranties, and confers no rights.
Get secure ! For info, please visit http://www.microsoft.com/security.
Please reply to Newsgroups only.

--------------------

>Content-Class: urn:content-classes:message


>Subject: Creating tags that reference an external XSD element with FOR XML
EXPLICIT
>Date: Fri, 21 Jun 2002 10:27:23 -0700
>Lines: 15

>MIME-Version: 1.0
>Content-Type: text/plain;
>    charset="iso-8859-1"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Thread-Index: AcIZSOeBK4h/3sNPTu2W1gdp6KHzRg==
>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>Newsgroups: microsoft.public.sqlserver.xml
>NNTP-Posting-Host: TKMSFTNGXA11 10.201.226.39
>Path: cpmsftngxa08!cpmsftngxa07
>Xref: cpmsftngxa08 microsoft.public.sqlserver.xml:13752
>X-Tomcat-NG: microsoft.public.sqlserver.xml

>I am having a problem creating tags whose syntax represent
>an element from an XSD other than the XSD used to create
>the XML.  In other words, one of my tags needs to be:
><nggs:GameNum>
>When I run my stored procedure in Query Analyzer, the
>resulting XML shows the correct tag (<nggs:GameNum>).  
>However, in my ActiveX script, when I run the stored
>procedure and load it into a DOM tree, then write it to a
>file, the file is empty.  If I remove the 'nggs:' portion
>of the tag in my store procedure, so that the tag is
>simply <GameNum>, the DOM tree gets loaded and the
>resulting file is created correctly.  Has anyone seen
>this?  If so, how can I work around it?  Thanks in advance.
>Marc Espin


 
 
 

1. Creating an annotated XSD schema from a FOR XML EXPLICIT sproc

Hi-
Is there any tool or method that can be used to generate
an annotated XSD schema (including relations gleaned from
JOIN statements) from a FOR XML EXPLICIT stored procedure,
in much the same way as you can drag and drop a SQL 2000
database table onto the designer surface of a new dataset
in VS.NET and have it create the underlying XSD schema?

If it's possible, I'd then like to use that XSD schema to
directly pull data from SQL Server, bypassing any FOR XML
sql.  I believe I've seen that this can be done via the
SqlXml classes for .NET.

My FOR XML query pulls together an HTML form in XML format
stored in fragments in four tables.  The Form table holds
general info, like the title and description of the form,
FormField holds the various fields associated with a given
form, FormList holds the individual elements associated
with individual form fields like listboxes and radio
buttons, and the Code table holds the names of the types
of form elements (Textbox, Checkbox, etc.):

SELECT
   1 AS TAG, NULL AS PARENT,
   f.Form_ID AS 'FormFields!1!ID',
   f.Form_Name AS 'FormFields!1!Name',
   NULL AS 'FormField!2!ID',
   NULL AS 'FormField!2!Order',
   NULL AS 'FormField!2!Type',
   NULL AS 'FormField!2!Label',
   NULL AS 'FormAnswer!3!ID',
   NULL AS 'FormAnswer!3!Value'
FROM Form f

UNION ALL
SELECT
   2, 1,
   NULL,
   NULL,
   FormField.FormFld_ID,
   FormField.FormFld_Order,
   Code.Code_Name,
   FormField.FormFld_Label,
   NULL,
   NULL
FROM FormField
INNER JOIN Code ON FormField.FKFormFldType_ID =
Code.Code_ID

UNION ALL
SELECT
   3, 2,
   NULL,
   NULL,
   FormField.FormFld_ID,
   NULL,
   NULL,
   NULL,
   FormList.FormList_ID,
   FormList.FormList_Value
FROM FormList
INNER JOIN FormField ON FormField.FormFld_ID =
FormList.FKFormFld_ID

ORDER BY  'FormField!2!ID', TAG
FOR XML EXPLICIT

Thanks for any help,

Cono

2. test

3. XSD mapping schema or XML EXPLICIT?

4. Connecting Provision Win95 v.8 to Progress DB v.7

5. Documentation comparing SQL's FOR XML EXPLICIT and SQLXML 2.0 XSD schema relationships

6. TERM_INGRES and CDE

7. Performance Comparision of XSD schema and relationships Vs FOR XML EXPLICIT

8. GSB/U of Chicago seeks CA-Ingres/ABF/C programmer (CA-OpenROAD a plus)

9. XML Explicit - NULL Values Hide element

10. FOR XML EXPLICIT - No Element if Null?

11. FOR XML EXPLICIT --> Element centric

12. help with XML explicit with >1 child elements

13. FOR XML EXPLICIT and Element nesting