locked
VB.Net read xmlfile and create array from data RRS feed

  • Question

  • I have an xml file that I would like to read and if one of the values is true I would like to take information and build an array.

    Here is a snipet of my xml file.

            <property iskey="true" isnull="true" name="Item7">
              <property name="ImageIndex">-1</property>
              <property name="ImageAlignment">Near</property>
              <property name="Caption">REV</property>
              <property name="FieldName">Revision Number</property>
              <property name="FieldNameSort"/>
              <property name="VisibleIndex">6</property>
              <property name="Visible">true</property>
              <property iskey="true" isnull="true" name="Format">
                <property name="FormatString"/>
                <property name="FormatType">None</property>
          </property>
              <property name="Width">31</property>
              <property name="SeparatorWidth">0</property>
              <property name="MinWidth">20</property>
              <property name="MaxWidth">0</property>
              <property name="RowFooterSummary">None</property>
              <property name="SummaryFooter">None</property>
              <property name="AllNodesSummary">false</property>
              <property name="RowFooterSummaryStrFormat">{0}</property>
              <property name="SummaryFooterStrFormat">{0}</property>
              <property name="Tag" type="System.String">0</property>
        </property>
            <property iskey="true" isnull="true" name="Item8">
              <property name="ImageIndex">-1</property>
              <property name="ImageAlignment">Near</property>
              <property name="Caption">Base QTY</property>
              <property name="FieldName">Base Quantity</property>
              <property name="FieldNameSort"/>
              <property name="VisibleIndex">-1</property>
              <property name="Visible">false</property>
              <property iskey="true" isnull="true" name="Format">
                <property name="FormatString"/>
                <property name="FormatType">None</property>
          </property>

    The array would be a list of all the Captions if Visible = True.

    Friday, August 7, 2020 12:17 AM

