473,748 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A theory question regarding XML

I know it is possible to store dynamic propterties for applications in XML
files. The app.config and the web.config files can be used to store
AppSettings... I am just wondering how far one can go with this technique.
In my case, what I am interested in doing is to store information about
reports and report parameters that I might want to use in an XML file.

Ideally I'd like to get to the point answer and respond to the following
questins by reading a data file:
For a given report:
What are the parameters I need to pass to the report.
What are the parameter names?
What are the parameter data types?
What query should I issue to the database in order to retrieve the
possible values?
What type of Interface control, e.g. listbox, combobox, treeview, etc.,
should I use to display this information?
Given the specific Interface what data do I need to set to populate that
control? How do I associate a data column from the query to a control
property?
Perhaps even where on my query form should I place this control?
What report file will I be opening?
If I am pushing data to the report, what is the query or queries I used to
generate the DataSet?

The major question here is whether it is possible to build data controls
based on dynamic data read from a file? and if so, what is the strategy
for doing so?

Jun 9 '06 #1
3 1469
Its certainly possible to do what you're asking. Controls can be added
dynamically to both forms and pages. I'm not sure that I'd put this
information in app.config or web.config.

My preference would be to try to read as much of the information from the
report file itself (if possible). Things like parameter names and types are
available through most reporting APIs. The rest of the information could
either be in a database or in a separate dedicated config file.

The big question here is how are you going to manage the information?
Because the information is so unstructured, I would probably suggest the
separate config file to make things easier. Another choice would be a
separate config file stored alongside each report so that the reports
themselves are more portable (just the report definition file and the config
file).

--
Jeffrey Hornby
Hornby Consulting, Inc.

"Henry" wrote:
I know it is possible to store dynamic propterties for applications in XML
files. The app.config and the web.config files can be used to store
AppSettings... I am just wondering how far one can go with this technique.
In my case, what I am interested in doing is to store information about
reports and report parameters that I might want to use in an XML file.

Ideally I'd like to get to the point answer and respond to the following
questins by reading a data file:
For a given report:
What are the parameters I need to pass to the report.
What are the parameter names?
What are the parameter data types?
What query should I issue to the database in order to retrieve the
possible values?
What type of Interface control, e.g. listbox, combobox, treeview, etc.,
should I use to display this information?
Given the specific Interface what data do I need to set to populate that
control? How do I associate a data column from the query to a control
property?
Perhaps even where on my query form should I place this control?
What report file will I be opening?
If I am pushing data to the report, what is the query or queries I used to
generate the DataSet?

The major question here is whether it is possible to build data controls
based on dynamic data read from a file? and if so, what is the strategy
for doing so?

Jun 9 '06 #2
Hi Henry,

If I understand your question correctly, you want to know if you can store
specific Control-building information in an XML file. The answer is yes.

Again, hoping I understand you fully, I am doing a similar type of project.
I'm building a "simple" printing engine that can be plugged into any .Net
application to create print jobs. This is a "generic" print engine, that
works with documents made up of rectangles containing various kinds of data
in them, such as formatted text, images, boxes, lines, and database data.
One of the requirements is that a document can be saved and/or loaded from a
file.

Now each of these "PrintEleme nt" types is a Control that can be used on a
"PagePanel" Control to visually build the print document. The "PagePanel"
Control can be hosted in any .Net Windows Form, and is a container for
"PrintEleme nt" Controls. All "PrintEleme nt" Controls share certain
characteristics . They can be transparent, or have a colored background. They
can be resized, dragged for re-positioning, and each can bring up a Dialog
Box to set various properties of the Control, such as Font, Background
Color, Border Width and Color, and so on. They are all highlighted by a
purple outline when the mouse hovers over them, and they can overlaid in
various Z-Orders.

So, I created a base class called "PrintEleme nt" that is derived from
UserControl. I gave it all the basic properties and functionality shared
among all "PrintEleme nt" classes. Then I created a derived "PrintEleme nt"
Control class for each different type of PrintElement, to handle the
different behaviors, such as being able to select an image for an
"ImagePrintElem ent" or a DataSource for a "TablePrintElem ent."

