473,657 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Best wa to Read, Write/Create XML-Files

Hello,

I have to solve the following task:
- create an editor-application in c# to read, modify and create
xml-files
- .xsd-schema-file is available and can be used

Currently, I am thinking of the following way to do the job:
- use xsd.exe to create basic c#-classes from xsd.file (modify these
classes according to my particular needs)
- read xml-file and create according object-hyrarchie with the classes
(READ)
- serialize the classes to create xml-file (WRITE)

Is this a good way to do the job?
Do you have better suggestions?

Is it necessary to create static classes from the xsd-file (using
xsd.exe)
or is there a way to do that dynamically during runtime?

I appreciate your help on this!
Thanks!

Nov 13 '05 #1
1 1593
On 13 Nov 2005 13:21:15 -0800, ez*******@gmx.d e wrote:
Hello,

I have to solve the following task:
- create an editor-application in c# to read, modify and create
xml-files
- .xsd-schema-file is available and can be used

Currently, I am thinking of the following way to do the job:
- use xsd.exe to create basic c#-classes from xsd.file (modify these
classes according to my particular needs)
- read xml-file and create according object-hyrarchie with the classes
(READ)
- serialize the classes to create xml-file (WRITE)

Is this a good way to do the job?
Do you have better suggestions?

Is it necessary to create static classes from the xsd-file (using
xsd.exe)
or is there a way to do that dynamically during runtime?

I appreciate your help on this!
Thanks!


Don't bother with XSD.EXE unless you have fixed schemas and want to create
objects that conform to it.
If you are creating a generic editor then this is pointless. If you want
something to allow freeform editing then write it as a text editor, then
validate it using the built-in validation methods.

Cheers,
Jason
Nov 14 '05 #2

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

Similar topics

1
6817
by: bdinmstig | last post by:
I refined my attempt a little further, and the following code does seem to work, however it has 2 major problems: 1. Very limited support for XPath features Basic paths are supported for elements, attributes, ".", and "..", plus also the "" predicate format is supported - however, only one predicate per path step is supported, and expr must be a relative path. 2. Poor performance
4
2414
by: Bill Cohagan | last post by:
I'm writing a console app in c# and am encountering a strange problem. I'm trying to use redirection of the standard input stream to read input from a (xml) file. The following code snippet is from this app: =============================== static void Main(string args) { if (args.Length > 0) Console.SetIn(new StreamReader(args)); //executes if I don't use the "<", ">" redirection syntax when invoking XmlTextReader xmlin = new...
16
3018
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For example dsParts.xsd and including that in the data tier. I then will create a class that looks like this Public Class CPart Inherits dsParts
10
1695
by: Neil | last post by:
I need to get two values from a complex SQL statement which returns a single record and use those two values to update a single record in a table. In order to assign those two values to variables and then use those variables in the UPDATE statement, I created a cursor and used Fetch Next.... Into. This way, I only have to call the complex SQL once instead of twice. This seems like the best way to go. However, I've always used cursors for...
7
11052
by: Jimbo | last post by:
What's the best format to save a configuration file? I'm currently using an INI extension and I write it like a normal ascii file. Is this the best way? I've heard of using XML to create a config file. What would be the best format? Thank you.
3
2853
by: WebMatrix | last post by:
I am struggling with implementing somewhat complicated UI web-control. I explored Repeater, but I am not sure if it's the best way to go. I am leaning towards writing my own custom control and creating elements on the fly dynamically. I have a control that needs to display 3 columns and n number of rows depending on number of records. Sounds simple. But each Row has a control with its own data source binding and value must be selected...
11
2417
by: Tom | last post by:
I am planning on adding a Preferences form to my application and using the Property Grid to display the preferences to the user. What do you think would be the best way to save these preferences out to an XML file? Use the CAB (Configuration Application Block)? Save the preferences in a class object and serialize them out the the XML file? Write them out directly to the XML file? Other ways??? Just want to get some thoughts together......
5
5850
by: Trapulo | last post by:
Hello, I need to send to a webservice a parameter that is a string containing an XML doc. In this xml, a node value came from a byte array (it's an RSA signature). What is the best way to convert the original byte () value to the xml and viceversa? I've tried a lof of way, as encoding.utf8, encoding.unicode, bitconverter, etc, but the only working solution I found is Convert.XXbase64String: writer.WriteElementString("ContentSignature",
9
1703
by: Yehia A.Salam | last post by:
Hello, I am building an ASP.net website that connects to an XML database, and was wondering which is the best way to create the connection if I need frequent access to the database, I have one of the three options: 1. Use one instance of XmlDocument thought the whole Application by initializing the class in Global.asax in the Application_Start Event. 2. Use one instance per session using the Session_Start Event. 3. Create and...
4
2015
by: Brian | last post by:
HI, I have two sets of data, the largest set of data contains 370 rows... both sets only have two columns. I want to be able to distribute the data with my applaction. The other option, would be to have the data as seprate file(easier if needs updating), but I don't what the user to be able to read the file, just my program should be able to read the file. Any ideas on the best method? thanks, Brian
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8516
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.