[TSQL] update komórki z xml - Replace daty USA na 'naszą'

Odpowiedz Nowy wątek
2017-08-12 20:45
0

Potrzebuję robić update komórki z xml-em w której będą w rożnych miejscach różne daty (string) w formacie 'USA' mm-dd-rr , muszę je zamienić na daty (string) w formacie yyyy-mm-dd
Zakładam ,że będę potrzebował wyrażenia regularnego do znalezienia tego formatu daty w xml i to już mam:

 ^(0?[1-9]|1[012])[\-](0?[1-9]|[12][0-9]|3[01])[\-]\d{2}$

Sama zamiana znalezionego ciągu mm-dd-yy na yyyy-mm-dd to też nie problem :

SELECT LEFT(CONVERT(VARCHAR, CAST('08-02-17' AS datetime), 120),10)

Zakładam, że trzeba użyć pętli i wyrażenia regularnego aby wszystkie pasujące ciągi zamienić na żądane, i tutaj mam problem bo nie bardzo wiem jak to ugryźć, wiec zwracam się o pomoc.

Przykładowy xml w którym trzeba pozmieniać wartości ( z uwaga że mogą być w rożnej ilości w rożnych miejscach tego xml-a)

Wybrane pozycje w których wy stepują te daty L="1871" L="1692" L="2096"

    <Word L="1872" R="1990" T="324" B="351" Text="26603333345" Id="24493329746300" />
    <Word L="1871" R="2015" T="373" B="401" Text="08-02-17" Id="25109308586898" />
    <Word L="1873" R="2007" T="422" B="448" Text="S-44404" Id="24914704754685" />
    <Word L="1874" R="1887" T="468" B="496" Text="1" Id="22024234663427" />
 
    <Word L="1068" R="1148" T="1278" B="1309" Text="DHL" Id="8152496756181" />
    <Word L="1692" R="1848" T="1279" B="1310" Text="08-02-17" Id="21119731019927" />
    <Word L="2096" R="2251" T="1278" B="1310" Text="10-01-17" Id="31333127836454" />
    <Word L="112" R="243" T="1352" B="1358" Text="_" Id="365589546232" />
    <Word L="252" R="411" T="1322" B="1350" Text="QUANTITY" Id="1050334834310" />

Cały XML