Now, as you know, a System.Windows. Forms.Control class cannot be serialized
as XML. But I wanted to be able to save a print document in an XML format
for cross-platform compatibility and other reasons. So, what I did was to
create a "PrinterDocumen t" class that could be serialized as XML. This is a
container class for "PrintElementDa ta" classes. I also created a base
"PrintElementDa ta" class that could be serialized as XML. It contained all
the information (data) needed to populate a "PrintEleme nt" base class, in a
serializable (as XML) format. For example, for Font, I created a "FontData"
class which holds all of the characteristics of a Font (which also cannot be
serialized as XML). For colors, I used the integer value of the given
System.Color (a Color can be converted to and from an Int32). And so on.

From this I derived a "PrintElementDa ta" class for each "PrintEleme nt"
class that I had, one for each. Then I added functionality to the
"PagePanel" Control that enables it to open an XML file, deserialize it to a
"PrinterDocumen t" class with a Collection of any number of
"PrintElementDa ta"-derived classes in it as a Collection. It uses Reflection
to discover the exact type of each "PrintElementDa ta" instance, and then
assigns it to the appropriate "PrintEleme nt"-derived class, which it then
adds to its Controls Collection. It can also save its current state to a
file by doing the opposite. It creates an instance of "PrinterDocumen t," and
adds the "PrintElementDa ta" instance from each "PrintEleme nt" in the page to
the "PrinterDocumen t" "PrintElementDa taCollection." Then it serializes that
as an XML file.

So, the basic principle is this: You can't actually serialize a Control, but
you *can* serialize the properties of the Control, which can then be used to
re-build the Control from a deserialized class at run-time.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

A lifetime is made up of
Lots of short moments.
"Henry" <hs****@onproje ct.com> wrote in message
news:eT******** ******@TK2MSFTN GP04.phx.gbl...
I know it is possible to store dynamic propterties for applications in XML
files. The app.config and the web.config files can be used to store
AppSettings. .. I am just wondering how far one can go with this technique.
In my case, what I am interested in doing is to store information about
reports and report parameters that I might want to use in an XML file.

Ideally I'd like to get to the point answer and respond to the following
questins by reading a data file:
For a given report:
What are the parameters I need to pass to the report.
What are the parameter names?
What are the parameter data types?
What query should I issue to the database in order to retrieve the
possible values?
What type of Interface control, e.g. listbox, combobox, treeview, etc.,
should I use to display this information?
Given the specific Interface what data do I need to set to populate
that control? How do I associate a data column from the query to a
control property?
Perhaps even where on my query form should I place this control?
What report file will I be opening?
If I am pushing data to the report, what is the query or queries I used to
generate the DataSet?

The major question here is whether it is possible to build data controls
based on dynamic data read from a file? and if so, what is the strategy
for doing so?

Jun 9 '06 #3
Thanks for replying... The Report Manage code that I currently interface
with has hard coded the parameter data, e.g. the parameter names controls
types, all actions required to populate them. Because every time I or any
other report writer wants to add a new control to address some aspect of the
our application, we have to get the programmer involved again.

I want a design that will eliminate this bottleneck and give us more
flexibility. Some of the parameters are used in many different reports and
so I should probably have a separate section just for parameter. In that
section I would have to store the information that would guide my building
of the appropriate data controls.

I would open the report file and determine what parameters are present. Then
I would search the config file and locate the data I need to create and
populate the necessary controls..

Right now the report manager just reads the parameters from the report file
and throws the controls up on the form as they are read. That gets sloppy.
I need to figure out some sort of algorithm to say if I have these specific
controls this is the way I want to lay them out.

As Jeffrey noted, I don't think this should be stored in the App.config
file. I would expect it to be a separate XML file. In my next post I hope
to layout a sample XML format for your comments.

"Jeffrey Hornby" <Je***********@ discussions.mic rosoft.com> wrote in message
news:70******** *************** ***********@mic rosoft.com...
Its certainly possible to do what you're asking. Controls can be added
dynamically to both forms and pages. I'm not sure that I'd put this
information in app.config or web.config.

My preference would be to try to read as much of the information from the
report file itself (if possible). Things like parameter names and types
are
available through most reporting APIs. The rest of the information could
either be in a database or in a separate dedicated config file.

