We recently started to use fhir path to validate a QuestionnaireResponse.
The QuestionnaireResponse is the following
<QuestionnaireResponse xmlns="http://hl7.org/fhir">
<questionnaire>
<reference value="..." />
</questionnaire>
<status value="completed" />
<authored value="2016-02-19T05:13:42.600Z" />
<group>
<question>
<linkId value="8d0db198-f341-43f8-9dd3-9151ace66375" />
<text value="date" />
<answer>
<valueDate value="2016-02-12" />
</answer>
</question>
</group>
</QuestionnaireResponse>
I have tried the following:
QuestionnaireResponse.group.question.answer.valueDate
and the answer was:
2016-02-12
However trying the following to validate the date with a regex throws exception
QuestionnaireResponse.group.question.answer.valueDate.matches("^\d{4}-((0\d)|(1[012]))-(([012]\d)|3[01])$")
it would be great if you may give me some idea of what is the best way to evaluate a date in fhir path
This turned out to be a bug in the .NET FluentPath evaluator that is in development still (regex section).
The FHIR server should also have rejected the value as not conforming without the fhirpath expression also.
Related
This is regarding xml transformation within BPEL.
In my bpel process, data is coming from two separate sources (partnerLinks).
Data from both sources is in the same xml format.
I need to combine the data from the two XML documents into one xml document and then pass it back to the ESB.
I was trying with bpel:doXslTransform()).
I am not sure how to pass the two responses from the partnerLinks to this function in a single call.
I tried concatenating the two responses into a string within a message type variable and then pass this to the bpel:doXslTransform(). Is this the right approach to merge the data?
Yes, you can do a bpel:doXslTransform here.
This involves receiving an XML document from one service, converting it to a different Schema to form a new request message, and sending the new request to another service. Such documentation conversion can be accomplished using XSLT via the bpel:doXslTransform function.
<variables>
<variable name="A" element="foo:AElement" />
<variable name="B" element="bar:BElement" />
</variables>
...
<sequence>
<invoke ... inputVariable="..." outputVariable="A" />
<assign>
<copy>
<from>
bpel:doXslTransform("urn:stylesheets:A2B.xsl", $A)
</from>
<to variable="B" />
</copy>
</assign>
<invoke ... inputVariable="B" ... />
</sequence>
Please refer http://docs.oasis-open.org/wsbpel/2.0/OS/wsbpel-v2.0-OS.html for further information.
Iam parsing the xml document in SSIS through the xmlsource. It does not have any root tag. So iam trying to add the root tag to my xml document through XSLT, but getting the error as
[XML Task] Error: An error occurred with the following error message: "There are multiple root elements. Line 11, position 2.".
what is the XSL to be used to add the root element.? Please help..this is very urgent..
Please find the xml source below
<organizational_unit>
<box_id>898</box_id>
<hierarchy_id>22</hierarchy_id>
<parent_box_id>0</parent_box_id>
<code>Team</code>
<description />
<name>CAPS Teams</name>
<manager_title />
<level>0</level>
</organizational_unit>
<organizational_unit>
<box_id>967</box_id>
<hierarchy_id>31</hierarchy_id>
<parent_box_id>0</parent_box_id>
<code>main</code>
<description />
<name>Protegent</name>
<manager_title />
<level>0</level>
<organizational_unit>
<box_id>968</box_id>
<hierarchy_id>31</hierarchy_id>
<parent_box_id>967</parent_box_id>
<code>19L</code>
<description>19L</description>
<name>19L</name>
<level>1</level>
<managers>
<manager>
<hierarchy_mgr_id>243</hierarchy_mgr_id>
<hierarchy_id>31</hierarchy_id>
<box_id>968</box_id>
<rep_id>19499</rep_id>
<unique_rep_id>100613948</unique_rep_id>
<first_name>Ed</first_name>
<last_name>Kill</last_name>
</manager>
</managers>
</organizational_unit>
<organizational_unit>
<box_id>1152</box_id>
<hierarchy_id>31</hierarchy_id>
<parent_box_id>967</parent_box_id>
<code>UNKNOWN_m</code>
<description>Unknown Reps</description>
<name>Unknown Reps</name>
<level>1</level>
</organizational_unit>
</organizational_unit>
Well which XSLT processor do you use, how do you use it? I usually don't suggest to use string processing to construct XML but if you have a fragment without a root element then perhaps doing string concatenation "<root>" + fragment + "</root>" is the easiest way to get a well-formed document. XSLT can work with fragments but how you do that depends on the XSLT processor or XML parser you use, for instance .NET can use an XmlReader with XmlReaderSettings with ConformanceLevel set to fragment, which can then be loaded in an XPathDocument (for processing with XSLT 1.0 and XslCompiledTransform) and probably also with Saxon's XdmNode (although I am not sure I remember that correctly).
The stylesheet would then simply do
<xsl:template match="/">
<root>
<xsl:copy-of select="node()"/>
</root>
</xsl:template>
to wrap all top level nodes into a root element.
I was writing some build scripts for my project. I wanted a regex pattern which can match everything before a particular word. For eg: My script looks like this
Create Table ABC(
id int(50)
)
--//#UNDO
Drop table ABC
I want to match everything before --//#UNDO using nant regex task. How do I implement it??
I also want it to match everything in the file if --//#UNDO is not present in the file. I am not getting a way around
This is the pattern:
(?'str'.*?)--//#UNDO
The result will be in str.
If you just want to match the text before the string (and not the string itself) you will need to use a lookahead.
.*?(?=--//#UNDO)
Needing to specify Singleline still applies.
This would be the NAnt target:
<target name="go">
<loadfile
file="C:\foo\bar.sql"
property="content" />
<regex
pattern="(?'content'.*)--//#UNDO"
input="${content}"
options="Singleline"
failonerror="false" />
<echo message="${content}" />
</target>
Notice that property content is preset with the complete file content in case that --//#UNDO is not present in file.
This is what I ended up doing
<loadfile file="${filePathAndName}" property="file.contents" />
<property name="fileHasUndo" value="${string::index-of(file.contents, '--//#UNDO')}" />
<choose>
<when test="${fileHasUndo == '-1' }">
<echo file="${file}" append="true" message="${file.contents}" />
</when>
<otherwise>
<regex pattern="(?'sql'[\s\S]*)--\/\/#UNDO[\s\S]*" input="${file.contents}" options="Multiline"/>
<echo file="${file}" append="true" message="${sql}" />
</otherwise>
</choose>
I found the index of --//#UNDO. And depending on its presence I am doing a choose when.. Solved the problem
I have in hithighlightedsummary the tag this
<ddd /> Posted: 2/8/2011 10:04 PM <ddd /> Subject: some subject <ddd /> Some Text <ddd />
I would like to get the 'some subject' as a sub string. I have tried using "substring-after(hithighlightedsummary, 'Subject:')", But I don't know how to combine that with the <ddd /> tag.
Did you mean something like this?
substring-after(
//hithighlightedsummary
/text()[
contains(.,'Subject:')
],
'Subject:'
)
Note: I've used an absolute expression because you didn't provide information about context.
Can someone provide a sample for downloading a specific version of a file from SharePoint using web services? Normally I would get the file with the Copy Web Service (.../_vti_bin/copy.asmx). But I don't really know how to specify a version.
Regards
Anton Kalcik
You can use the Versions web service to get which versions exist for a File
The GetVersions method will give you an xml like this:
<results xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<list id="{26E516B0-8241-4B97-984D-000000000000}" />
<versioning enabled="1" />
<settings url="http://Server_Name/Site_Name/_layouts/
1033/LstSetng.aspx?
List={26E516B0-8241-4B97-984D-000000000000}" />
<result version="#4" url="http://Server_Name/Site_Name/
Shared Documents/File_Name.doc"
created="6/7/2003 5:55 PM" createdBy="DOMAIN\User" size="19968"
comments="" />
<result version="1" url="http://Server_Name/Site_Name/
_vti_history/1/Shared Documents/File_Name.doc"
created="6/7/2003 5:49 PM" createdBy="DOMAIN\User" size="19968"
comments="" />
.
.
.
</results>
You can then just use a HTTP GET request for the content of the "url" attribute of the "result" node for the right version
Here's the exact thing you want to do, with code:
Article