473,396 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 1213
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
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...
5
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 (...
4
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...
13
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...
0
by: Prasad Patil | last post by:
Hi I am trying to understand the article http://msdn.microsoft.com/practices/type/Patterns/Enterprise/DesFrontController/...
4
by: Luis Esteban Valencia | last post by:
Hello. Can somebody recomend me books of design patterns in c# and best practices too.
8
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. ...
7
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
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
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
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,...

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.