XQuery and Namespace
-
I have xml files with name space references. If I strip the namespace references from I file, I can read the elements and attributes using xQuery. However, with the namespace references in place, I get no results. I can't figure out how to add the references into the xQuery call. XML SQL SELECT x.value('(patientRole/patient/birthTime/@value)[1]','varchar(50)') as birthDate FROM @XML.nodes( 'declare namespace xlmns="urn:hl7-org:v3"; declare namespace xlmns:voc="urn:hl7-org:v3/voc"; declare namespace xsi="http://www.w3.org/2001/XMLSchema-instance"; /ClinicalDocument/recordTarget') as Addr (x)
-
I have xml files with name space references. If I strip the namespace references from I file, I can read the elements and attributes using xQuery. However, with the namespace references in place, I get no results. I can't figure out how to add the references into the xQuery call. XML SQL SELECT x.value('(patientRole/patient/birthTime/@value)[1]','varchar(50)') as birthDate FROM @XML.nodes( 'declare namespace xlmns="urn:hl7-org:v3"; declare namespace xlmns:voc="urn:hl7-org:v3/voc"; declare namespace xsi="http://www.w3.org/2001/XMLSchema-instance"; /ClinicalDocument/recordTarget') as Addr (x)
-
I have xml files with name space references. If I strip the namespace references from I file, I can read the elements and attributes using xQuery. However, with the namespace references in place, I get no results. I can't figure out how to add the references into the xQuery call. XML SQL SELECT x.value('(patientRole/patient/birthTime/@value)[1]','varchar(50)') as birthDate FROM @XML.nodes( 'declare namespace xlmns="urn:hl7-org:v3"; declare namespace xlmns:voc="urn:hl7-org:v3/voc"; declare namespace xsi="http://www.w3.org/2001/XMLSchema-instance"; /ClinicalDocument/recordTarget') as Addr (x)
-
Thanks for the reply/link but that code is for C# and I'm working in SQL unless I'm missing something. I've never used this site before and haven't figured out the navigation.
kjfoley1 wrote:
I'm working in SQL unless I'm missing something
No but it is Richards job/privilege as a protector to reduce cross posting, which this may not be. Sorry to not be of any use - I hate xml.
Never underestimate the power of human stupidity RAH