Home All Groups Group Topic Archive Search About

FOR XML AUTO, ELEMENTS Problem

Author
7 Sep 2006 3:33 PM
Amos Soma
I have a column ('ProblemResolution') in a table ('Incident') that holds
plain text. I am doing a query against that column and converting the
results to XML as follows:

Select ProblemResolution From Incident Where RowID = 2 FOR XML AUTO,
ELEMENTS

The problem is the XML that is being generated. It appears the XML that is
generated is illegal (in some cases) because if I save the resulting XML in
a text file and load into Internet Explorer, IE generates errors.

Here is the plain text (actually part of it - enough to demo the problem) as
stored in the column. The quotes are not stored.

"8/11/2006 dabonder -
Carol -

Thanks for the detail. I looked at the 6060 transaction and it was as you
thought - these accounts are not set up in the .|
If the corresponding project account to 6060 would never be used in a time
sheet or expense report then you would not need to have a.
I haven't had time to clarify this. If you want to discuss when you get time
I would be happy to.

-D Abonder

D Abonder
Director of Consulting
Some Company
www.SomeCompany.com

Email: dgon***@somecompany.com
Phone: 123-555-3450"

Here is the generated (illegal) XML:

<Incident><ProblemResolution>8/11/2006 dabonder -&#x0D;
&#x0D;
Carol -&#x0D;
&#x0D;
Thanks for the detail.  I looked at the 6060 transaction and it was as you
thought - these accounts are not set up in the .&#x0D;
&#x0D;
If the corresponding project account to 6060 would never be used in a time
sheet or expense report then you would not need to have a.&#x0D;
&#x0D;
I haven&apos;t had time to clarify this. If you want to discuss when you get
time I would be happy to.&#x0D;
&#x0D;
-D Abonder&#x0D;
&#x0D;
D Abonder&#x0D;
Director of Consulting&#x0D;
Some Company&#x0D;
www.SomeCompany.com&#x0D;
&#x0D;
Email: dgon***@somecompany.com&#x0D;
Phone: 123-555-3450</ProblemResolution></Incident>

Author
7 Sep 2006 4:14 PM
Mark Stricker
You may have to add an xml header to the file including the xml version:

<?xml version = 2.0?>. 

The header of the xml file can also include namespaces.  Finally, you may
want to add the ROOT keyword to your SQL to generate a ROOT element to make
it into a legal XML file:

Select ProblemResolution From Incident Where RowID = 2 FOR XML AUTO,
ELEMENTS, ROOT('Incident')


--
Mark Stricker


Show quote
"Amos Soma" wrote:

> I have a column ('ProblemResolution') in a table ('Incident') that holds
> plain text. I am doing a query against that column and converting the
> results to XML as follows:
>
> Select ProblemResolution From Incident Where RowID = 2 FOR XML AUTO,
> ELEMENTS
>
> The problem is the XML that is being generated. It appears the XML that is
> generated is illegal (in some cases) because if I save the resulting XML in
> a text file and load into Internet Explorer, IE generates errors.
>
> Here is the plain text (actually part of it - enough to demo the problem) as
> stored in the column. The quotes are not stored.
>
> "8/11/2006 dabonder -
> Carol -
>
> Thanks for the detail. I looked at the 6060 transaction and it was as you
> thought - these accounts are not set up in the .|
> If the corresponding project account to 6060 would never be used in a time
> sheet or expense report then you would not need to have a.
> I haven't had time to clarify this. If you want to discuss when you get time
> I would be happy to.
>
> -D Abonder
>
> D Abonder
> Director of Consulting
> Some Company
> www.SomeCompany.com
>
> Email: dgon***@somecompany.com
> Phone: 123-555-3450"
>
> Here is the generated (illegal) XML:
>
> <Incident><ProblemResolution>8/11/2006 dabonder -

>

> Carol -

>

> Thanks for the detail.  I looked at the 6060 transaction and it was as you
> thought - these accounts are not set up in the .

>

> If the corresponding project account to 6060 would never be used in a time
> sheet or expense report then you would not need to have a.

>

> I haven&apos;t had time to clarify this. If you want to discuss when you get
> time I would be happy to.

>

> -D Abonder

>

>  D Abonder

> Director of Consulting

> Some Company

> www.SomeCompany.com



> Email: dgon***@somecompany.com

> Phone: 123-555-3450</ProblemResolution></Incident>
>
>
>
Author
7 Sep 2006 5:07 PM
Amos Soma
Thanks Mark but that isn't the problem. The problem seems to be related to
the fact that there is an apostrophe in the text and a couple '-'
characters. If I remove those, IE has no problem.

Show quote
"Mark Stricker" <MarkStric***@discussions.microsoft.com> wrote in message
news:0BE21A54-9F63-4E40-8198-D9751EBAFBD3@microsoft.com...
> You may have to add an xml header to the file including the xml version:
>
> <?xml version = 2.0?>.
>
> The header of the xml file can also include namespaces.  Finally, you may
> want to add the ROOT keyword to your SQL to generate a ROOT element to
> make
> it into a legal XML file:
>
> Select ProblemResolution From Incident Where RowID = 2 FOR XML AUTO,
> ELEMENTS, ROOT('Incident')
>
>
> --
> Mark Stricker
>
>
> "Amos Soma" wrote:
>
>> I have a column ('ProblemResolution') in a table ('Incident') that holds
>> plain text. I am doing a query against that column and converting the
>> results to XML as follows:
>>
>> Select ProblemResolution From Incident Where RowID = 2 FOR XML AUTO,
>> ELEMENTS
>>
>> The problem is the XML that is being generated. It appears the XML that
>> is
>> generated is illegal (in some cases) because if I save the resulting XML
>> in
>> a text file and load into Internet Explorer, IE generates errors.
>>
>> Here is the plain text (actually part of it - enough to demo the problem)
>> as
>> stored in the column. The quotes are not stored.
>>
>> "8/11/2006 dabonder -
>> Carol -
>>
>> Thanks for the detail. I looked at the 6060 transaction and it was as you
>> thought - these accounts are not set up in the .|
>> If the corresponding project account to 6060 would never be used in a
>> time
>> sheet or expense report then you would not need to have a.
>> I haven't had time to clarify this. If you want to discuss when you get
>> time
>> I would be happy to.
>>
>> -D Abonder
>>
>> D Abonder
>> Director of Consulting
>> Some Company
>> www.SomeCompany.com
>>
>> Email: dgon***@somecompany.com
>> Phone: 123-555-3450"
>>
>> Here is the generated (illegal) XML:
>>
>> <Incident><ProblemResolution>8/11/2006 dabonder -
>>
>> Carol -
>>
>> Thanks for the detail.  I looked at the 6060 transaction and it was as
>> you
>> thought - these accounts are not set up in the .
>>
>> If the corresponding project account to 6060 would never be used in a
>> time
>> sheet or expense report then you would not need to have a.
>>
>> I haven&apos;t had time to clarify this. If you want to discuss when you
>> get
>> time I would be happy to.
>>
>> -D Abonder
>>
>>  D Abonder
>> Director of Consulting
>> Some Company
>> www.SomeCompany.com
>>
>> Email: dgon***@somecompany.com
>> Phone: 123-555-3450</ProblemResolution></Incident>
>>
>>
>>

AddThis Social Bookmark Button