<?xml version="1.0" encoding="utf-16"?>
<Document xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Page W="2480" H="3516">
    <Word L="1871" R="2031" T="221" B="252" Text="INVOICE" Id="25509747671106" />
    <Word L="600" R="759" T="317" B="349" Text="ggonic" Id="3565714839428" />
    <Word L="775" R="979" T="317" B="358" Text="ggtening" Id="5935584306857" />
    <Word L="995" R="1170" T="318" B="351" Text="hghghgh" Id="8472165937270" />
    <Word L="1187" R="1215" T="318" B="351" Text="&" Id="9135179373142" />
    <Word L="1232" R="1349" T="318" B="352" Text="Rings" Id="11261043658357" />
    <Word L="602" R="793" T="368" B="399" Text="Rtryht" Id="3891644397424" />
    <Word L="804" R="1012" T="369" B="399" Text="Ohgfhons" Id="6336666309521" />
    <Word L="599" R="682" T="415" B="446" Text="Fhgfhh" Id="2878446470215" />
    <Word L="697" R="825" T="417" B="446" Text="Rfghgfhn" Id="4216570091945" />
    <Word L="842" R="896" T="417" B="447" Text="Inc" Id="4967019580921" />
    <Word L="602" R="734" T="462" B="493" Text="Pfghx" Id="3334533813885" />
    <Word L="748" R="850" T="462" B="494" Text="366611" Id="4474909650350" />
    <Word L="603" R="789" T="507" B="543" Text="Rouuuur," Id="3853535287875" />
    <Word L="804" R="857" T="509" B="539" Text="ty" Id="4548179373407" />
    <Word L="872" R="1074" T="510" B="540" Text="1333-33333" Id="7140438490723" />
    <Word L="603" R="723" T="553" B="583" Text="Phone." Id="3234233363741" />
    <Word L="603" R="675" T="598" B="629" Text="Fax:" Id="2818825070225" />
    <Word L="1550" R="1672" T="321" B="352" Text="Invoice" Id="17294256354248" />
    <Word L="1686" R="1834" T="322" B="351" Text="Number:" Id="20800873873018" />
    <Word L="1746" R="1836" T="371" B="401" Text="Date." Id="20850161891600" />
    <Word L="1572" R="1674" T="418" B="449" Text="Order" Id="17331108376055" />
    <Word L="1686" R="1836" T="419" B="449" Text="Number:" Id="20851970076312" />
    <Word L="1584" R="1673" T="465" B="496" Text="Page" Id="17310489333392" />
    <Word L="1688" R="1836" T="465" B="496" Text="Number:" Id="20851994762192" />
    <Word L="1726" R="1837" T="511" B="542" Text="F.O.B:" Id="20872826060279" />
    <Word L="1669" R="1838" T="556" B="587" Text="Currency:" Id="20892202570502" />
    <Word L="1530" R="1704" T="602" B="632" Text="Customer" Id="17957766831357" />
    <Word L="1717" R="1838" T="602" B="632" Text="Phone:" Id="20892796193789" />
    <Word L="1872" R="1990" T="324" B="351" Text="26603333345" Id="24493329746300" />
    <Word L="1871" R="2015" T="373" B="401" Text="08-02-17" Id="25109308586898" />
    <Word L="1873" R="2007" T="422" B="448" Text="S-44404" Id="24914704754685" />
    <Word L="1874" R="1887" T="468" B="496" Text="1" Id="22024234663427" />
    <Word L="1874" R="2057" T="514" B="541" Text="EXWORKS" Id="26166046362729" />
    <Word L="793" R="1033" T="555" B="585" Text="111.328.1383" Id="6602596300316" />
    <Word L="791" R="1029" T="600" B="630" Text="111.328.2885" Id="6556991475004" />
    <Word L="1875" R="1955" T="556" B="587" Text="USD" Id="23635796582854" />
    <Word L="609" R="691" T="743" B="773" Text="Sold" Id="2958385884106" />
    <Word L="703" R="751" T="743" B="774" Text="To" Id="3488796092499" />
    <Word L="1415" R="1913" T="745" B="787" Text="______ShlpTo" Id="22635743273663" />
    <Word L="1419" R="1469" T="794" B="821" Text="WC" Id="13345762104037" />
    <Word L="1481" R="1653" T="795" B="822" Text="Arrrryye" Id="16903235913471" />
    <Word L="1666" R="1810" T="795" B="822" Text="Raertyu" Id="20261463848063" />
    <Word L="1822" R="1864" T="795" B="829" Text="Sp" Id="21490117338498" />
    <Word L="1875" R="1892" T="802" B="822" Text="z" Id="22139960462198" />
    <Word L="1903" R="1962" T="802" B="823" Text="o.o." Id="23804223997918" />
    <Word L="1419" R="1699" T="835" B="863" Text="PreyujkA" Id="17854964100651" />
    <Word L="1710" R="1751" T="835" B="863" Text="9B" Id="18965442811739" />
    <Word L="1763" R="1915" T="835" B="870" Text="(Otyui)" Id="22678718244143" />
    <Word L="1420" R="1598" T="876" B="903" Text="Rrrrrrr" Id="15794528185024" />
    <Word L="1612" R="1722" T="876" B="904" Text="11-111" Id="18343384060599" />
    <Word L="1420" R="1564" T="917" B="944" Text="POLAND" Id="15128239207348" />
    <Word L="160" R="209" T="788" B="816" Text="WC" Id="274437101491" />
    <Word L="220" R="390" T="790" B="817" Text="wererewr" Id="942103150643" />
    <Word L="404" R="546" T="790" B="818" Text="werwer" Id="1849270248384" />
    <Word L="558" R="607" T="790" B="819" Text="Sp." Id="2284633820860" />
    <Word L="620" R="637" T="798" B="820" Text="z" Id="2509431617375" />
    <Word L="648" R="696" T="798" B="820" Text="o.o" Id="3001674263263" />
    <Word L="159" R="435" T="830" B="858" Text="werewr" Id="1172883915996" />
    <Word L="447" R="488" T="831" B="859" Text="99B" Id="1473710669729" />
    <Word L="159" R="335" T="871" B="898" Text="Rerewr" Id="699349556793" />
    <Word L="350" R="459" T="871" B="900" Text="33-333" Id="1307929191856" />
    <Word L="160" R="304" T="911" B="938" Text="POLAND" Id="573136911749" />
    <Word L="159" R="216" T="952" B="979" Text="NIP" Id="288655337262" />
    <Word L="228" R="425" T="952" B="981" Text="33333333" Id="1123329957027" />
    <Word L="194" R="375" T="1137" B="1163" Text="CUSTOMER" Id="875549833419" />
    <Word L="386" R="415" T="1138" B="1163" Text="10" Id="1065720708492" />
    <Word L="638" R="818" T="1140" B="1165" Text="CUSTOMER" Id="4140359921987" />
    <Word L="831" R="873" T="1140" B="1166" Text="PO" Id="4718437460308" />
    <Word L="1901" R="2040" T="1141" B="1166" Text="FREIGHT" Id="25736197244245" />
    <Word L="2049" R="2161" T="1140" B="1166" Text="TERMS" Id="28881617867316" />
    <Word L="1209" R="1362" T="1142" B="1166" Text="PAYMENT" Id="11479152136038" />
    <Word L="1371" R="1482" T="1143" B="1167" Text="TERMS" Id="13588837555671" />
    <Word L="242" R="370" T="1181" B="1212" Text="NOR043333" Id="847183562834" />
    <Word L="649" R="861" T="1183" B="1215" Text="ZZ/033333" Id="4587329570135" />
    <Word L="1288" R="1349" T="1185" B="1216" Text="Net" Id="11260125391448" />
    <Word L="1363" R="1404" T="1186" B="1216" Text="60" Id="12196320249865" />
    <Word L="1887" R="2030" T="1186" B="1216" Text="Freight:" Id="25483525534617" />
    <Word L="2045" R="2177" T="1185" B="1215" Text="Collect" Id="29311245917033" />
    <Word L="266" R="369" T="1230" B="1256" Text="SALES" Id="843476992969" />
    <Word L="380" R="442" T="1231" B="1256" Text="REP" Id="1208272039706" />
    <Word L="454" R="483" T="1231" B="1256" Text="ID" Id="1443904127930" />
    <Word L="957" R="1108" T="1233" B="1260" Text="SHIPPING" Id="7595644257934" />
    <Word L="1120" R="1256" T="1235" B="1261" Text="METHOD" Id="9758954209634" />
    <Word L="1687" R="1759" T="1236" B="1261" Text="SHIP" Id="19134906867363" />
    <Word L="1772" R="1854" T="1236" B="1260" Text="DATE" Id="21256179016673" />
    <Word L="2023" R="2152" T="1235" B="1260" Text="INVOICE" Id="28642910394816" />
    <Word L="2165" R="2229" T="1235" B="1259" Text="DUE" Id="30723696176829" />
    <Word L="2243" R="2324" T="1234" B="1259" Text="DATE" Id="33401007867388" />
    <Word L="1068" R="1148" T="1278" B="1309" Text="DHL" Id="8152496756181" />
    <Word L="1692" R="1848" T="1279" B="1310" Text="08-02-17" Id="21119731019927" />
    <Word L="2096" R="2251" T="1278" B="1310" Text="10-01-17" Id="31333127836454" />
    <Word L="112" R="243" T="1352" B="1358" Text="_" Id="365589546232" />
    <Word L="252" R="411" T="1322" B="1350" Text="QUANTITY" Id="1050334834310" />
    <Word L="148" R="217" T="1364" B="1389" Text="ORD" Id="296024098499" />
    <Word L="249" R="258" T="1354" B="1398" Text="[" Id="414908609470" />
    <Word L="301" R="354" T="1366" B="1390" Text="B/O" Id="780225164694" />
    <Word L="393" R="404" T="1356" B="1399" Text="I" Id="1010026748472" />
    <Word L="441" R="504" T="1366" B="1391" Text="SHP" Id="1575485714166" />
    <Word L="1671" R="1691" T="1328" B="1354" Text="T" Id="17682664914742" />
    <Word L="1807" R="1880" T="1328" B="1354" Text="UNIT" Id="21860644660646" />
    <Word L="2096" R="2268" T="1328" B="1353" Text="EXTENDED" Id="31809295345441" />
    <Word L="2134" R="2230" T="1370" B="1395" Text="PRICE" Id="30755861328656" />
    <Word L="653" R="737" T="1367" B="1393" Text="PART" Id="3365812107892" />
    <Word L="1161" R="1376" T="1369" B="1395" Text="DESCRIPTION" Id="11716092034431" />
    <Word L="1670" R="1691" T="1370" B="1395" Text="X" Id="17682652152304" />
    <Word L="1794" R="1891" T="1371" B="1396" Text="PRICE" Id="22118739422700" />
    <Word L="219" R="238" T="1503" B="1532" Text="2" Id="348986796676" />
    <Word L="356" R="376" T="1504" B="1534" Text="0" Id="878930721144" />
    <Word L="501" R="712" T="1504" B="1535" Text="2 45667774" Id="3142302453736" />
    <Word L="846" R="858" T="1506" B="1536" Text="1" Id="4552976543401" />
    <Word L="867" R="1137" T="1506" B="1536" Text="F44444449-rrR" Id="7998354197481" />
    <Word L="1151" R="1277" T="1506" B="1536" Text="CHG.D" Id="10091982273097" />
    <Word L="846" R="989" T="1551" B="1582" Text="Packlist:" Id="6052329878047" />
    <Word L="1003" R="1132" T="1553" B="1582" Text="264445" Id="7930666503713" />
    <Word L="1853" R="1996" T="1506" B="1539" Text="225 00" Id="24637213185424" />
    <Word L="2198" R="2339" T="1506" B="1539" Text="111.00" Id="33835416845360" />
    <Word L="843" R="946" T="1642" B="1672" Text="HEAT" Id="5537270162117" />
    <Word L="1014" R="1125" T="1642" B="1673" Text="K6774" Id="7833837682059" />
    <Word L="565" R="802" T="1687" B="1718" Text="82222.22.22210" Id="3982140107595" />
    <Word L="1158" R="1237" T="1688" B="1719" Text="USA" Id="9468307091236" />
    <Word L="973" R="1114" T="1735" B="1766" Text="ORDER" Id="7676531921091" />
    <Word L="1128" R="1457" T="1734" B="1766" Text="SPECIFICATIONS" Id="13136363669346" />
    <Word L="2200" R="2340" T="1922" B="1955" Text="330.00" Id="33864348707920" />
    <Word L="1515" R="1596" T="1924" B="1955" Text="SUB" Id="15758048296226" />
    <Word L="1610" R="1752" T="1924" B="1955" Text="TOTAL:" Id="18987094363410" />
    <Word L="277" R="709" T="1941" B="2035" Text="ORIGINAL" Id="3114264893435" />
    <Word L="2200" R="2340" T="2017" B="2051" Text="370.00" Id="33864348777967" />
    <Word L="1328" R="1460" T="2020" B="2049" Text="TOTAL" Id="13187767917849" />
    <Word L="1473" R="1648" T="2020" B="2050" Text="AMOUNT" Id="16801235752950" />
    <Word L="1662" R="1753" T="2019" B="2049" Text="DUE:" Id="19009405958008" />
    <Word L="1988" R="2046" T="2232" B="2279" Text="tf.'l" Id="25886807122412" />
    <Word L="1605" R="1908" T="2334" B="2372" Text="eeee/2017/08/04444" Id="22516290681223" />
    <Word L="1606" R="1906" T="2370" B="2409" Text="2017-08-04 13:15:10" Id="22469000405683" />
    <Word L="1609" R="1661" T="2418" B="2441" Text="Era" Id="17066673674387" />
    <Word L="1679" R="1756" T="2410" B="2437" Text="Czffff" Id="19073339556349" />
    <Word L="1753" R="1928" T="2509" B="2538" Text="00000133335" Id="22987888748115" />
    <Word L="180" R="247" T="2650" B="2682" Text="The" Id="382021127608" />
    <Word L="261" R="380" T="2652" B="2682" Text="Parties" Id="893884328794" />
    <Word L="394" R="622" T="2660" B="2684" Text="acknowledge" Id="2400841281097" />
    <Word L="636" R="699" T="2656" B="2684" Text="and" Id="3027809432725" />
    <Word L="714" R="812" T="2662" B="2685" Text="agree" Id="4084283899581" />
    <Word L="825" R="857" T="2658" B="2686" Text="to" Id="4548300710346" />
    <Word L="869" R="994" T="2656" B="2686" Text="Alcoa's" Id="6112029928504" />
    <Word L="1007" R="1119" T="2656" B="2686" Text="Terms" Id="7745283672888" />
    <Word L="1134" R="1197" T="2656" B="2686" Text="and" Id="8862048398232" />
    <Word L="1212" R="1405" T="2656" B="2691" Text="Conditions," Id="12211294151246" />
    <Word L="1419" R="1520" T="2656" B="2686" Text="which" Id="14290072794952" />
    <Word L="1533" R="1595" T="2664" B="2687" Text="can" Id="15732780200496" />
    <Word L="1610" R="1651" T="2656" B="2686" Text="be" Id="16861822553768" />
    <Word L="1664" R="1784" T="2655" B="2686" Text="viewed" Id="19687784654535" />
    <Word L="1799" R="1863" T="2656" B="2686" Text="and" Id="21463895157624" />
    <Word L="1877" R="2088" T="2655" B="2686" Text="downloaded" Id="26961069646263" />
    <Word L="2103" R="2142" T="2662" B="2686" Text="at:" Id="28376520246974" />
    <Word L="182" R="1941" T="2701" B="2739" Text="http://www.test.pdf," Id="23319296000275" />
    <Word L="1956" R="2034" T="2704" B="2733" Text="shall" Id="25587294429471" />
    <Word L="2048" R="2142" T="2711" B="2740" Text="apply" Id="28376243108040" />
    <Word L="181" R="212" T="2748" B="2776" Text="to" Id="282266618079" />
    <Word L="225" R="285" T="2748" B="2776" Text="this" Id="506023140095" />
    <Word L="299" R="418" T="2747" B="2777" Text="invoice" Id="1085780707140" />
    <Word L="430" R="494" T="2747" B="2777" Text="and" Id="1514812822644" />
    <Word L="507" R="562" T="2755" B="2778" Text="are" Id="1955010474513" />
    <Word L="576" R="695" T="2748" B="2786" Text="hereby" Id="2992888150126" />
    <Word L="707" R="925" T="2749" B="2780" Text="Incorporated" Id="5299949407618" />
    <Word L="940" R="979" T="2750" B="2787" Text="by" Id="5929030045164" />
    <Word L="991" R="1166" T="2757" B="2780" Text="reference." Id="8411161136874" />
    <Word L="1183" R="1302" T="2750" B="2780" Text="Please" Id="10485268208691" />
    <Word L="1314" R="1441" T="2752" B="2781" Text="contact" Id="12843998890647" />
    <Word L="1454" R="1507" T="2751" B="2781" Text="the" Id="14045023942342" />
    <Word L="1520" R="1685" T="2758" B="2780" Text="customer" Id="17559285315499" />
    <Word L="1698" R="1822" T="2757" B="2780" Text="service" Id="20530716831162" />
    <Word L="1835" R="2087" T="2757" B="2779" Text="representative" Id="26941143736023" />
    <Word L="183" R="335" T="2792" B="2822" Text="identified" Id="699105554900" />
    <Word L="351" R="391" T="2800" B="2823" Text="on" Id="945315401108" />
    <Word L="404" R="462" T="2794" B="2823" Text="this" Id="1325683804046" />
    <Word L="477" R="597" T="2793" B="2824" Text="invoice" Id="2209925171412" />
    <Word L="611" R="630" T="2793" B="2824" Text="if" Id="2458905950884" />
    <Word L="642" R="702" T="2802" B="2832" Text="you" Id="3052851859089" />
    <Word L="715" R="833" T="2797" B="2825" Text="cannot" Id="4297326564190" />
    <Word L="846" R="967" T="2803" B="2826" Text="access" Id="5788830307961" />
    <Word L="982" R="1034" T="2798" B="2826" Text="the" Id="6618440929252" />
    <Word L="1047" R="1180" T="2804" B="2826" Text="website" Id="8612978225178" />
    <Word L="1193" R="1228" T="2803" B="2826" Text="or" Id="9331825323449" />
    <Word L="1239" R="1293" T="2798" B="2826" Text="the" Id="10345409063300" />
    <Word L="1306" R="1437" T="2796" B="2826" Text="Arconic" Id="12777155115090" />
    <Word L="1449" R="1563" T="2796" B="2826" Text="Terms" Id="15113178441202" />
    <Word L="1577" R="1639" T="2796" B="2826" Text="and" Id="16613894190354" />
    <Word L="1655" R="1849" T="2795" B="2830" Text="Conditions," Id="21147403015707" />
    <Word L="1865" R="1929" T="2795" B="2825" Text="and" Id="23015476921084" />
    <Word L="1943" R="2003" T="2803" B="2833" Text="you" Id="24809299175856" />
    <Word L="2017" R="2068" T="2795" B="2825" Text="will" Id="26446019509372" />
    <Word L="2084" R="2125" T="2795" B="2825" Text="be" Id="27923567079532" />
    <Word L="183" R="330" T="2838" B="2874" Text="provided" Id="675190350740" />
    <Word L="342" R="411" T="2838" B="2869" Text="with" Id="1045001781057" />
    <Word L="424" R="442" T="2846" B="2869" Text="a" Id="1208812634969" />
    <Word L="457" R="573" T="2839" B="2876" Text="printed" Id="2031635792732" />
    <Word L="588" R="678" T="2847" B="2871" Text="copy." Id="2844896272875" />
    <Word L="88" R="202" T="2977" B="3001" Text="’LEASE" Id="257633364282" />
    <Word L="213" R="406" T="2977" B="3003" Text="REFERENCE" Id="1026336725059" />
    <Word L="417" R="488" T="2977" B="3003" Text="THIS" Id="1473335972243" />
    <Word L="500" R="628" T="2978" B="3004" Text="INVOICE" Id="2441446636615" />
    <Word L="640" R="776" T="2979" B="3004" Text="NUMBER" Id="3730339989208" />
    <Word L="788" R="833" T="2980" B="3005" Text="ON" Id="4292188424443" />
    <Word L="845" R="935" T="2980" B="3005" Text="YOUR" Id="5409167609467" />
    <Word L="947" R="1057" T="2981" B="3006" Text="CHECK" Id="6911004983565" />
    <Word L="1068" R="1133" T="2981" B="3006" Text="AND" Id="7943888172637" />
    <Word L="1146" R="1244" T="2982" B="3006" Text="REMIT" Id="9575963223198" />
    <Word L="1253" R="1305" T="2982" B="3006" Text="TO:" Id="10532760831854" />
    <Word L="122" R="195" T="3065" B="3093" Text="ACH" Id="238853402772" />
    <Word L="210" R="380" T="3065" B="3092" Text="PAYMENT" Id="895266771594" />
    <Word L="392" R="542" T="3065" B="3094" Text="METHOD" Id="1818243984621" />
    <Word L="956" R="1048" T="3069" B="3096" Text="WIRE" Id="6798066200736" />
    <Word L="1062" R="1258" T="3069" B="3099" Text="PAYMENTS" Id="9789394172719" />
    <Word L="1800" R="1949" T="3069" B="3096" Text="CHECKS" Id="23496295215264" />
    <Word L="123" R="262" T="3155" B="3181" Text="Deposit#" Id="426186290402" />
    <Word L="275" R="448" T="3155" B="3183" Text="53333333" Id="1242705459795" />
    <Word L="121" R="210" T="3195" B="3222" Text="Aee#" Id="277784145919" />
    <Word L="223" R="399" T="3196" B="3223" Text="044444444" Id="990418682376" />
    <Word L="958" R="1062" T="3159" B="3185" Text="BANK:" Id="6976420750708" />
    <Word L="1076" R="1172" T="3160" B="3186" Text="Hrrrr" Id="8497323716018" />
    <Word L="957" R="1071" T="3199" B="3227" Text="WIRE#" Id="7095549740433" />
    <Word L="1083" R="1263" T="3199" B="3227" Text="025678789" Id="9872574513777" />
    <Word L="1800" R="1870" T="3159" B="3185" Text="Freterter" Id="21628674693460" />
    <Word L="1883" R="1990" T="3159" B="3184" Text="retertert" Id="24493997921206" />
    <Word L="2005" R="2057" T="3159" B="3184" Text="Inc." Id="26165512952198" />
    <Word L="1801" R="1849" T="3198" B="3227" Text="PO" Id="21141288594112" />
    <Word L="1863" R="1922" T="3198" B="3226" Text="Box" Id="22848809076732" />
    <Word L="1933" R="2029" T="3198" B="3227" Text="44444" Id="25457657519968" />
    <Word L="1800" R="1973" T="3240" B="3271" Text="fdgdfgsdfggd," Id="24074344986492" />
    <Word L="1987" R="2033" T="3240" B="3267" Text="rt" Id="25561831084886" />
    <Word L="2057" R="2242" T="3240" B="3267" Text="11111-1111" Id="31084538448358" />
  </Page>
