Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries [Thread Prev] >Thread Next - Re: BTS 2002 Map XPATH Manipulation? BTS 2002 Map XPATH Manipulation?To: NULL Date: 8/6/2004 11:00:00 AM I work with HL7 files which have elements in excess of 300 for each document. It is tedious to say the least to draw the lines for these since most of them just map across to their counterpart in the destination document. We are working on a tool to automatically map elements that have the same name, cardinality and datatype. The tool is being written in C#. We would like to use the XPathDocument, XPathNavigator, and XPathNodeIterator classes to hold and process the documents. We have run into problems when trying to apply this expression, "*[//Schema]" to the XML extract below. It returns an empty node set: <Schema name="ADT_A01" b:BizTalkServerEditorTool_Version="1.5" b:root_reference="ADT-A01" b:standard="XML" xmlns="urn:schemas-microsoft-com:xml-data" xmlns:b="urn:schemas-microsoft-com:BizTalkServer" xmlns:d="urn:schemas-microsoft-com:datatypes"> <b:SelectionFields /> <ElementType name="MSH_1_FieldSeparator" content="textOnly" model="closed" b:type="string"> <description>Field Separator</description> </ElementType> </Schema> If we remove the namespaces and their references the expression returns a node set when applied to this XML extract but I am confused as to what is returned. The Name property of the XPathNodeIterator current object is "Schema" and the Value property of this object is "Field Separator" which is the contents of the description node. <Schema name="ADT_A01" BizTalkServerEditorTool_Version="1.5" root_reference="ADT-A01" standard="XML"> <SelectionFields /> <ElementType name="MSH_1_FieldSeparator" content="textOnly" model="closed" type="string"> <description>Field Separator</description> </ElementType> </Schema> We obviously do not understand what we are doing so if anyone has some code samples that show how to manipulate the map I would appreciate it! The code we are using is: private void ultraButtonLoadMap_Click(object sender, System.EventArgs e) { if( openFileDialogMap.ShowDialog(this) == DialogResult.OK ) { _segments.Clear(); ultraLabelLoadMapPath.Text = openFileDialogMap.FileName; try { XPathDocument messageDoc = new XPathDocument(openFileDialogMap.FileName); XPathNavigator nav = messageDoc.CreateNavigator(); XPathNodeIterator Iterator = nav.Select( textBoxXPath.Text ); while (Iterator.MoveNext()) { if( Iterator.Current.Value.Trim().Length == 3 ) _segments.Add(Iterator.Current.Value.Trim()); } int i = 0; i++; } catch( Exception ex ) { MessageBox.Show( ex.Message); } } } Thanks! -- The opinions stated above do not necessarily reflect those of St. Joseph's Hospital, The aforementioned institution takes no responsibility for the contents of this message. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
