Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
LearningSQLKid
Yak Posting Veteran
51 Posts |
Posted - 2013-05-12 : 22:45:43
|
Hi GuysI need help in extracting data but i don't know how would i use default namespaces and how to extract data from the following xml. I need value from BloodType tag<ase:aseXML xmlns:ase="urn:aseXML:r17" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:aseXML:r17 http://www.nemmco.com.au/aseXML/schemas/r17/aseXML_r17.xsd"> <Person> <From>xxxx</From> <To>yyyyy</To> <MessageID>000914566</MessageID> <MessageDate>2010-05-21</MessageDate> <BllodType>A</TransactionGroup> </Person> </ase:aseXML>Thanks in AdvanceSelect Knowledge from LearningProcess |
|
stepson
Aged Yak Warrior
545 Posts |
Posted - 2013-05-13 : 01:06:47
|
Hi,this line is correct ?<BllodType>A</TransactionGroup>for me, I changed to :<BllodType>A</BllodType>declare @xmlText as xmlset @xmlText ='<ase:aseXML xmlns:ase="urn:aseXML:r17" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:aseXML:r17 http://www.nemmco.com.au/aseXML/schemas/r17/aseXML_r17.xsd"> <Person> <From>xxxx</From> <To>yyyyy</To> <MessageID>000914566</MessageID> <MessageDate>2010-05-21</MessageDate> <BllodType>A</BllodType> </Person> </ase:aseXML>';WITH XMLNAMESPACES( 'urn:aseXML:r17' AS ase)select t.u.value('.','nvarchar(2)')from @xmlText.nodes('/ase:aseXML/Person/BllodType') as t(u) Ce-am pe mine am si-n dulap, cand ma-mbrac zici ca ma mutsabinWeb |
|
|
|
|
|