</Document>
 
edytowany 2x, ostatnio: Karol karol, 2017-08-12 20:47

Pozostało 580 znaków

2017-08-13 13:33
0

Czy przykład jest aby na pewno dobry? Dla 1871 masz:

<Word L="1871" R="2031" T="221" B="252" Text="INVOICE" Id="25509747671106" />

Pomijając poprawność przykładu. Skoro masz XMLa, to naturalne wydaje się użycie XPath + XSLT do wykonania transformacji. W uproszczeniu, na XMLu można zastosować transformację XSLT jak poniżej:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="/">
        <xsl:variable name="toConvert" select="tokenize('1871 1692 2096', '\s+')"/>
        <xsl:for-each select="/Document/Page/Word">
        L="<xsl:value-of select="@L"/>" R="<xsl:value-of select="@R"/>" T="<xsl:value-of select="@T"/>" B="<xsl:value-of select="@B"/>" Text="<xsl:choose>
                <xsl:when test="index-of($toConvert,@L)">Converted from: <xsl:value-of select="@Text"/> to: <xsl:value-of select="substring(@Text,7,2)"/>-<xsl:value-of select="substring(@Text,1,2)"/>-<xsl:value-of select="substring(@Text,4,2)"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="@Text"/>
                </xsl:otherwise>
            </xsl:choose>"
        Id="<xsl:value-of select="@Id"/>"</xsl:for-each>
    </xsl:template>
</xsl:stylesheet>

Materiał pomocniczy:
https://blogs.msdn.microsoft.[...]ta-stored-in-sql-server-2005/

Pozostało 580 znaków

Odpowiedz
Liczba odpowiedzi na stronę

1 użytkowników online, w tym zalogowanych: 0, gości: 1, botów: 0