473,799 Members | 3,185 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Any XML patterns and practices?

Hi Folks,

Is there a good resource out there with some patterns on flexibly creating
XML documents? Basically, I need to be able to start with an instance of an
XML document, or a DTD, or a XSD, and produce something I can easily
populate with my own data and render as an XMLDocument.

I've been doing a lot of stuff where I consume web services made available
by outside companies and I'm having a hard time finding a way of doing
things that I really like. In some cases, I'm using SOAP to consume the
services, but the WSDL just calls for a string, so I have to hand build an
XML doc then render it as a string to be wrapped in SOAP for me. In other
cases, I have to build XML then send it via POST, or write it out a file and
do something with it. Half the time all I have to work with is a sample of
the expected XML I need to build.

Serialization seems like it should be the answer but some of the XML is
fairly complex and I end up spending large amounts of time creating my own
XSD files so I'll have something to feed xsd.exe. Then, I still end up with
a set of classes that are a pain to use, if usable at all. Don't even get
me started on having to build XML that isn't even well formed.

Anyway, I guess I'm done ranting. Can anyone point me toward some resource
or technology that might help? It's amazing that .Net packs so much power
for working with XML but I seem to be able to use so little of it in the
projects I've been working on. I realize this is a pretty open ended
request, but I have to believe I'm not the only person with these issues and
some of you have found or created a framework you like for generating XML.

Should I be looking at code generation? XSLT? If I try to become an expert
in XML Schemas will that help me get better results from xsd.exe?

Thanks in advance for any help or direction.

-Chris
Nov 12 '05 #1
1 1229
Chris wrote:
Is there a good resource out there with some patterns on flexibly creating
XML documents? Basically, I need to be able to start with an instance of
an XML document, or a DTD, or a XSD, and produce something I can easily
populate with my own data and render as an XMLDocument.
You mean something to automatically generate the XML document?
Any half-way decent XML editor should be able to do this (given
a half-way decent DTD or Schema -- which may be harder to find :-)
Half the time all I have to work with is a sample
of the expected XML I need to build.
Hah! This is quite a common problem: the client just gives you a
half-thought-out idea and expects you to wave the magic wand, pass
a dead chicken over the keyboard, and produce an XML application.
Serialization seems like it should be the answer but some of the XML is
fairly complex and I end up spending large amounts of time creating my own
XSD files so I'll have something to feed xsd.exe. Then, I still end up
with
a set of classes that are a pain to use, if usable at all. Don't even get
me started on having to build XML that isn't even well formed.
That too. Sometimes you just have to take it back to them and
explain politely that XML has rules, and their files need to
follow them.
Anyway, I guess I'm done ranting. Can anyone point me toward some
resource or technology that might help?
I'm afraid this one is down to knowledge and tools. XML can be used
for so many things in so many ways that there can't be a single
"magic wand" application that simply stitches up the seams and makes
XML work.

I tend to model the application structure in a DTD, because it's fast
and easy, open an empty instance in an XML editor with the DTD in the
internal subset, and start creating a skeleton by hand (or using the
client's sample as a template: some editors will deduce a minimal DTD
or Schema from a sample document). It's usually fairly clear early on
where the bells and whistles will be needed, so by the time I'm done
skeletalizing, I switch to RelaxNG to build the test model, and make
whatever is needed from that (DTD or Schema). Then it enters the build
and test cycle, and iterates until it fulfils the spec.
It's amazing that .Net packs so much power
for working with XML but I seem to be able to use so little of it in the
projects I've been working on.
..NET wasn't really designed for designing XML document structures,
only for processing them. Almost every consultant and document type
designer I know has their own toolkit of applications and utilities
they have picked up over the years, regardless of the platform they
are currently developing for. Generally it makes more sense to do
the initial development on a platform-agnostic basis, and bind it
to an API later on, because if you bind it too tight too early, sure
as hell someone will come and ask you to move the goalposts in mid-
cycle.
I realize this is a pretty open ended
request, but I have to believe I'm not the only person with these issues
and some of you have found or created a framework you like for generating
XML.

