This is the xml I got as an output from the WriteXmlString() of Infragistics ultrawebtree. I am using this to create another Infragistics ultrawebtree with the same structure. But here I don’t want the <Url>something.aspx..</Url>. I want that to be like this <Url><\Url>. So how I can able to remove. This I get as a String. So I used Regex.Replace(). But it will work for certain conditions,but for some case it will destruct the xml by deleting some xml tags and xml became not valid due to missing of tags.
I used this expression <Url>\S*</Url> to avoid the contents of Url. Any help will be very helpful. Thanks in advance.
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
- <InfragisticsServerTree XmlVersion="1.0">
- <uwtModule>
- <ProjectProperties>
<ComponentTarget>ClassicTree</ComponentTarget>
<BrowserTarget>Auto</BrowserTarget>
</ProjectProperties>
- <TreeProperties>
<MaxDataBindDepth>-1</MaxDataBindDepth>
<Name>uwtModule</Name>
<Indentation>20</Indentation>
<SubMenuImage>igNone</SubMenuImage>
<LoadOnDemandPrompt>
<b>Loading...</b>
</LoadOnDemandPrompt>
<ExpandAnimation>Decelerate</ExpandAnimation>
<ExpandOnClick>false</ExpandOnClick>
<CompactRendering>false</CompactRendering>
<RenderAnchors>false</RenderAnchors>
- <Style>
<ForeColor>-16777216</ForeColor>
<BorderColor>-4144960</BorderColor>
<BorderStyle>None</BorderStyle>
<BorderWidth>1px</BorderWidth>
- <Font>
<Name>Arial</Name>
- <Names>
<Name>Arial</Name>
</Names>
<Size>11px</Size>
</Font>
<Height>425px</Height>
<Width>97%</Width>
- <Padding>
<Top>5px</Top>
<Left>5px</Left>
<Right>5px</Right>
<Bottom>5px</Bottom>
</Padding>
</Style>
- <SelectedNodeStyle>
<BackColor>-2894893</BackColor>
<ForeColor>-16777216</ForeColor>
- <Padding>
<Top>2px</Top>
<Left>2px</Left>
<Right>2px</Right>
<Bottom>2px</Bottom>
</Padding>
</SelectedNodeStyle>
</TreeProperties>
<Styles />
- <Levels>
- <Level>
<Number>0</Number>
</Level>
</Levels>
- <Nodes>
- <Node>
<Text>123</Text>
<Url>ModuleEdit.aspx?ModuleID=965</Url>
<Target>main</Target>
<Tag>965</Tag>
<Title>AccptChangesPerfPM</Title>
<Expanded>true</Expanded>
- <Nodes>
- <Node>
<Text>111</Text>
<Url>123.aspx?e=965 </Url>
<Target>main</Target>
<Tag>TL_-99999</Tag>
</Node>
- <Node>
<Text>werrv</Text>
<Url>1dfee.aspx?qwe=9er65</Url>
<Target>main</Target>
<Tag>12DDfe</Tag>
</Node>
- <Node>
<Text>q2233</Text>
<Target>main</Target>
<Tag>TL_1015</Tag>
<Title>Topic_1</Title>
<ShowExpand>true</ShowExpand>
- <Nodes>
- <Node>
<Text>T1</Text>
<Url>w3345_954y65.aspx?ID=965er</Url>
<Target>main</Target>
- <Style>
<ForeColor>-16777216</ForeColor>
</Style>
<Tag>82355</Tag>
<Title>T1</Title>
</Node>
- <Node>
<Text>T2</Text>
<Url>23_7811.aspx?ID=3u65</Url>
<Target>main</Target>
- <Style>
<ForeColor>-16777216</ForeColor>
</Style>
<Tag>82356</Tag>
<Title>T2</Title>
</Node>
- <Node>
<Text>T3</Text>
<Url>we456_9.aspx?ID=4r56</Url>
<Target>main</Target>
- <Style>
<ForeColor>-16777216</ForeColor>
</Style>
<Tag>82357</Tag>
<Title>T3</Title>
</Node>
</Nodes>
</Node>
</Nodes>
</Node>
</Nodes>
</uwtModule>
</InfragisticsServerTree>
My advice is ignore regular expressions.
Go For XML class’s of VB to read it from file,
then work with the nodelists and nodes.
Here are some links to get you starting:
Create XML in VB#
Modify XML literals in VB#
Samples of multiple actions on XML files in VB#
[VB.NET] XML – Create and Merge Files. Edit, Add and Delete Nodes.
In the links above you’ll find heavy documentation and samples how to open, edit, create, merge.
Below its a how to do what you asked above.:
But with a fair warning: This is C# you’ll need to use the above links to convert as i’m not much of a VB.Net developer