Answers

  • Hi JRDumond,

    I made your latest XML sample a well-formed XML, and saved it to a file system as "e:\Temp\Dumont.xml" file.

    Here is VB.Net code that builds a List of strings based on your requirements.

    A 'smart' XPath expression allows to do that in one line of code.

    XML:

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <BOMLayouts Version="1">
    	<MergeSettings Enabled="1"/>
    	<AutoBestFit Enabled="0"/>
    	<Layout Index="0">
    		<XtraSerializer application="TreeListBlockSelector" version="1.0">
    			<property name="#LayoutVersion"/>
    			<property name="#LayoutScaleFactor">@1,Width=1@1,Height=1</property>
    			<property isnull="true" name="AutoFillColumn"/>
    			<property name="AutoFillFieldName"/>
    			<property isnull="true" name="HierarchyColumn"/>
    			<property name="HierarchyFieldName"/>
    			<property name="TreeViewFieldName"/>
    			<property isnull="true" name="TreeViewColumn"/>
    			<property name="ViewStyle">Default</property>
    			<property name="ImageIndexFieldName">ImageIndex</property>
    			<property name="KeyFieldName">ID</property>
    			<property name="ParentFieldName">ParentID</property>
    			<property name="ChildListFieldName"/>
    			<property name="PreviewFieldName"/>
    			<property name="CheckBoxFieldName"/>
    			<property iskey="true" isnull="true" name="OptionsView">
    				<property name="BestFitNodes">Visible</property>
    				<property name="AutoWidth">false</property>
    				<property name="FocusRectStyle">RowFullFocus</property>
    			</property>
    			<property iskey="true" isnull="true" name="OptionsSelection">
    				<property name="KeepSelectedOnClick">false</property>
    				<property name="EnableAppearanceFocusedRow">false</property>
    				<property name="EnableAppearanceFocusedCell">false</property>
    			</property>
    			<property iskey="true" isnull="true" name="OptionsBehavior">
    				<property name="Editable">false</property>
    				<property name="ResizeNodes">false</property>
    				<property name="AutoNodeHeight">false</property>
    				<property name="AutoChangeParent">false</property>
    				<property name="AllowExpandOnDblClick">false</property>
    				<property name="AutoPopulateColumns">false</property>
    			</property>
    			<property iskey="true" isnull="true" name="OptionsMenu">
    				<property name="EnableFooterMenu">false</property>
    			</property>
    			<property iskey="true" isnull="true" name="OptionsCustomization">
    				<property name="AllowFilter">false</property>
    			</property>
    			<property iskey="true" isnull="true" name="OptionsDragAndDrop">
    				<property name="DragNodesMode">Multiple</property>
    				<property name="ExpandNodeOnDrag">false</property>
    			</property>
    			<property name="BorderStyle">Default</property>
    			<property name="ShowButtonMode">ShowOnlyInEditor</property>
    			<property name="IndicatorWidth">12</property>
    			<property name="PreviewLineCount">1</property>
    			<property name="RowHeight">-1</property>
    			<property name="ColumnPanelRowHeight">-1</property>
    			<property name="BandPanelRowHeight">-1</property>
    			<property name="FooterPanelHeight">-1</property>
    			<property name="HorzScrollVisibility">Auto</property>
    			<property name="HorzScrollStep">3</property>
    			<property name="VertScrollVisibility">Auto</property>
    			<property name="CustomizationFormBounds">@1,X=0@1,Y=0@1,Width=0@1,Height=0</property>
    			<property iskey="true" name="Columns" value="47">
    				<property iskey="true" isnull="true" name="Item1">
    					<property name="ImageIndex">-1</property>
    					<property name="ImageAlignment">Near</property>
    					<property name="Caption">Part Number</property>
    					<property name="ToolTip"/>
    					<property name="CustomizationCaption"/>
    					<property name="FieldName">Part Number</property>
    					<property name="FieldNameSort"/>
    					<property name="Name">treeListPart Number</property>
    					<property name="AllowIncrementalSearch">true</property>
    					<property name="Fixed">None</property>
    					<property name="ColumnEditName"/>
    					<property name="ShowButtonMode">Default</property>
    					<property name="VisibleIndex">0</property>
    					<property name="Visible">true</property>
    					<property name="SortOrder">None</property>
    					<property name="SortIndex">-1</property>
    					<property name="SortMode">Custom</property>
    					<property name="FilterMode">Value</property>
    					<property name="ShowUnboundExpressionMenu">false</property>
    					<property iskey="true" isnull="true" name="Format">
    						<property name="FormatString"/>
    						<property name="FormatType">None</property>
    					</property>
    					<property name="Width">378</property>
    					<property name="SeparatorWidth">0</property>
    					<property name="MinWidth">81</property>
    					<property name="MaxWidth">0</property>
    					<property name="RowFooterSummary">None</property>
    					<property name="SummaryFooter">None</property>
    					<property name="AllNodesSummary">false</property>
    					<property name="RowFooterSummaryStrFormat">{0}</property>
    					<property name="SummaryFooterStrFormat">{0}</property>
    					<property name="Tag" type="System.String">0</property>
    					<property name="UnboundType">Object</property>
    					<property name="UnboundExpression"/>
    					<property name="RowIndex">0</property>
    					<property name="RowCount">1</property>
    				</property>
    				<property iskey="true" isnull="true" name="Item2">
    					<property name="ImageIndex">-1</property>
    					<property name="ImageAlignment">Near</property>
    					<property name="Caption">BOM Structure</property>
    					<property name="ToolTip"/>
    					<property name="CustomizationCaption"/>
    					<property name="FieldName">Default BOM Structure</property>
    					<property name="FieldNameSort"/>
    					<property name="Name">treeListDefault BOM Structure</property>
    					<property name="AllowIncrementalSearch">true</property>
    					<property name="Fixed">None</property>
    					<property name="ColumnEditName"/>
    					<property name="ShowButtonMode">Default</property>
    					<property name="VisibleIndex">2</property>
    					<property name="Visible">true</property>
    					<property name="SortOrder">None</property>
    					<property name="SortIndex">-1</property>
    					<property name="SortMode">Custom</property>
    					<property name="FilterMode">Value</property>
    					<property name="ShowUnboundExpressionMenu">false</property>
    					<property iskey="true" isnull="true" name="Format">
    						<property name="FormatString"/>
    						<property name="FormatType">None</property>
    					</property>
    					<property name="Width">84</property>
    					<property name="SeparatorWidth">0</property>
    					<property name="MinWidth">20</property>
    					<property name="MaxWidth">0</property>
    					<property name="RowFooterSummary">None</property>
    					<property name="SummaryFooter">None</property>
    					<property name="AllNodesSummary">false</property>
    					<property name="RowFooterSummaryStrFormat">{0}</property>
    					<property name="SummaryFooterStrFormat">{0}</property>
    					<property name="Tag" type="System.String">0</property>
    					<property name="UnboundType">Object</property>
    					<property name="UnboundExpression"/>
    					<property name="RowIndex">0</property>
    					<property name="RowCount">1</property>
    				</property>
    				<property iskey="true" isnull="true" name="Item3">
    					<property name="ImageIndex">-1</property>
    					<property name="ImageAlignment">Near</property>
    					<property name="Caption">Unit QTY</property>
    					<property name="ToolTip"/>
    					<property name="CustomizationCaption"/>
    					<property name="FieldName">Unit Quantity</property>
    					<property name="FieldNameSort"/>
    					<property name="Name">treeListUnit Quantity</property>
    					<property name="AllowIncrementalSearch">true</property>
    					<property name="Fixed">None</property>
    					<property name="ColumnEditName"/>
    					<property name="ShowButtonMode">Default</property>
    					<property name="VisibleIndex">3</property>
    					<property name="Visible">true</property>
    					<property name="SortOrder">None</property>
    					<property name="SortIndex">-1</property>
    					<property name="SortMode">Custom</property>
    					<property name="FilterMode">Value</property>
    					<property name="ShowUnboundExpressionMenu">false</property>
    					<property iskey="true" isnull="true" name="Format">
    						<property name="FormatString"/>
    						<property name="FormatType">None</property>
    					</property>
    					<property name="Width">54</property>
    					<property name="SeparatorWidth">0</property>
    					<property name="MinWidth">20</property>
    					<property name="MaxWidth">0</property>
    					<property name="RowFooterSummary">None</property>
    					<property name="SummaryFooter">None</property>
    					<property name="AllNodesSummary">false</property>
    					<property name="RowFooterSummaryStrFormat">{0}</property>
    					<property name="SummaryFooterStrFormat">{0}</property>
    					<property name="Tag" type="System.String">0</property>
    					<property name="UnboundType">Object</property>
    					<property name="UnboundExpression"/>
    					<property name="RowIndex">0</property>
    					<property name="RowCount">1</property>
    				</property>
    			</property>
    		</XtraSerializer>
    	</Layout>
    </BOMLayouts>

    VB.Net:

    Sub Main Const fileName As String = "e:\Temp\Dumont.xml" Dim xdoc As XDocument = XDocument.Load(fileName) Dim items = xdoc.XPathSelectElements("//property[@name='Caption'][following-sibling::property[@name='Visible'][.='true']]") items.[Select](Function(item) item.Value).ToList()

    ' or Array of strings

    items.[Select](Function(item) item.Value).ToArray() End Sub

    Result:

    Friday, August 7, 2020 3:51 AM

