Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Orchestration expression and using the xpath function
- This topic has 4 replies, 1 voice, and was last updated 9 years, 2 months ago by
community-content.
-
AuthorPosts
-
-
December 15, 2005 at 10:39 PM #12536
The easiest way to get the xpath expression in BizTalk is to open your schema in the BizTalk Editor. Then, click on your node. Under properties, you will see the xpath expression to that node.
If that does not work, please post the xpath value you are using.
Also, see if this blog post will help: http://geekswithblogs.net/sthomas/archive/2004/10/25/13269.aspx
Thanks.
-
December 15, 2005 at 10:39 PM #12537
Looks like there is a size limit on the posts to this forum and your post has been truncated.
When I use the xpath expression, I open the schema, navigate to the node of interest and copy and paste the Instance Xpath property value.
Can you repost with the error message you are receiving
-
December 16, 2005 at 8:24 PM #12538
Try this one:
strXpath = \”/*[local-name()=’ProductionPerformance’ and namespace-uri()=’http://www.wbf.org/xml/b2mml-v02′%5D/*%5Blocal-name()=’ProductionResponse’ and namespace-uri()=’http://www.wbf.org/xml/b2mml-v02′%5D/*%5Blocal-name()=’SegmentResponse’ and namespace-uri()=’http://www.wbf.org/xml/b2mml-v02′%5D/*%5Blocal-name()=’MaterialConsumedActual’ and namespace-uri()=’http://www.wbf.org/xml/b2mml-v02′%5D%5B1%5D/*%5Blocal-name()=’MaterialConsumedActualProperty’ and namespace-uri()=’http://www.wbf.org/xml/b2mml-v02′%5D/*%5Blocal-name()=’ID’ and text()=’SAPInterface’ and namespace-uri()=’http://www.wbf.org/xml/b2mml-v02′%5D/parent::*/*[local-name()=’Value’ and namespace-uri()=’http://www.wbf.org/xml/b2mml-v02′%5D/*%5Blocal-name()=’ValueString’ and namespace-uri()=’http://www.wbf.org/xml/b2mml-v02′%5D\”;
-
December 15, 2005 at 7:53 PM #12539
Greetings,
Relatively new to Biztalk and trying to use the xpath function in an expression to extract a value from an XML document. I can validate an xpath query using XML Spy but can’t seem to get it to work in Biztalk. Here is the XML I am trying to query:
-<ns0:ProductionPerformance xmlns:ns0=\”http://www.wbf.org/xml/b2mml-v02\”>[/code] <ns0:ID>WOSN9999</ns0:ID>
<ns0:PublishedDate>2005-12-15T08:18:44</ns0:PublishedDate>
– <ns0:ProductionResponse>
<ns0:ProductionRequestID>WOSN9999</ns0:ProductionRequestID>
– <ns0:SegmentResponse>
<ns0:ID>WOSN9999_ZZZ_WorkCell99</ns0:ID>
<ns0:ProcessSegmentID>WorkCell99</ns0:ProcessSegmentID>
– <ns0:MaterialConsumedActual>
<ns0:MaterialDefinitionID>MaterialConsummedPart9999</ns0:MaterialDefinitionID>
<ns0:MaterialLotID>Serial999</ns0:MaterialLotID>
<ns0:MaterialSubLotID />
– <ns0:Location>
<ns0:EquipmentID />
<ns0:EquipmentElementLevel>Site</ns0:EquipmentElementLevel>
</ns0:Location>
– <ns0:Quantity>
<ns0:QuantityString>1</ns0:QuantityString>
<ns0:DataType>decimal</ns0:DataType>
<ns0:UnitOfMeasure>EA</ns0:UnitOfMeasure>
</ns0:Quantity>
– <ns0:MaterialConsumedActualProperty>
<ns0:ID>BatchFlag</ns0:ID>
– <ns0:Value>
<ns0:ValueString>N</ns0:ValueString>
<ns0:DataType>string</ns0:DataType>
<ns0:UnitOfMeasure>unit</ns0:UnitOfMeasure>
<ns0:Any />
</ns0:Value>
</ns0:MaterialConsumedActualProperty>
– <ns0:MaterialConsumedActualProperty>
<ns0:ID>Operation</ns0:ID>
– <ns0:Value>
<ns0:ValueString>10</ns0:ValueString>
<ns0:DataType>string</ns0:DataType>
<ns0:UnitOfMeasure>unit</ns0:UnitOfMeasure>
<ns0:Any />
</ns0:Value>
</ns0:MaterialConsumedActualProperty>
– <ns0:MaterialConsumedActualProperty>
<ns0:ID>InterfaceFlag</ns0:ID>
– <ns0:Value>
<ns0:ValueString>I</ns0:ValueString>
<ns0:DataType>string</ns0:DataType>
<ns0:UnitOfMeasure>unit</ns0:UnitOfMeasure>
<ns0:Any />
</ns0:Value>
</ns0:MaterialConsumedActualProperty>
– <ns0:MaterialConsumedActualProperty>
<ns0:ID>SerialNumber</ns0:ID>
– <ns0:Value>
<ns0:ValueString>Serial999</ns0:ValueString>
<ns0:DataType>string</ns0:DataType>
<ns0:UnitOfMeasure>unit</ns0:UnitOfMeasure>
<ns0:Any />
</ns0:Value>
</ns0:MaterialConsumedActualProperty>
– <ns0:MaterialConsumedActualProperty>
<ns0:ID>SAPInterface</ns0:ID>
– <ns0:Value>
<ns0:ValueString>IN0054A</ns0:ValueString>
<ns0:DataType>string</ns0:DataType>
<ns0:UnitOfMeasure>unit</ns0:UnitOfMeasure>
<ns0:Any />
</ns0:Value>
</ns0:MaterialConsumedActualProperty>
– <ns0:MaterialConsumedActualProperty>
<ns0:ID>SerializedFlag</ns0:ID>
– <ns0:Value>
<ns0:ValueString>N</ns0:ValueString>
<ns0:DataType>string</ns0:DataType>
<ns0:UnitOfMeasure>unit</ns0:UnitOfMeasure>
<ns0:Any />
</ns0:Value>
</ns0:MaterialConsumedActualProperty>
– <ns0:MaterialConsumedActualProperty>
<ns0:ID>BatchNumber</ns0:ID>
– <ns0:Value>
<ns0:ValueString>Batch999</ns0:ValueString>
<ns0:DataType>string</ns0:DataType>
<ns0:UnitOfMeasure>unit</ns0:UnitOfMeasure>
<ns0:Any />
</ns0:Value>
</ns0:MaterialConsumedActualProperty>
– <ns0:MaterialConsumedActualProperty>
<ns0:ID>EventDateTime</ns0:ID>
– <ns0:Value>
<ns0:ValueString>12/15/2005 8:18:39.013 AM</ns0:ValueString>
<ns0:DataType>string</ns0:DataType>
<ns0:UnitOfMeasure>unit</ns0:UnitOfMeasure>
<ns0:Any />
</ns0:Value>
</ns0:MaterialConsumedActualProperty>
– <ns0:MaterialConsumedActualProperty>
<ns0:ID>BackFlushIndicatorFlag</ns0:ID>
– <ns0:Value>
<ns0:ValueString>N</ns0:ValueString>
<ns0:DataType>string</ns0:DataType>
<ns0:UnitOfMeasure>unit</ns0:UnitOfMeasure>
<ns0:Any />
</ns0:Value>
</ns0:MaterialConsumedActualProperty>
– <ns0:MaterialConsumedActualProperty>
<ns0:ID>BulkIndicatorFlag</ns0:ID>
– <ns0:Value>
<ns0:ValueString>N</ns0:ValueString>
<ns0:DataType>string</ns0:DataType>
<ns0:UnitOfMeasure>unit</ns0:UnitOfMeasure>
<ns0:Any />
</ns0:Value>
</ns0:MaterialConsumedActualProperty>
</ns0:MaterialConsumedActual>
</ns0:SegmentResponse>
</ns0:ProductionResponse>
</ns0:ProductionPerformance>Ultimately, I wish to return the value \”IN0054A\” which in under the \”SAP Interface\” node. Would someone please help me construct this xpath expressio 😕 n that works in BizTalk? My thanks in advance!
-
December 16, 2005 at 11:30 AM #12540
Thanks for you replies thus far. A couple of weeks ago, I learned of the trick of obtaining the query using the Instance Xpath property. It’s a nice feature.
Anyhow, I have spent the last few days trying to get an Xpath expression that will work. I have tried just about every variation that I can think of. In my expression I need to specify both a position (i.e., [1]) and a predicate (i.e., ID=’SAPInterface’) to get to the element I desire. My lastest xpath is as follows (from the expression shape in my orchestration):
strXpath = \”/*[local-name()=’ProductionPerformance’ and namespace-uri()=’http://www.wbf.org/xml/b2mml-v02′%5D/*%5Blocal-name()=’ProductionResponse’ and namespace-uri()=’http://www.wbf.org/xml/b2mml-v02′%5D/*%5Blocal-name()=’SegmentResponse’ and namespace-uri()=’http://www.wbf.org/xml/b2mml-v02′%5D/*%5Blocal-name()=’MaterialConsumedActual’ and namespace-uri()=’http://www.wbf.org/xml/b2mml-v02′%5D%5B1%5D/*%5Blocal-name()=’MaterialConsumedActualProperty’ and namespace-uri()=’http://www.wbf.org/xml/b2mml-v02′ and * = ‘SAPInterface’]/*[local-name()=’Value’ and namespace-uri()=’http://www.wbf.org/xml/b2mml-v02′%5D/*%5Blocal-name()=’ValueString’ and namespace-uri()=’http://www.wbf.org/xml/b2mml-v02′%5D\”;
strSAPInterface = xpath(msgB2MMLProductionPerformance_In,strXpath);
This produced the error \”There is an error in the XML document.\”.
If I change the predicate \”* = ‘SAPInterface’\” to ns0:ID = \”‘SAPInterface’\”, I get an error \”Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.\”.
Both of these expressions are valid in XML Spy. Again, I thank you for you help in figuring this out…
-
-
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.