Preview only show first 10 pages with watermark. For full document please download

Dotnet Xml Tutorial

COSC 4080 – Computer Science Project Serializing object in XML format in Eiffel.NET Applications Student: Jonathan Amir cs983037 Professor: Jonathan Ostroff January 13, 2003 Table of content 1. Introduction 2. The .NET Framework 2.1 Structure of a .NET application 3. Eiffel.NET 3.1 Using .NET classes in an Eiffel project 3.1.1 The Object Browser 3.2 Using custom C# classes in an Eiffel application 3.3 Using Eiffel classes in a C# application 3.4 Common problems (and their solutions) 3.4.1

   EMBED


Share

Transcript

    COSC 4080 – Computer Science ProjectSerializing object in XML format inEiffel.NET ApplicationsStudent: Jonathan Amir cs983037Professor:Jonathan Ostroff January 13, 2003    Table of content1. Introduction2. The .NET Framework  2.1 Structure of a .NET application 3. Eiffel.NET 3.1 Using .NET classes in an Eiffel project 3.1.1 The Object Browser 3.2 Using custom C# classes in an Eiffel application3.3 Using Eiffel classes in a C# application3.4 Common problems (and their solutions) 3.4.1 Manipulating strings3.4.2 Output3.4.3 .NET arrays 4. An introduction to .NET Reflection 4.1 Investigating types4.2 Getting fields values4.3 Setting fields values4.4 Instantiating objects 5. An introduction to .NET XML classes 5.1 XmlWriter and XmlTextWriter 5.1.1 Creating a blank XML document5.1.2 Creating a XML document with some data 5.2 XmlReader and XmlTextReader 5.2.1 Understanding the cursor position5.2.2 Ignoring whitespaces5.2.3 Parsing element nodes5.2.4 Skipping unwanted nodes 6. The XML Serialization application 6.1 The REFLECTOR class6.2 The XML_OBJECT_WRITER class  6.3 The XML_OBJECT_READER class6.4 Error handling6.5 Testing6.6 Source code 6.6.1 REFLECTOR Class6.6.2 XML_OBJECT_WRITER Class6.6.3 XML_OBJECT_READER Class6.6.4 TEST_CLASS Class  1. Introduction This document presents my work as part of course COSC 4080 during fall 2002, under thesupervision of Professor Jonathan Ostroff. The initial purpose of the project was to write areusable component to store Eiffel objects in XML format, and also to investigate a new productfrom Eiffel Software, namely Eiffel Envision.Eiffel Envision is a plug-in for Visual Studio.NET that facilitate the writing, debugging andtesting of Eiffel code in Visual Studio.NET. Needless to say, the integration between Eiffel andthe .NET Framework (hereinafter referred to as Eiffel.NET) is not just at the GUI level.Eiffel is now one of the few languages that are .NET compatible. This means that programmerscan compile Eiffel code to run on the .NET Common Language Runtime (more on this issue inthe next section).This document is written in the form of a tutorial, and it reflects, in a way, the learning curve thatI was facing when working on the project. Although the final code for the XML Serializationapplication is fairly short, I have revised it and restructured it dozens of time; at every step alongthe way I have learned something new, and realized that the code I have written was wrong, or  perhaps it wasn’t efficient.These are the topics that are covered in this document: ã   Eiffel.NET and Envision – I present a tutorial about the integration between Eiffel and the.NET Framework, including step-by- step examples on how to use Envision, how to createEiffel.NET applications, how to use C# classes in Eiffel code and how to use Eiffel classesin C# code (two-ways integration). ã   Reflection – I introduce the concept of reflection and how it can be used in the .NETFramework. There are a few code samples that demonstrate the power of reflections – mostof them are written in Eiffel. ã   XML – As a part of this project, I learned how to process XML files using the .NET built-inclasses. The .NET class library contains an XML API that makes life for the programmer fairly easy, and I use those classes in the XML Serialization application, which is all writtenin Eiffel. ã   XML Serialization – The final deliverable of this project is the XML Serializationapplication. It is an application that can take any Eiffel object, and store it in an XML file.The application uses both the reflection API and the XML API of the .NET class library.