All replies

  • Hi JRDumont,

    Please edit your post and make the XML well-formed.

    Otherwise, it is impossible to show it to you how to process it.


    Friday, August 7, 2020 1:38 AM
  • Here is a more complete list of the xml file.

    Please letme know if this is enough.

    <?xml version="1.0" encoding="utf-8" standalone="no" ?>
    <BOMLayouts Version="1">

      <MergeSettings Enabled="1"/>

      <AutoBestFit Enabled="0"/>

      <Layout Index="0">
        <XtraSerializer application="TreeListBlockSelector" version="1.0">
          <property name="#LayoutVersion"/>
          <property name="#LayoutScaleFactor">@1,Width=1@1,Height=1</property>
          <property isnull="true" name="AutoFillColumn"/>
          <property name="AutoFillFieldName"/>
          <property isnull="true" name="HierarchyColumn"/>
          <property name="HierarchyFieldName"/>
          <property name="TreeViewFieldName"/>
          <property isnull="true" name="TreeViewColumn"/>
          <property name="ViewStyle">Default</property>
          <property name="ImageIndexFieldName">ImageIndex</property>
          <property name="KeyFieldName">ID</property>
          <property name="ParentFieldName">ParentID</property>
          <property name="ChildListFieldName"/>
          <property name="PreviewFieldName"/>
          <property name="CheckBoxFieldName"/>
          <property iskey="true" isnull="true" name="OptionsView">
            <property name="BestFitNodes">Visible</property>
            <property name="AutoWidth">false</property>
            <property name="FocusRectStyle">RowFullFocus</property>
      </property>
          <property iskey="true" isnull="true" name="OptionsSelection">
            <property name="KeepSelectedOnClick">false</property>
            <property name="EnableAppearanceFocusedRow">false</property>
            <property name="EnableAppearanceFocusedCell">false</property>
      </property>
          <property iskey="true" isnull="true" name="OptionsBehavior">
            <property name="Editable">false</property>
            <property name="ResizeNodes">false</property>
            <property name="AutoNodeHeight">false</property>
            <property name="AutoChangeParent">false</property>
            <property name="AllowExpandOnDblClick">false</property>
            <property name="AutoPopulateColumns">false</property>
      </property>
          <property iskey="true" isnull="true" name="OptionsMenu">
            <property name="EnableFooterMenu">false</property>
      </property>
          <property iskey="true" isnull="true" name="OptionsCustomization">
            <property name="AllowFilter">false</property>
      </property>
          <property iskey="true" isnull="true" name="OptionsDragAndDrop">
            <property name="DragNodesMode">Multiple</property>
            <property name="ExpandNodeOnDrag">false</property>
      </property>
          <property name="BorderStyle">Default</property>
          <property name="ShowButtonMode">ShowOnlyInEditor</property>
          <property name="IndicatorWidth">12</property>
          <property name="PreviewLineCount">1</property>
          <property name="RowHeight">-1</property>
          <property name="ColumnPanelRowHeight">-1</property>
          <property name="BandPanelRowHeight">-1</property>
          <property name="FooterPanelHeight">-1</property>
          <property name="HorzScrollVisibility">Auto</property>
          <property name="HorzScrollStep">3</property>
          <property name="VertScrollVisibility">Auto</property>
          <property name="CustomizationFormBounds">@1,X=0@1,Y=0@1,Width=0@1,Height=0</property>
          <property iskey="true" name="Columns" value="47">
            <property iskey="true" isnull="true" name="Item1">
              <property name="ImageIndex">-1</property>
              <property name="ImageAlignment">Near</property>
              <property name="Caption">Part Number</property>
              <property name="ToolTip"/>
              <property name="CustomizationCaption"/>
              <property name="FieldName">Part Number</property>
              <property name="FieldNameSort"/>
              <property name="Name">treeListPart Number</property>
              <property name="AllowIncrementalSearch">true</property>
              <property name="Fixed">None</property>
              <property name="ColumnEditName"/>
              <property name="ShowButtonMode">Default</property>
              <property name="VisibleIndex">0</property>
              <property name="Visible">true</property>
              <property name="SortOrder">None</property>
              <property name="SortIndex">-1</property>
              <property name="SortMode">Custom</property>
              <property name="FilterMode">Value</property>
              <property name="ShowUnboundExpressionMenu">false</property>
              <property iskey="true" isnull="true" name="Format">
                <property name="FormatString"/>
                <property name="FormatType">None</property>
          </property>
              <property name="Width">378</property>
              <property name="SeparatorWidth">0</property>
              <property name="MinWidth">81</property>
              <property name="MaxWidth">0</property>
              <property name="RowFooterSummary">None</property>
              <property name="SummaryFooter">None</property>
              <property name="AllNodesSummary">false</property>
              <property name="RowFooterSummaryStrFormat">{0}</property>
              <property name="SummaryFooterStrFormat">{0}</property>
              <property name="Tag" type="System.String">0</property>
              <property name="UnboundType">Object</property>
              <property name="UnboundExpression"/>
              <property name="RowIndex">0</property>
              <property name="RowCount">1</property>
        </property>
            <property iskey="true" isnull="true" name="Item2">
              <property name="ImageIndex">-1</property>
              <property name="ImageAlignment">Near</property>
              <property name="Caption">BOM Structure</property>
              <property name="ToolTip"/>
              <property name="CustomizationCaption"/>
              <property name="FieldName">Default BOM Structure</property>
              <property name="FieldNameSort"/>
              <property name="Name">treeListDefault BOM Structure</property>
              <property name="AllowIncrementalSearch">true</property>
              <property name="Fixed">None</property>
              <property name="ColumnEditName"/>
              <property name="ShowButtonMode">Default</property>
              <property name="VisibleIndex">2</property>
              <property name="Visible">true</property>
              <property name="SortOrder">None</property>
              <property name="SortIndex">-1</property>
              <property name="SortMode">Custom</property>
              <property name="FilterMode">Value</property>
              <property name="ShowUnboundExpressionMenu">false</property>
              <property iskey="true" isnull="true" name="Format">
                <property name="FormatString"/>
                <property name="FormatType">None</property>
          </property>
              <property name="Width">84</property>
              <property name="SeparatorWidth">0</property>
              <property name="MinWidth">20</property>
              <property name="MaxWidth">0</property>
              <property name="RowFooterSummary">None</property>
              <property name="SummaryFooter">None</property>
              <property name="AllNodesSummary">false</property>
              <property name="RowFooterSummaryStrFormat">{0}</property>
              <property name="SummaryFooterStrFormat">{0}</property>
              <property name="Tag" type="System.String">0</property>
              <property name="UnboundType">Object</property>
              <property name="UnboundExpression"/>
              <property name="RowIndex">0</property>
              <property name="RowCount">1</property>
        </property>
            <property iskey="true" isnull="true" name="Item3">
              <property name="ImageIndex">-1</property>
              <property name="ImageAlignment">Near</property>
              <property name="Caption">Unit QTY</property>
              <property name="ToolTip"/>
              <property name="CustomizationCaption"/>
              <property name="FieldName">Unit Quantity</property>
              <property name="FieldNameSort"/>
              <property name="Name">treeListUnit Quantity</property>
              <property name="AllowIncrementalSearch">true</property>
              <property name="Fixed">None</property>
              <property name="ColumnEditName"/>
              <property name="ShowButtonMode">Default</property>
              <property name="VisibleIndex">3</property>
              <property name="Visible">true</property>
              <property name="SortOrder">None</property>
              <property name="SortIndex">-1</property>
              <property name="SortMode">Custom</property>
              <property name="FilterMode">Value</property>
              <property name="ShowUnboundExpressionMenu">false</property>
              <property iskey="true" isnull="true" name="Format">
                <property name="FormatString"/>
                <property name="FormatType">None</property>
          </property>
              <property name="Width">54</property>
              <property name="SeparatorWidth">0</property>
              <property name="MinWidth">20</property>
              <property name="MaxWidth">0</property>
              <property name="RowFooterSummary">None</property>
              <property name="SummaryFooter">None</property>
              <property name="AllNodesSummary">false</property>
              <property name="RowFooterSummaryStrFormat">{0}</property>
              <property name="SummaryFooterStrFormat">{0}</property>
              <property name="Tag" type="System.String">0</property>
              <property name="UnboundType">Object</property>
              <property name="UnboundExpression"/>
              <property name="RowIndex">0</property>
              <property name="RowCount">1</property>

    Friday, August 7, 2020 2:09 AM
  • Hi JRDumond,

    I made your latest XML sample a well-formed XML, and saved it to a file system as "e:\Temp\Dumont.xml" file.

    Here is VB.Net code that builds a List of strings based on your requirements.

    A 'smart' XPath expression allows to do that in one line of code.

    XML:

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <BOMLayouts Version="1">
    	<MergeSettings Enabled="1"/>
    	<AutoBestFit Enabled="0"/>
    	<Layout Index="0">
    		<XtraSerializer application="TreeListBlockSelector" version="1.0">
    			<property name="#LayoutVersion"/>
    			<property name="#LayoutScaleFactor">@1,Width=1@1,Height=1</property>
    			<property isnull="true" name="AutoFillColumn"/>
    			<property name="AutoFillFieldName"/>
    			<property isnull="true" name="HierarchyColumn"/>
    			<property name="HierarchyFieldName"/>
    			<property name="TreeViewFieldName"/>
    			<property isnull="true" name="TreeViewColumn"/>
    			<property name="ViewStyle">Default</property>
    			<property name="ImageIndexFieldName">ImageIndex</property>
    			<property name="KeyFieldName">ID</property>
    			<property name="ParentFieldName">ParentID</property>
    			<property name="ChildListFieldName"/>
    			<property name="PreviewFieldName"/>
    			<property name="CheckBoxFieldName"/>
    			<property iskey="true" isnull="true" name="OptionsView">
    				<property name="BestFitNodes">Visible</property>
    				<property name="AutoWidth">false</property>
    				<property name="FocusRectStyle">RowFullFocus</property>
    			</property>
    			<property iskey="true" isnull="true" name="OptionsSelection">
    				<property name="KeepSelectedOnClick">false</property>
    				<property name="EnableAppearanceFocusedRow">false</property>
    				<property name="EnableAppearanceFocusedCell">false</property>
    			</property>
    			<property iskey="true" isnull="true" name="OptionsBehavior">
    				<property name="Editable">false</property>
    				<property name="ResizeNodes">false</property>
    				<property name="AutoNodeHeight">false</property>
    				<property name="AutoChangeParent">false</property>
    				<property name="AllowExpandOnDblClick">false</property>
    				<property name="AutoPopulateColumns">false</property>
    			</property>
    			<property iskey="true" isnull="true" name="OptionsMenu">
    				<property name="EnableFooterMenu">false</property>
    			</property>
    			<property iskey="true" isnull="true" name="OptionsCustomization">
    				<property name="AllowFilter">false</property>
    			</property>
    			<property iskey="true" isnull="true" name="OptionsDragAndDrop">
    				<property name="DragNodesMode">Multiple</property>
    				<property name="ExpandNodeOnDrag">false</property>
    			</property>
    			<property name="BorderStyle">Default</property>
    			<property name="ShowButtonMode">ShowOnlyInEditor</property>
    			<property name="IndicatorWidth">12</property>
    			<property name="PreviewLineCount">1</property>
    			<property name="RowHeight">-1</property>
    			<property name="ColumnPanelRowHeight">-1</property>
    			<property name="BandPanelRowHeight">-1</property>
    			<property name="FooterPanelHeight">-1</property>
    			<property name="HorzScrollVisibility">Auto</property>
    			<property name="HorzScrollStep">3</property>
    			<property name="VertScrollVisibility">Auto</property>
    			<property name="CustomizationFormBounds">@1,X=0@1,Y=0@1,Width=0@1,Height=0</property>
    			<property iskey="true" name="Columns" value="47">
    				<property iskey="true" isnull="true" name="Item1">
    					<property name="ImageIndex">-1</property>
    					<property name="ImageAlignment">Near</property>
    					<property name="Caption">Part Number</property>
    					<property name="ToolTip"/>
    					<property name="CustomizationCaption"/>
    					<property name="FieldName">Part Number</property>
    					<property name="FieldNameSort"/>
    					<property name="Name">treeListPart Number</property>
    					<property name="AllowIncrementalSearch">true</property>
    					<property name="Fixed">None</property>
    					<property name="ColumnEditName"/>
    					<property name="ShowButtonMode">Default</property>
    					<property name="VisibleIndex">0</property>
    					<property name="Visible">true</property>
    					<property name="SortOrder">None</property>
    					<property name="SortIndex">-1</property>
    					<property name="SortMode">Custom</property>
    					<property name="FilterMode">Value</property>
    					<property name="ShowUnboundExpressionMenu">false</property>
    					<property iskey="true" isnull="true" name="Format">
    						<property name="FormatString"/>
    						<property name="FormatType">None</property>
    					</property>
    					<property name="Width">378</property>
    					<property name="SeparatorWidth">0</property>
    					<property name="MinWidth">81</property>
    					<property name="MaxWidth">0</property>
    					<property name="RowFooterSummary">None</property>
    					<property name="SummaryFooter">None</property>
    					<property name="AllNodesSummary">false</property>
    					<property name="RowFooterSummaryStrFormat">{0}</property>
    					<property name="SummaryFooterStrFormat">{0}</property>
    					<property name="Tag" type="System.String">0</property>
    					<property name="UnboundType">Object</property>
    					<property name="UnboundExpression"/>
    					<property name="RowIndex">0</property>
    					<property name="RowCount">1</property>
    				</property>
    				<property iskey="true" isnull="true" name="Item2">
    					<property name="ImageIndex">-1</property>
    					<property name="ImageAlignment">Near</property>
    					<property name="Caption">BOM Structure</property>
    					<property name="ToolTip"/>
    					<property name="CustomizationCaption"/>
    					<property name="FieldName">Default BOM Structure</property>
    					<property name="FieldNameSort"/>
    					<property name="Name">treeListDefault BOM Structure</property>
    					<property name="AllowIncrementalSearch">true</property>
    					<property name="Fixed">None</property>
    					<property name="ColumnEditName"/>
    					<property name="ShowButtonMode">Default</property>
    					<property name="VisibleIndex">2</property>
    					<property name="Visible">true</property>
    					<property name="SortOrder">None</property>
    					<property name="SortIndex">-1</property>
    					<property name="SortMode">Custom</property>
    					<property name="FilterMode">Value</property>
    					<property name="ShowUnboundExpressionMenu">false</property>
    					<property iskey="true" isnull="true" name="Format">
    						<property name="FormatString"/>
    						<property name="FormatType">None</property>
    					</property>
    					<property name="Width">84</property>
    					<property name="SeparatorWidth">0</property>
    					<property name="MinWidth">20</property>
    					<property name="MaxWidth">0</property>
    					<property name="RowFooterSummary">None</property>
    					<property name="SummaryFooter">None</property>
    					<property name="AllNodesSummary">false</property>
    					<property name="RowFooterSummaryStrFormat">{0}</property>
    					<property name="SummaryFooterStrFormat">{0}</property>
    					<property name="Tag" type="System.String">0</property>
    					<property name="UnboundType">Object</property>
    					<property name="UnboundExpression"/>
    					<property name="RowIndex">0</property>
    					<property name="RowCount">1</property>
    				</property>
    				<property iskey="true" isnull="true" name="Item3">
    					<property name="ImageIndex">-1</property>
    					<property name="ImageAlignment">Near</property>
    					<property name="Caption">Unit QTY</property>
    					<property name="ToolTip"/>
    					<property name="CustomizationCaption"/>
    					<property name="FieldName">Unit Quantity</property>
    					<property name="FieldNameSort"/>
    					<property name="Name">treeListUnit Quantity</property>
    					<property name="AllowIncrementalSearch">true</property>
    					<property name="Fixed">None</property>
    					<property name="ColumnEditName"/>
    					<property name="ShowButtonMode">Default</property>
    					<property name="VisibleIndex">3</property>
    					<property name="Visible">true</property>
    					<property name="SortOrder">None</property>
    					<property name="SortIndex">-1</property>
    					<property name="SortMode">Custom</property>
    					<property name="FilterMode">Value</property>
    					<property name="ShowUnboundExpressionMenu">false</property>
    					<property iskey="true" isnull="true" name="Format">
    						<property name="FormatString"/>
    						<property name="FormatType">None</property>
    					</property>
    					<property name="Width">54</property>
    					<property name="SeparatorWidth">0</property>
    					<property name="MinWidth">20</property>
    					<property name="MaxWidth">0</property>
    					<property name="RowFooterSummary">None</property>
    					<property name="SummaryFooter">None</property>
    					<property name="AllNodesSummary">false</property>
    					<property name="RowFooterSummaryStrFormat">{0}</property>
    					<property name="SummaryFooterStrFormat">{0}</property>
    					<property name="Tag" type="System.String">0</property>
    					<property name="UnboundType">Object</property>
    					<property name="UnboundExpression"/>
    					<property name="RowIndex">0</property>
    					<property name="RowCount">1</property>
    				</property>
    			</property>
    		</XtraSerializer>
    	</Layout>
    </BOMLayouts>

    VB.Net:

    Sub Main Const fileName As String = "e:\Temp\Dumont.xml" Dim xdoc As XDocument = XDocument.Load(fileName) Dim items = xdoc.XPathSelectElements("//property[@name='Caption'][following-sibling::property[@name='Visible'][.='true']]") items.[Select](Function(item) item.Value).ToList()

    ' or Array of strings

    items.[Select](Function(item) item.Value).ToArray() End Sub

    Result:

    Friday, August 7, 2020 3:51 AM
  • Thank you so much for your time and your solution.

    My apologies for not understanding what a well formed xml meant.

    I will be adding this code to program immediately.

    Friday, August 7, 2020 11:05 AM
  • Hi JRDumond,

    Good to hear that the proposed solution is working for you.

    P.S. Please connect with me on LinkedIn.

    Friday, August 7, 2020 11:51 AM
  • Hi Yitzhak,

    Yes, thank you. However, based on your input I realized I have other issues with reading the xml file.

    Can I ask here or do I create another question?

    Friday, August 7, 2020 3:26 PM
  • Hi JRDumond,

    Please create a new post for it.

    P.S. Please connect with me on LinkedIn.

    Friday, August 7, 2020 3:31 PM