Should I be looking at code generation? XSLT? If I try to become an
expert in XML Schemas will that help me get better results from xsd.exe?


All of the above :-) Modulo what I said above about using RelaxNG
for document type design, but that's a personal preference. The golden
rule holds, though -- get the data model right to start with, and the
rest pretty much falls into place: get the data model wrong to start
with, and the project is doomed before you even start.

///Peter
--
XML FAQ: http://xml.silmaril.ie/

Nov 12 '05 #2

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

Similar topics

0
377
by: Mairead O' Donovan | last post by:
From: davidkeaveny@gmail.com (CtrlAltDel) Newsgroups: microsoft.public.dotnet.datatools Subject: Unit-testing applications that use the Microsoft.Patterns.EnterpriseLibrary.Data Date: 15 Apr 2005 08:06:31 -0700 I've written a web application that uses the M.P.E.D namespace to do all of its data layer tasks (and a nifty bit of code M.P.E.D is too!). However, unit-testing is proving a bit of a problem, as the database factory complains...
5
1861
by: Coder-X | last post by:
Hi, i have a few questions i would like to ask : 1 - Where can i find good design patterns resources for .NET ? 2 - What's the best design pattern for a windows database application ( multiuser ) ? 3 - I'm trying to develop a simple database application . I'm thinking of defining a class for every table in the database. Is this a good design practice ?
4
1929
by: Frazer | last post by:
hi are there any good samples illustrating design patterns in C#? builder, adapter, facade etc. i found a few but the reviews of that article were bad. eg http://www.codeproject.com/csharp/csdespat_1.asp#xx327127xx thnx
13
6562
by: John Salerno | last post by:
Here are a few I'm considering: Design Patterns Explained : A New Perspective on Object-Oriented Design (2nd Edition) (Software Patterns Series) by Alan Shalloway Design Patterns C# by Steven John Metsker Design Patterns by Erich Gamma Head First Design Patterns by Elisabeth Freeman
0
952
by: Prasad Patil | last post by:
Hi I am trying to understand the article http://msdn.microsoft.com/practices/type/Patterns/Enterprise/DesFrontController/ http://msdn.microsoft.com/practices/type/Patterns/Enterprise/ImpFrontControllerInASP/ [/url which describes Enterprise Solution Patterns Implementing Front Controller in ASP.NET Using HTTPHandler. When i created the web application and tried to run the same It gives me Parser Error Message: Unrecognized configuration...
4
1849
by: Luis Esteban Valencia | last post by:
Hello. Can somebody recomend me books of design patterns in c# and best practices too.
8
1257
by: Jim Hubbard | last post by:
I am looking for patterns for a distributed .Net application for a small retail chain. The owner wants the stores to have access to all data (no matter which store it comes from) in real time. In the case of an internet outage, the store owner would like for the individual stores to still have access to (at least) all data from all stores as of the previous day. This looks like a possible pain in the *........real-time data in N...
7
3106
by: =?Utf-8?B?bWF2cmlja18xMDE=?= | last post by:
Hi, I would like to know more about design patterns and specifically using C#. Can any one recommend a good book? Thanks
5
2750
by: macca | last post by:
Hi, I'm looking for a good book on PHP design patterns for a OOP beginner - Reccommendations please? Thanks Paul
0
1003
by: Jeff User | last post by:
Hi all Does anyone have any idea how I could send multiple records (DataTable) to an Oracle Stored procedure using the MS patterns and practices library. As I understand it, this framework does not use the ODP.NET, but rather the Microsoft oracle data provider. At any rate, the ODP.NET is not an optionl we have to stick with the
0
9685
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
10470
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
10214
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
10023
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
9067
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...
0
6803
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();...
1
4135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2935
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.