The big question here is how are you going to manage the information?
Because the information is so unstructured, I would probably suggest the
separate config file to make things easier. Another choice would be a
separate config file stored alongside each report so that the reports
themselves are more portable (just the report definition file and the
config
file).

--
Jeffrey Hornby
Hornby Consulting, Inc.

"Henry" wrote:
I know it is possible to store dynamic propterties for applications in
XML
files. The app.config and the web.config files can be used to store
AppSettings... I am just wondering how far one can go with this
technique.
In my case, what I am interested in doing is to store information about
reports and report parameters that I might want to use in an XML file.

Ideally I'd like to get to the point answer and respond to the following
questins by reading a data file:
For a given report:
What are the parameters I need to pass to the report.
What are the parameter names?
What are the parameter data types?
What query should I issue to the database in order to retrieve the
possible values?
What type of Interface control, e.g. listbox, combobox, treeview,
etc.,
should I use to display this information?
Given the specific Interface what data do I need to set to populate
that
control? How do I associate a data column from the query to a control
property?
Perhaps even where on my query form should I place this control?
What report file will I be opening?
If I am pushing data to the report, what is the query or queries I used
to
generate the DataSet?

The major question here is whether it is possible to build data controls
based on dynamic data read from a file? and if so, what is the strategy
for doing so?

Jun 10 '06 #4

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

Similar topics

1
2539
by: Xah Lee | last post by:
Dear functional programing comrades, Among the community of automatons of the IT industry, there is a popular quote about "theory vs practice" that goes something along the lines of "in theory this, but in practice that", which is often quoted by automatons to slight at computer science principles or practice. (especially by perl or unix advocates) i'm posting the following in hope that "theory vs practice" can cease its misleading...
10
2307
by: da Vinci | last post by:
Hello. First off, I am not sure of the exact jargon used, so I will ask a question regarding it. Then on to my other question. When you use things like cout and cin from the iostream header file, what are those called? Is cout and cin functions? What is the proper term for them a command listed in a header file? Or is it just a "command"?
48
3513
by: Andrew Quine | last post by:
Hi Just read this article http://www.artima.com/intv/choices.html. Towards the end of the dicussions, when asked "Did you consider including support for the concept of immutable directly in C# and the CLR?" Anders' reply included this comment: "The concept of an immutable object is very useful, but it's just up to the author to say that it's immutable."
8
1736
by: Amelyan | last post by:
I need some help to confirm my theory! I think I discovered something new for myself about behavior System.Web.UI.Page. THEORY: Every time I change control on my WebForm1 page that results in PostBack, it is handled by a new instance of WebForm1 class, i.e. a new instance of WebForm1 class is created every time. In general, any GET or POST to WebForm1 will get its own new instance of WebForm1. public class WebForm1 :...
4
1488
by: Bob | last post by:
I know this is a tall order, but I'm looking for a book that talks about the implications of alternative approaches to languages than we typically see, such as allowing multiple inheritance... detailed, but not so heavy that the interesting, qualitative conclusions are left to the reader to dig out of a set of equations. Any recommendations? Bob
3
2238
by: Mayra | last post by:
hi, can anyone give me some info on the caracteristics of object relational databases and their advantages as well as disdvantages! thanx in advance.
2
1757
by: Omar | last post by:
I've been learning some programming during my little sabbatical (mostly python), and I thought it'd be cool to see if other people are interested in programming for music theory. So I started a Music Theory Programming google group. Consider yourselves invited! It'll be a place for people with different ideas to make music easier to understand using computer applications to share and collab. The address is: ...
6
2215
by: ARC | last post by:
Ok, so I'm looking at Access 2007, and I have imported my existing Access 97 application. I'm feeling a bit overwelmed in what to do here. In my original 97 application, I had one form: Mainmenu, which contained a header area / customer selection area, and a subform. I had a custom toolbar that had a button for each major screen. So clicking Customers would load the customers form into the subform of the mainmenu. By choosing a customer in...
0
8991
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
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
9552
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...
1
9326
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
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8245
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
6796
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
4877
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2787
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.