Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 2nd, 2007, 11:03 PM
Authorized User
Points: 386, Level: 6
Points: 386, Level: 6 Points: 386, Level: 6 Points: 386, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2007
Location: windsor, toronto, Canada.
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default Create XML file - According to the Value, add elem

i'm using VB.NET.

i'm using this codes to create this XML.
Quote:
quote:
<Employee>
<EmpItem CV="120" PL1="2" PL2="3" /EmpItem>
<EmpItem Cv="2" PL1="6" PL2="4" /EmpItem>
<EmpIten Cv="234" PL1="4" PL"4" /EmpItem>
<DataName>
</Employee>
Code:
TextBox1.Text = "C:\Program\Emp.mdb"
If File.Exists(TextBox1.Text) Then
            Dim strSQL As String = "Select ItemID,pl11,pl12 from MG10 where ItemID <> 0"
            Dim myConnection As New OleDbConnection(strConn)
            myConnection.Open()
            Dim myCommand As OleDbCommand = New OleDbCommand(strSQL, myConnection)
            Dim myReader As OleDbDataReader = myCommand.ExecuteReader

            Dim myXWriter As XmlTextWriter
            Dim myWriter As StreamWriter
            Dim myStream As MemoryStream
            myStream = New MemoryStream

            myXWriter = New XmlTextWriter(myStream, Encoding.UTF8)
            myXWriter.Formatting = Formatting.Indented
            myXWriter.Indentation = 2

            myXWriter.WriteStartDocument()
            myXWriter.WriteStartElement("Employee")

           While myReader.Read
                myXWriter.WriteStartElement("Item")
                myXWriter.WriteAttributeString("CV", myReader(0))
                myXWriter.WriteAttributeString("PL1", myReader(1))
               myXWriter.WriteAttributeString("PL2", myReader(2))
                myXWriter.WriteEndElement()
            End While

            myXWriter.WriteFullEndElement()
            myXWriter.WriteFullEndElement()
            myXWriter.WriteEndDocument()
            myXWriter.Flush()

           myStream.Seek(0, SeekOrigin.Begin)

            Dim strConfig2 As String = New StreamReader(myStream).ReadToEnd()
            myWriter = File.CreateText("C:\Example.xml")
            myWriter.WriteLine(strConfig2)
            myWriter.Close()
        End If
anyway is there to create an XML like this...
Quote:
quote:
<Employee>
<EmpRange min="0" max="99">
<EmpItem Cv="2" PL1="6" PL2="4">
</EmpRange>
<EmpRange min="100" max="199">
<EmpItem CV="120" PL1="2" PL2="3">
</EmpRange>
<EmpRange min="200" max="299">
<EmpIten Cv="234" PL1="4" PL"4">
<EmpRange>
<DataName>
</Employee>
according to the CV values can i add the EmpItems in corresponding Range. and the CV values will be random numbers. so if CV value is 34 then it should be under <EmpRange min="0" max="99">. likewise can we create an XML file to add EmpItems according to the range the CV value.

if you have any idea how to create this please help me... if you can provide any help then it will be a great help for me....

thanks in advanace.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to insert one xml file into another as an elem sushant raut XSLT 5 December 21st, 2007 01:04 AM
Create XML file - add elements according to range remya1000 XML 5 October 3rd, 2007 02:50 PM
Create a new XML file with vbscript sswingle XML 4 April 24th, 2006 07:31 AM
Problem to create an xml file from two xml files saurabh_inblore XSLT 1 April 12th, 2006 02:58 AM
create xml file using c# kk_katepally General .NET 2 February 11th, 2005 02:59 AM



All times are GMT -4. The time now is 02:57 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.