Source:
<row>
<col_a>5</col_a>
<col_b>7</col_b>
<col_c>9</col_c>
</row>
Target:
<row>
<col_a>5</col_a>
<col_b Changed="Y">10</col_b>
<col_c Changed="Y">11</col_c>
</row>
Is there any method(s) to add attribute(s) into xml tags as above example?
ABC wrote:
> <row>
> <col_a>5</col_a>
> <col_b Changed="Y">10</col_b>
> <col_c Changed="Y">11</col_c>
> </row>
>
> Is there any method(s) to add attribute(s) into xml tags as above example?
Yes, use the XML method modify and the insert statement:
DECLARE @.x xml;
SET @.x = '<row>
<col_a>5</col_a>
<col_b>7</col_b>
<col_c>9</col_c>
</row>';
SET @.x.modify('
replace value of (row/col_b/text())[1]
with 10
');
SET @.x.modify('
insert attribute Changed {"Y"}
into (row/col_b)[1]
');
SELECT @.x;
Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/
Showing posts with label tags. Show all posts
Showing posts with label tags. Show all posts
Wednesday, March 7, 2012
How to add an attribute to xml tags?
Source:
<row>
<col_a>5</col_a>
<col_b>7</col_b>
<col_c>9</col_c>
</row>
Target:
<row>
<col_a>5</col_a>
<col_b Changed="Y">10</col_b>
<col_c Changed="Y">11</col_c>
</row>
Is there any method(s) to add attribute(s) into xml tags as above example?ABC wrote:
> <row>
> <col_a>5</col_a>
> <col_b Changed="Y">10</col_b>
> <col_c Changed="Y">11</col_c>
> </row>
>
> Is there any method(s) to add attribute(s) into xml tags as above example?
Yes, use the XML method modify and the insert statement:
DECLARE @.x xml;
SET @.x = '<row>
<col_a>5</col_a>
<col_b>7</col_b>
<col_c>9</col_c>
</row>';
SET @.x.modify('
replace value of (row/col_b/text())[1]
with 10
');
SET @.x.modify('
insert attribute Changed {"Y"}
into (row/col_b)[1]
');
SELECT @.x;
Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/
<row>
<col_a>5</col_a>
<col_b>7</col_b>
<col_c>9</col_c>
</row>
Target:
<row>
<col_a>5</col_a>
<col_b Changed="Y">10</col_b>
<col_c Changed="Y">11</col_c>
</row>
Is there any method(s) to add attribute(s) into xml tags as above example?ABC wrote:
> <row>
> <col_a>5</col_a>
> <col_b Changed="Y">10</col_b>
> <col_c Changed="Y">11</col_c>
> </row>
>
> Is there any method(s) to add attribute(s) into xml tags as above example?
Yes, use the XML method modify and the insert statement:
DECLARE @.x xml;
SET @.x = '<row>
<col_a>5</col_a>
<col_b>7</col_b>
<col_c>9</col_c>
</row>';
SET @.x.modify('
replace value of (row/col_b/text())[1]
with 10
');
SET @.x.modify('
insert attribute Changed {"Y"}
into (row/col_b)[1]
');
SELECT @.x;
Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/
Friday, February 24, 2012
How to add a field containing HTML to be properly rendered
I have a database notes field, which contains the text with some html
elements (fonts, styles, etc). If I add it to the report all html tags come
in plain text. Is there a way to render the field text as html? If not is
there a simple way to strip off all html tags?There is not a way to show as html. To strip off the html I believe there is
a framework function that you could use. Set the value of the textbox to an
expression like this:
= Code.StripHTML(Fields!Fieldname.value)
You would write the function StripHTML that would return the value with the
html striped.
This link shows how to do this using regular expressions.
http://weblogs.asp.net/rosherove/archive/2003/05/13/6963.aspx
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Alex Ch" <Alex Ch@.discussions.microsoft.com> wrote in message
news:ADDDE0F6-2DD0-49EC-875B-99694EB61BC0@.microsoft.com...
>I have a database notes field, which contains the text with some html
> elements (fonts, styles, etc). If I add it to the report all html tags
> come
> in plain text. Is there a way to render the field text as html? If not is
> there a simple way to strip off all html tags?
elements (fonts, styles, etc). If I add it to the report all html tags come
in plain text. Is there a way to render the field text as html? If not is
there a simple way to strip off all html tags?There is not a way to show as html. To strip off the html I believe there is
a framework function that you could use. Set the value of the textbox to an
expression like this:
= Code.StripHTML(Fields!Fieldname.value)
You would write the function StripHTML that would return the value with the
html striped.
This link shows how to do this using regular expressions.
http://weblogs.asp.net/rosherove/archive/2003/05/13/6963.aspx
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Alex Ch" <Alex Ch@.discussions.microsoft.com> wrote in message
news:ADDDE0F6-2DD0-49EC-875B-99694EB61BC0@.microsoft.com...
>I have a database notes field, which contains the text with some html
> elements (fonts, styles, etc). If I add it to the report all html tags
> come
> in plain text. Is there a way to render the field text as html? If not is
> there a simple way to strip off all html tags?
Subscribe to:
Posts (Atom)