Tips for Using PIDX Schemas in BizTalk Server 2006

Day 3 in my RosettaNet implementation nightmare and I still can’t see the end of the road!


As you may or may not know, the American Petroleum Institute (API) has it’s own set of XML schemas and transport standards know as the Petroleum Industry Data Exchange or PIDX for short. This is the actual “standard” that my current RosettaNet project is really all about. The interesting about these schemas is the fact that they use their own unique namespace and prefix as shown below:


xmlns:pidx=http://www.api.org/pidXML/1.0


Since the BizTalk Mapper tool always generates XML document with the “ns0″ prefix and there is no property you can set to change this, you’ll need to use a little “XSLT slight-of-hand” to get this to work.


Step 1: Create your BizTalk Map as you normally would using the mapper tool.


Step 2: Validate your map and open the xslt generated by BizTalk Server 2006 in your favorite text editor. This file can usually be found in the “\temp\_mapdata” folder.


Step 3: Replace all instances of the namespace prefix “ns0″ with the prefix you require (which in this case is “pidx”) as shown below.



Step 4: Save the result as an .xslt file and include it (or add it) into your BizTalk project.


Step 5: Create a new map using the same source and destination schemas you used in Step 1 but use the external xslt you generated by setting the “Custom XSLT Path” property on your new map.


The results are shown in the figure below. Viola! The “ns0″ namespace prefix has been replaced by the desired “pidx” prefix.



Click below for more information about using external xslt in your maps.


Custom XSLT in BizTalk Maps


Take Away: There is always more than one way to skin a cat! In BTS2006 it may not be obvious how to do something a little unusual.

This entry was posted in BizTalk Server, PIDX, RosettaNet. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

2 Responses to Tips for Using PIDX Schemas in BizTalk Server 2006

  1. jlynch says:

    @Greg – Actually, the requirement for using a specific namespace and prefix is supported in the current xml standard. The PIDX standard (created by the American Petroleum Institute) uses their own xml schemas and the RNIF (RosettaNet) transport, so this requirement is necessary (at least in this instance) and we (the developers) do what we must to accomodate our customers.

    I’m hoping the BizTalk team includes the ability to easily change the namespace prefix in the next version. My method works but it’s a pain point that could be easily fixed in the Mapper.

  2. Greg Forsythe says:

    Jeff,
    Why do you need to change the namespace prefix, any real Xml Parser shouldn’t care what the prefix is, as long as it resolves to the correct namespace

    Useful tip when generating XSLT.
    When you do the Validate Map, the output window has a link to the XSL file – Ctrl-click will open this file, right click View Source will give you an editable version, then Save As to save into your project directory

Leave a Reply