I have a return of XML that I wish to select using SQL. I don't have a problem selecting from the XML when I specify the index for the element. This is the XML in question.
<root httpStatusCode="200">
<messages />
<succesfulResponses>
<item position="0">
<response dln="TESTDLN" ServiceVersion="1" hubServiceVersion="1.0.0.0" ProcessingDate="2017-11-20T10:42:20.579Z" hubProcessingDate="2017-11-20T10:41:16.5415151Z" httpStatusCode="200">
<licence status="FC" validFrom="2017-03-18" validTo="2024-10-31" directiveIndicator="4">
<entitlements>
<item code="A" validFrom="2006-04-07" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="AM" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions>
<item type="122" info="null" />
</restrictions>
</item>
<item code="B" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions />
</item>
<item code="BE" validFrom="2014-11-01" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="F" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions />
</item>
<item code="G" validFrom="2014-11-01" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="H" validFrom="2014-11-01" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="K" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions />
</item>
<item code="Q" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions>
<item type="122" info="null" />
</restrictions>
</item>
</entitlements>
<endorsements />
</licence>
<messages />
</response>
</item>
</succesfulResponses>
<errorResponses />
</root>
The SQL I have written so far is as follows:
select
Rec.value('(#dln)[1]','char(50)'),
Rec.value('(licence/#status)[1]','char(2)'),
pd.value('(entitlements/item/#code)[1]','char(2)')
FROM #xmlData.nodes('//root/succesfulResponses/item/response') as x(Rec)
cross apply #xmlData.nodes('//root/succesfulResponses/item/response/licence') as i(pd)
This returns the obviously First Row code of 'A', however there can be multiple 'entitlements' and I don't ever know how many there could be 3 there could be 9.
I thought a Cross Apply would work but I can't seem to make that work either.
Any thoughts/help.
Try this - expand the XPath after the CROSS APPLY to include the entitlements/item part:
select
Rec.value('(#dln)[1]','char(50)'),
Rec.value('(licence/#status)[1]','char(2)'),
pd.value('#code', 'char(2)')
FROM
#xmlData.nodes('//root/succesfulResponses/item/response') as x(Rec)
cross apply
#xmlData.nodes('//root/succesfulResponses/item/response/licence/entitlements/item') as i(pd)
Returns:
The variant with OPENXML
DECLARE #idoc int, #doc varchar(MAX)
SET #doc='<root httpStatusCode="200">
<messages />
<succesfulResponses>
<item position="0">
<response dln="TESTDLN" ServiceVersion="1" hubServiceVersion="1.0.0.0" ProcessingDate="2017-11-20T10:42:20.579Z" hubProcessingDate="2017-11-20T10:41:16.5415151Z" httpStatusCode="200">
<licence status="FC" validFrom="2017-03-18" validTo="2024-10-31" directiveIndicator="4">
<entitlements>
<item code="A" validFrom="2006-04-07" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="AM" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions>
<item type="122" info="null" />
</restrictions>
</item>
<item code="B" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions />
</item>
<item code="BE" validFrom="2014-11-01" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="F" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions />
</item>
<item code="G" validFrom="2014-11-01" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="H" validFrom="2014-11-01" validTo="2057-05-20" priorTo="false" type="P">
<restrictions />
</item>
<item code="K" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions />
</item>
<item code="Q" validFrom="2014-10-21" validTo="2057-05-20" priorTo="false" type="F">
<restrictions>
<item type="122" info="null" />
</restrictions>
</item>
</entitlements>
<endorsements />
</licence>
<messages />
</response>
</item>
</succesfulResponses>
<errorResponses />
</root>'
EXEC sp_xml_preparedocument #idoc OUTPUT, #doc;
SELECT *
FROM OPENXML(#idoc,'/root/succesfulResponses/item/response/licence/entitlements/item',2)
WITH (
status varchar(10) '../../#status',
code varchar(10) './#code',
validFrom date './#validFrom'
);
EXEC sp_xml_removedocument #idoc;
GO
Related
'''
<item>
<rotate
android:fromDegrees="45"
android:pivotX="0%"
android:pivotY="100%"
android:toDegrees="0" >
<shape android:shape="rectangle" >
<solid android:color="#color/white" />
</shape>
</rotate>
</item>
<item android:left="20dp">
<shape android:shape="rectangle" >
<solid android:color="#color/white" />
<corners android:radius="10dp" />
</shape>
</item>
'''
I am able to achieve left bottom tilted , but I want curved shaped on the left bottom
This should work
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:right="2dp">
<rotate
android:fromDegrees="15"
android:pivotX="0%"
android:pivotY="100%"
android:toDegrees="0">
<shape android:shape="rectangle">
<corners
android:bottomLeftRadius="0dp"
android:radius="250dp" />
<solid android:color="#color/white" />
</shape>
</rotate>
</item>
<item android:left="5dp">
<shape android:shape="rectangle">
<solid android:color="#color/white" />
<corners android:radius="15dp" />
</shape>
</item>
</layer-list>
Is it possible to remove image preview from UI fileuploder component, without using file component?
here is my code=>
<field name="file">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">TestGroup</item>
<item name="label" xsi:type="string" translate="true">File</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">Vendor_Module/image-preview</item>
<item name="required" xsi:type="boolean">false</item>
<item name="sortOrder" xsi:type="number">40</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="controller/index/upload"/>
</item>
</argument>
</field>
tried by removing item name= elementTmpl and previewTmpl but not working
can anybody help me to disable the image preview for fileupload.
Thanks in Advance.
Remove the src of image every time you click:
$("#input1").click(function () {
$('#imagepreview1').attr('src','');
});
Given the following XML (with many hierarchy levels), I need to return the nodes after filtering all nodes with Hide"True" attribute and a certain name. Note that hide could be at any hierarchy level:
<items>
<item id="1" >
<item id="2" />
<item id="3" />
<item id="4" hide="true"/>
</item>
<item id="5" hide="true">
<item id="6" >
<item id="7">
<item id="8" hide="true"/>
<item id="9"/>
</item>
</item>
</items>
I would need to get this back:
<items>
<item id="1"">
<item id="2" />
<item id="3" />
</item>
<item id="6" >
<item id="7">
<item id="9"/>
</item>
</item>
</items>
The 'filtered' XML is then assigned to a treeview, so I need to preserve the hierarchical nature of the nodes. I have tried: "items//item[#hide='false' or not(#hide)]", but this returns a flattened (as well as duplicative) data, repeating nodes at the lower level pushed up to the top level as follows. Is there a way to use Xpath to do what I want? I understand that I can Xslt the data first, then display it, but it just seems that there is got to be an easier way. I am using c#/.net4.0 MSXML
<items>
<item id="1"">
<item id="2" />
<item id="3" />
</item>
<item id="6" >
<item id="7">
<item id="9"/>
</item>
</item>
<item id="2" />
<item id="3" />
<item id="7">
<item id="9"/>
</item>
<item id="9"/>
</items>
Site is running .NET 4.5, with VB. Uses SQLServer and ELMAH. I use VWD 2012.
Production site works fine, but local development site crashes with error:
"The specified string is not in the form required for an e-mail address."
when trying to load a page in the \Admin folder, which requires login.
The error comes up in VWD on a "Source Not Available" tab as soon as the login screen shows in the browser.
The error details are:
*System.FormatException was unhandled
HResult=-2146233033
Message=The specified string is not in the form required for an e-mail address.
Source=System
StackTrace:
at System.Net.Mail.MailAddressParser.ReadCfwsAndThrowIfIncomplete(String data, Int32 index)
at System.Net.Mail.MailAddressParser.ParseDomain(String data, Int32& index)
at System.Net.Mail.MailAddressParser.ParseAddress(String data, Boolean expectMultipleAddresses, Int32& index)
at System.Net.Mail.MailAddressParser.ParseAddress(String data)
at System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding)
at System.Net.Mail.MailMessage..ctor()
at Elmah.ErrorMailModule.ReportError(Error error)
at Elmah.ErrorMailModule.ReportError(Object state)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
InnerException:*
ELMAH stores the error in the AllXML field as:
<error
application="/VFA4"
host="DAVE-PC"
type="System.Web.HttpException"
message="File does not exist."
source="System.Web"
detail="System.Web.HttpException (0x80004005): File does not exist.
at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response)
at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String overrideVirtualPath)
at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)"
time="2014-01-13T15:15:41.7894004Z"
statusCode="404">
<serverVariables>
<item
name="ALL_HTTP">
<value
string="HTTP_CONNECTION:keep-alive
HTTP_ACCEPT:*/*
HTTP_ACCEPT_ENCODING:gzip, deflate
HTTP_ACCEPT_LANGUAGE:en-US,en;q=0.8
HTTP_COOKIE:.ASPXANONYMOUS=YUThibsmzwEkAAAANWNhZGVjOTItNGQzNS00NmM3LTk3NjYtMTBkODAyYTBiODJhdYxJPubvb1GGRcsjrVicS0N3hCM1; VFA=ID=0&Name=Visitor&ACLSite=0&LoggedIn=false&Profile=0&Greeting=Visitor&Email=; FCOCRV.ASPXAUTH=2EB2E728E7546828599E7059AC071774F1B68DE36945B303364F8DE61A99F4DAEA1378B800DE77E4AD01EDCD1280072326E94CC7F9195A9AE1C8D5B829467129E14E9370F038922195F7D7FC6D7AB38936BBBC59C6C51B406783DA5C6D6567F00CB2B2AF25FD94881D778037C0EB183F8E009861; VFAanon=82GiHFGPKOy-L41M6_huRwSQi3a9FrKsTxn8DLe9u9G-5_4E45PebhWPaRXIcrD75UH17jCEDam8dBaRxfr7MOVXANsTmfdxLNxfGfGsWnq2y7yULGQg7BcCnFVfqmoMWOEp-w2; Violette=bIkdCP9-GSCYa2OhlgT3wakdXVcNXKlK1-VMT5WKlnHquMi7gMk3uIuXuEf87i7KZqH-13GVbwaqNV_7zj-pWgObGgZZPzUING_2tWJGlaLNkM4pUU6ttrVAdjyOn9bjTUBlDw2; __AntiXsrfToken=cde04d3ee0d74a9ba9af775e3dc13bb4
HTTP_HOST:localhost:60825
HTTP_REFERER:http://localhost:60825/VFA4/Account/Login?ReturnUrl=%2fVFA4%2fAdmin%2fAdm-VFAMembers.aspx
HTTP_USER_AGENT:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.72 Safari/537.36
" />
</item>
<item
name="ALL_RAW">
<value
string="Connection: keep-alive
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8
Cookie: .ASPXANONYMOUS=YUThibsmzwEkAAAANWNhZGVjOTItNGQzNS00NmM3LTk3NjYtMTBkODAyYTBiODJhdYxJPubvb1GGRcsjrVicS0N3hCM1; VFA=ID=0&Name=Visitor&ACLSite=0&LoggedIn=false&Profile=0&Greeting=Visitor&Email=; FCOCRV.ASPXAUTH=2EB2E728E7546828599E7059AC071774F1B68DE36945B303364F8DE61A99F4DAEA1378B800DE77E4AD01EDCD1280072326E94CC7F9195A9AE1C8D5B829467129E14E9370F038922195F7D7FC6D7AB38936BBBC59C6C51B406783DA5C6D6567F00CB2B2AF25FD94881D778037C0EB183F8E009861; VFAanon=82GiHFGPKOy-L41M6_huRwSQi3a9FrKsTxn8DLe9u9G-5_4E45PebhWPaRXIcrD75UH17jCEDam8dBaRxfr7MOVXANsTmfdxLNxfGfGsWnq2y7yULGQg7BcCnFVfqmoMWOEp-w2; Violette=bIkdCP9-GSCYa2OhlgT3wakdXVcNXKlK1-VMT5WKlnHquMi7gMk3uIuXuEf87i7KZqH-13GVbwaqNV_7zj-pWgObGgZZPzUING_2tWJGlaLNkM4pUU6ttrVAdjyOn9bjTUBlDw2; __AntiXsrfToken=cde04d3ee0d74a9ba9af775e3dc13bb4
Host: localhost:60825
Referer: http://localhost:60825/VFA4/Account/Login?ReturnUrl=%2fVFA4%2fAdmin%2fAdm-VFAMembers.aspx
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.72 Safari/537.36
" />
</item>
<item
name="APPL_MD_PATH">
<value
string="" />
</item>
<item
name="APPL_PHYSICAL_PATH">
<value
string="C:\inetpub\wwwroot\VFA4\" />
</item>
<item
name="AUTH_TYPE">
<value
string="" />
</item>
<item
name="AUTH_USER">
<value
string="" />
</item>
<item
name="AUTH_PASSWORD">
<value
string="*****" />
</item>
<item
name="LOGON_USER">
<value
string="DAVE-PC\Dave" />
</item>
<item
name="REMOTE_USER">
<value
string="" />
</item>
<item
name="CERT_COOKIE">
<value
string="" />
</item>
<item
name="CERT_FLAGS">
<value
string="" />
</item>
<item
name="CERT_ISSUER">
<value
string="" />
</item>
<item
name="CERT_KEYSIZE">
<value
string="" />
</item>
<item
name="CERT_SECRETKEYSIZE">
<value
string="" />
</item>
<item
name="CERT_SERIALNUMBER">
<value
string="" />
</item>
<item
name="CERT_SERVER_ISSUER">
<value
string="" />
</item>
<item
name="CERT_SERVER_SUBJECT">
<value
string="" />
</item>
<item
name="CERT_SUBJECT">
<value
string="" />
</item>
<item
name="CONTENT_LENGTH">
<value
string="0" />
</item>
<item
name="CONTENT_TYPE">
<value
string="" />
</item>
<item
name="GATEWAY_INTERFACE">
<value
string="" />
</item>
<item
name="HTTPS">
<value
string="" />
</item>
<item
name="HTTPS_KEYSIZE">
<value
string="" />
</item>
<item
name="HTTPS_SECRETKEYSIZE">
<value
string="" />
</item>
<item
name="HTTPS_SERVER_ISSUER">
<value
string="" />
</item>
<item
name="HTTPS_SERVER_SUBJECT">
<value
string="" />
</item>
<item
name="INSTANCE_ID">
<value
string="" />
</item>
<item
name="INSTANCE_META_PATH">
<value
string="" />
</item>
<item
name="LOCAL_ADDR">
<value
string="::1" />
</item>
<item
name="PATH_INFO">
<value
string="/VFA4/Account/Scripts/jquery.flexslider-min.js" />
</item>
<item
name="PATH_TRANSLATED">
<value
string="C:\inetpub\wwwroot\VFA4\Account\Scripts\jquery.flexslider-min.js" />
</item>
<item
name="QUERY_STRING">
<value
string="" />
</item>
<item
name="REMOTE_ADDR">
<value
string="::1" />
</item>
<item
name="REMOTE_HOST">
<value
string="::1" />
</item>
<item
name="REMOTE_PORT">
<value
string="" />
</item>
<item
name="REQUEST_METHOD">
<value
string="GET" />
</item>
<item
name="SCRIPT_NAME">
<value
string="/VFA4/Account/Scripts/jquery.flexslider-min.js" />
</item>
<item
name="SERVER_NAME">
<value
string="localhost" />
</item>
<item
name="SERVER_PORT">
<value
string="60825" />
</item>
<item
name="SERVER_PORT_SECURE">
<value
string="0" />
</item>
<item
name="SERVER_PROTOCOL">
<value
string="HTTP/1.1" />
</item>
<item
name="SERVER_SOFTWARE">
<value
string="" />
</item>
<item
name="URL">
<value
string="/VFA4/Account/Scripts/jquery.flexslider-min.js" />
</item>
<item
name="HTTP_CONNECTION">
<value
string="keep-alive" />
</item>
<item
name="HTTP_ACCEPT">
<value
string="*/*" />
</item>
<item
name="HTTP_ACCEPT_ENCODING">
<value
string="gzip, deflate" />
</item>
<item
name="HTTP_ACCEPT_LANGUAGE">
<value
string="en-US,en;q=0.8" />
</item>
<item
name="HTTP_COOKIE">
<value
string=".ASPXANONYMOUS=YUThibsmzwEkAAAANWNhZGVjOTItNGQzNS00NmM3LTk3NjYtMTBkODAyYTBiODJhdYxJPubvb1GGRcsjrVicS0N3hCM1; VFA=ID=0&Name=Visitor&ACLSite=0&LoggedIn=false&Profile=0&Greeting=Visitor&Email=; FCOCRV.ASPXAUTH=2EB2E728E7546828599E7059AC071774F1B68DE36945B303364F8DE61A99F4DAEA1378B800DE77E4AD01EDCD1280072326E94CC7F9195A9AE1C8D5B829467129E14E9370F038922195F7D7FC6D7AB38936BBBC59C6C51B406783DA5C6D6567F00CB2B2AF25FD94881D778037C0EB183F8E009861; VFAanon=82GiHFGPKOy-L41M6_huRwSQi3a9FrKsTxn8DLe9u9G-5_4E45PebhWPaRXIcrD75UH17jCEDam8dBaRxfr7MOVXANsTmfdxLNxfGfGsWnq2y7yULGQg7BcCnFVfqmoMWOEp-w2; Violette=bIkdCP9-GSCYa2OhlgT3wakdXVcNXKlK1-VMT5WKlnHquMi7gMk3uIuXuEf87i7KZqH-13GVbwaqNV_7zj-pWgObGgZZPzUING_2tWJGlaLNkM4pUU6ttrVAdjyOn9bjTUBlDw2; __AntiXsrfToken=cde04d3ee0d74a9ba9af775e3dc13bb4" />
</item>
<item
name="HTTP_HOST">
<value
string="localhost:60825" />
</item>
<item
name="HTTP_REFERER">
<value
string="http://localhost:60825/VFA4/Account/Login?ReturnUrl=%2fVFA4%2fAdmin%2fAdm-VFAMembers.aspx" />
</item>
<item
name="HTTP_USER_AGENT">
<value
string="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.72 Safari/537.36" />
</item>
</serverVariables>
<cookies>
<item
name=".ASPXANONYMOUS">
<value
string="YUThibsmzwEkAAAANWNhZGVjOTItNGQzNS00NmM3LTk3NjYtMTBkODAyYTBiODJhdYxJPubvb1GGRcsjrVicS0N3hCM1" />
</item>
<item
name="VFA">
<value
string="ID=0&Name=Visitor&ACLSite=0&LoggedIn=false&Profile=0&Greeting=Visitor&Email=" />
</item>
<item
name="FCOCRV.ASPXAUTH">
<value
string="2EB2E728E7546828599E7059AC071774F1B68DE36945B303364F8DE61A99F4DAEA1378B800DE77E4AD01EDCD1280072326E94CC7F9195A9AE1C8D5B829467129E14E9370F038922195F7D7FC6D7AB38936BBBC59C6C51B406783DA5C6D6567F00CB2B2AF25FD94881D778037C0EB183F8E009861" />
</item>
<item
name="VFAanon">
<value
string="82GiHFGPKOy-L41M6_huRwSQi3a9FrKsTxn8DLe9u9G-5_4E45PebhWPaRXIcrD75UH17jCEDam8dBaRxfr7MOVXANsTmfdxLNxfGfGsWnq2y7yULGQg7BcCnFVfqmoMWOEp-w2" />
</item>
<item
name="Violette">
<value
string="bIkdCP9-GSCYa2OhlgT3wakdXVcNXKlK1-VMT5WKlnHquMi7gMk3uIuXuEf87i7KZqH-13GVbwaqNV_7zj-pWgObGgZZPzUING_2tWJGlaLNkM4pUU6ttrVAdjyOn9bjTUBlDw2" />
</item>
<item
name="__AntiXsrfToken">
<value
string="cde04d3ee0d74a9ba9af775e3dc13bb4" />
</item>
</cookies>
</error>
I cannot determine if the error is in the ELMAH process or in the underlying code somewhere. I have checked the email info in web.config related to ELMAH and all email addresses are properly formatted.
Everything had been working fine on the development machine until sometime in December, when all of a sudden this came up.
I'm trying without luck to create a modify() statement to change the value of an attribute in all elements that have that attribute value -- so far I can only get it to change the value in the first matched element. I created an example below of what I have so far, which I'm running in SQL Server 2005:
DECLARE #x XML
SELECT #x = '
<FootballApparel>
<Item Team="Phoenix Cardinals" Type="Hat" Cost="$14.99" />
<Item Team="Indianapolis Colts" Type="Hat" Cost="$14.99" />
<Item Team="Cincinnati Bengals" Type="Hat" Cost="$14.99" />
<Item Team="Phoenix Cardinals" Type="Shirt" Cost="$21.99" />
<Item Team="Indianapolis Colts" Type="Shirt" Cost="$21.99" />
<Item Team="Cincinnati Bengals" Type="Shirt" Cost="$21.99" />
</FootballApparel>
';
SET #x.modify('
replace value of
(/FootballApparel/Item[#Team="Phoenix Cardinals"]/#Team)[1]
with "Arizona Cardinals"
');
SELECT #x;
Running this gives the results below -- only the first instance of Phoenix Cardinals has been changed.
<FootballApparel>
<Item Team="Arizona Cardinals" Type="Hat" Cost="$14.99" />
<Item Team="Indianapolis Colts" Type="Hat" Cost="$14.99" />
<Item Team="Cincinnati Bengals" Type="Hat" Cost="$14.99" />
<Item Team="Phoenix Cardinals" Type="Shirt" Cost="$21.99" />
<Item Team="Indianapolis Colts" Type="Shirt" Cost="$21.99" />
<Item Team="Cincinnati Bengals" Type="Shirt" Cost="$21.99" />
</FootballApparel>
Can you please help me with the correct modify() statement to replace all instances?
Thanks!
Kevin
You're very close - what you need to do is loop (and there's no other way I know of to do it in this case) and repeatedly replace the values:
WHILE #x.exist('(/FootballApparel/Item[#Team=sql:variable("#oldTeamName")])[1]') = 1
SET #x.modify('
replace value of (
/FootballApparel/Item[#Team=sql:variable("#oldTeamName")]/#Team
)[1]
with sql:variable("#newTeamName")
');
That should do the trick.
Marc