13.07.2015 Views

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

IntroductionIt was about five years ago, a few days after I f<strong>in</strong>ished my first book, when the publishercame to me with a rather entic<strong>in</strong>g proposal: "Why don't you start th<strong>in</strong>k<strong>in</strong>g about a newbook?" Now I realize that all publishers make this sort of proposition, but at the time theproposal was def<strong>in</strong>itely allur<strong>in</strong>g, and a clear signal—I thought—of appreciation."Because you seem to do so well with new technologies," they said, "we'd like you tohave a look at this new stuff called <strong>XML</strong>." It was the first time I had heard about <strong>XML</strong>,which was not yet a W3C recommendation.A lot of th<strong>in</strong>gs have happened <strong>in</strong> the meantime, and <strong>XML</strong> did go a long way. You canbe sure that, as I write this, a thousand or more IT managers are giv<strong>in</strong>g presentationsthat <strong>in</strong>clude <strong>XML</strong> <strong>in</strong> one way or another. Not many years ago, at a software conference,I heard a product manager emphasize the key role played by <strong>XML</strong> <strong>in</strong> the suite ofproducts he was present<strong>in</strong>g. After the first dozen sentences to the effect that "thisfeature wouldn't have been possible without <strong>XML</strong>," one of the attendees asked a candidquestion: "Is there a function <strong>in</strong> which you didn't use <strong>XML</strong>?" The presenter's genu<strong>in</strong>eenthusiasm led everyone there (<strong>in</strong>clud<strong>in</strong>g myself) to believe that programm<strong>in</strong>g would nolonger be possible without a strong knowledge of <strong>XML</strong>. We were more than a littlereassured by the speaker's answer: "Oh no, we didn't use <strong>XML</strong> <strong>in</strong> the compiler."Regardless of the hype that often accompanies it, <strong>XML</strong> truly is a key element <strong>in</strong>software. Today, <strong>XML</strong> is more than just a software technology. <strong>XML</strong> is a fundamentalaspect of all <strong>for</strong>ms of programm<strong>in</strong>g, as essential as water and air to every human be<strong>in</strong>g.Just as human be<strong>in</strong>gs realistically need some <strong>in</strong>frastructure to take advantage of waterand air, programm<strong>in</strong>g <strong>for</strong>ms of life must be supported by software tools to be effectiveand express their potential <strong>in</strong> terms of <strong>in</strong>teroperability, flexibility, and <strong>in</strong><strong>for</strong>mation. For<strong>XML</strong>, the most important of these tools is the parser.An <strong>XML</strong> parser reads <strong>in</strong> <strong>XML</strong> text and outputs a memory representation of the contents.The <strong>in</strong>put <strong>for</strong> an <strong>XML</strong> parser is always pla<strong>in</strong> and plat<strong>for</strong>m-<strong>in</strong>dependent text, althoughpotentially encoded <strong>in</strong> a variety of character sets, whereas the output of an <strong>XML</strong> parseris strictly tied to the underly<strong>in</strong>g hardware and software plat<strong>for</strong>m. Depend<strong>in</strong>g on theoperat<strong>in</strong>g system and the programm<strong>in</strong>g environment of choice, an <strong>XML</strong> parser cangenerate a Component Object Model (COM) object as well as a Java or a JScript class.No matter the k<strong>in</strong>d of output, however, the end result is <strong>XML</strong> data <strong>in</strong> a programmable<strong>for</strong>m.The grow<strong>in</strong>g level of <strong>in</strong>tegration and orchestration that partner applications need makesthe exchanged <strong>XML</strong> code more and more sophisticated and often requires the use ofspecialized dialects like Simple Object Access Protocol (SOAP) and XPath. As a result,<strong>XML</strong> programm<strong>in</strong>g requires ad hoc tools <strong>for</strong> read<strong>in</strong>g and writ<strong>in</strong>g <strong>in</strong> these dialects; all thebetter if the tools are tightly <strong>in</strong>tegrated <strong>in</strong>to some sort of programm<strong>in</strong>g framework.Effective <strong>XML</strong> programm<strong>in</strong>g requires that you be able to generate <strong>XML</strong> <strong>in</strong> a morepowerful way than merely concatenat<strong>in</strong>g str<strong>in</strong>gs. The <strong>XML</strong> API must be extensibleenough to accommodate pluggable technologies and custom functionalities. And itmust be serializable and <strong>in</strong>tegrate well with other elements of data storage andexchange, <strong>in</strong>clud<strong>in</strong>g databases, complex data types (arrays, tables, and lists), and—why not?—visual user <strong>in</strong>terface elements. In simple terms, <strong>XML</strong> must no longer be adist<strong>in</strong>ct API bolted onto the core framework, but <strong>in</strong>stead be a fully <strong>in</strong>tegrated member ofthe family. This is just what <strong>XML</strong> is <strong>in</strong> the <strong>Microsoft</strong> .<strong>NET</strong> Framework. And this book isabout <strong>XML</strong> programm<strong>in</strong>g with the .<strong>NET</strong> Framework.1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!