473,386 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

recursion xml element?

i have a unusual problem or maybe to me :)

i have a xml file that i need to insert xml element from a string

string - /Box/BoxTest/Test

i have a function that seperate the string out into arraylist and turn it
into string array

string array 0(array index) - "", 1 - Box, 2 - BoxTest, 3 - Test

when first search the xml file if there is no Box as objectname then insert
the xml element from a template xml file

<FacilityPage AnimationInterval="500" BackgroundColor="#FFFFFF"
BackgroundImage="" InstanceNumber="1017" RefreshInterval="10">
<BackwardReferences/>
<DetailPages AllowCreate="1" AllowDelete="1">
</DetailPages>
<FacilityItems AllowCreate="1" AllowDelete="1"/>
<GeneralProperties Attr="0" InstanceNumber="1017" IsConfigured="0"
ObjectName="GROUP" ObjectType="311" SchemaVer="1.4" TraceOptions="">
<Description/>
</GeneralProperties>
</FacilityPage>

i change the attribute of instance number and objectname and the objectname
is Box and this is an xml element inside a xml file. here is the fragment of
the xml file

<FacilityPage AnimationInterval="500" BackgroundColor="#FFFFFF"
BackgroundImage="" InstanceNumber="1094" RefreshInterval="10">
<BackwardReferences/>
<DetailPages AllowCreate="1" AllowDelete="1"/>
<FacilityItems AllowCreate="1" AllowDelete="1"/>
<GeneralProperties Attr="2" InstanceNumber="1094" IsConfigured="0"
ObjectName="HomePage" ObjectType="311" SchemaVer="1.4" TraceOptions="">
<Description><![CDATA[Index page]]></Description>
</GeneralProperties>
</FacilityPage>
<FacilityPage AnimationInterval="500" BackgroundColor="#FFFFFF"
BackgroundImage="" InstanceNumber="1096" RefreshInterval="10">
<BackwardReferences/>
<DetailPages AllowCreate="1" AllowDelete="1"/>
<FacilityItems AllowCreate="1" AllowDelete="1"/>
<GeneralProperties Attr="0" InstanceNumber="1096" IsConfigured="0"
ObjectName="Box" ObjectType="311" SchemaVer="1.4" TraceOptions="">
<Description/>
</GeneralProperties>
</FacilityPage>

the next item on the array BoxTest should go under the Box xml element
between the DetailPage tag as an xml element and so and so for.

does anyone know how to do this?

thank
Sep 6 '06 #1
1 1407
If I don't misunderstand you are needing to insert an element under another
one and then work with it.
One way to do this is using an XMLDocument with an XPath instruction to
catch the node.
Once obtained the node you can add it atributes, text, etc.

"dotnetnoob" <do********@discussions.microsoft.comwrote in message
news:7B**********************************@microsof t.com...
>i have a unusual problem or maybe to me :)

i have a xml file that i need to insert xml element from a string

string - /Box/BoxTest/Test

i have a function that seperate the string out into arraylist and turn it
into string array

string array 0(array index) - "", 1 - Box, 2 - BoxTest, 3 - Test

when first search the xml file if there is no Box as objectname then
insert
the xml element from a template xml file

<FacilityPage AnimationInterval="500" BackgroundColor="#FFFFFF"
BackgroundImage="" InstanceNumber="1017" RefreshInterval="10">
<BackwardReferences/>
<DetailPages AllowCreate="1" AllowDelete="1">
</DetailPages>
<FacilityItems AllowCreate="1" AllowDelete="1"/>
<GeneralProperties Attr="0" InstanceNumber="1017" IsConfigured="0"
ObjectName="GROUP" ObjectType="311" SchemaVer="1.4" TraceOptions="">
<Description/>
</GeneralProperties>
</FacilityPage>

i change the attribute of instance number and objectname and the
objectname
is Box and this is an xml element inside a xml file. here is the fragment
of
the xml file

<FacilityPage AnimationInterval="500" BackgroundColor="#FFFFFF"
BackgroundImage="" InstanceNumber="1094" RefreshInterval="10">
<BackwardReferences/>
<DetailPages AllowCreate="1" AllowDelete="1"/>
<FacilityItems AllowCreate="1" AllowDelete="1"/>
<GeneralProperties Attr="2" InstanceNumber="1094" IsConfigured="0"
ObjectName="HomePage" ObjectType="311" SchemaVer="1.4" TraceOptions="">
<Description><![CDATA[Index page]]></Description>
</GeneralProperties>
</FacilityPage>
<FacilityPage AnimationInterval="500" BackgroundColor="#FFFFFF"
BackgroundImage="" InstanceNumber="1096" RefreshInterval="10">
<BackwardReferences/>
<DetailPages AllowCreate="1" AllowDelete="1"/>
<FacilityItems AllowCreate="1" AllowDelete="1"/>
<GeneralProperties Attr="0" InstanceNumber="1096" IsConfigured="0"
ObjectName="Box" ObjectType="311" SchemaVer="1.4" TraceOptions="">
<Description/>
</GeneralProperties>
</FacilityPage>

the next item on the array BoxTest should go under the Box xml element
between the DetailPage tag as an xml element and so and so for.

does anyone know how to do this?

thank

Sep 7 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: paulw | last post by:
Hi Please give problems that "HAS TO" to use recursion (recursive calls to itself.) Preferrably real world examples, not knights tour. I'm thinking about eliminating the use of stack... ...
15
by: Gigs_ | last post by:
Can someone explain me this if l == : return else: return f(l) + l # <= cant figure this, how is all sum at the end? thanks!
14
RMWChaos
by: RMWChaos | last post by:
Firebug is reporting "too much recursion" when I attempt to create a child element in a parent that doesn't exist yet. The script should automatically create the missing parent before going on to...
7
by: samelzoro | last post by:
here is a problem in recursion: unexpected result ? by this program I just want to convert xml dom's document object to xml-string. (for all browsers) //load a xml function...
10
by: slix | last post by:
Recursion is awesome for writing some functions, like searching trees etc but wow how can it be THAT much slower for computing fibonacci- numbers? is the recursive definition counting fib 1 to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.