Thursday, June 16, 2005

XML .NET (the custom samples)

{

Here are the examples from the last piece of the course when we explored the .NET Framework's implementation of XML related parsers and techniques.

You can download the sample in this zip file which you can extract to its project form to look at the code. Most examples are "methods" implemented off of Module1.vb1.

Read and Write

The BasicReader() method shows an example of parsing an XML document with a XmlReader. Pay attention to the Select… Case expression to see how to filter nodes based on their types.

The ValidReader() method shows an example of a validating parser (XmlValidatingReader). Although this method does the legwork, our ValidationEventHandler, the method ValidError() is responsible for responding to any "events" related to the validation. I stressed the importance of understanding Delegates here, and did a quick example of what I meant which you can download in a different project, vbDel. If you don't mind looking at C#, you can look at some earlier entries I made about how delegates work. One of the best uses of delegates is to make an asynchronous call to any method you've written. Asynchronous delegates are how asynchronous web service calls are implemented.

The fake SAX Parser we wrote is also in the project, in its own file called SAXP.vb. It is not very complete but should give you an idea of how to get the SAX functionality out of the .NET Framework. If you'd ever want to – that's probably a remote possibility.

The WriteXML() method is a very basic example of how you can use the XmlTextWriter to create XML documents. This isn't too interesting, but if you start to combine the XmlTextReader and the XmlTextWriter, you can start to see the power and ease of the .NET APIs. In the second group, we wrote some code that would convert an attribute based document into an element based one. You will find this in a method called AttToElement().

Transforming

The SimpleTransform() method is an example of the simplest form of XSLT Transformations that can be done with the .NET Framework. Another method, called MemoryTransform(), is an example of how transformation can be done and processed in memory to return results in a string format. You will notice the use of the MemoryStream class in this example.

Serialization

We took two different looks at serialization. In the first we looked at how a built in class, the DataSet, has the ability to persist itself in XML format. Our method PersistDataSet() shows an example of this. In order to demonstrate the retrieval of a persisted DataSet, we wrote another method called ReadPersistedDataSet(). Along the way we talked about the Schema options of the WriteXml method of the DataSet. Although it was a barely noticeable blurb, make sure you investigate the XmlDataDocument class. It's a quick way to go from a DataSet to an XML Dom-like object and back again.

Once we'd seen that type of persistence, we looked at conventional serialization, or being able to take any old class and serialize it into some output stream. We wrote the PersistConventional() method to display this functionality with a class called Person, and then we depersisted in a method called DepersistConventional().

This was a good way to start working at understanding web services. I'll make another entry with the web services demos, but really quickly, the last few examples related to XML and .NET:

XML and SQL Server 2000

We looked at ways to retrieve XML data from the database, and I demonstrated the FOR XML clause of an sql statement. After we looked at a few examples, we wrote the GetXMLFromDB() method that would issue a FOR XML query and return results using the XmlReader. Which left us with one other thing on our "to do" list: inserting XML data into SQL Server directly.

In the project you will find a file called OPENXML.sql. This file contains a series of scripts to work through to understand how one can use the OPENXML function in SQL Server 2000 to build a "rowset" view on an XML document. Once this rowset functionality is understood, it's easy to see how it can be combined with Insert/Select statements to insert data. This is demonstrated in the InsertXMLContent() method.

So that was the tour de force. You can download it all in this zipped project. If you have questions, don't hesitate to email me.


}

1 comment:

kevinflynn9768 said...

St0ck For Your Review - FCPG

Current Profile
Faceprint Global Solutions (FCPG)
Current Price $0.15

A U.S. based-company dedicated to the goal of
bringing effective security solutions to the marketplace.

With violent and white-collar terrorism on the rise,
companies are starving for innovative security solutions.


FCPG is set to bring hot new security solutions to
the industry, with currently over 40 governmental and
non-governmental contracts, being negotiated.


Please Review Exactly What this Company Does.

Why consider Faceprint Global Solutions (FCPG)?

Faceprint Global Solutions (FCPG) holds the exclusive
marketing rights from Keyvelop, to sell the world�s
leading encryption technology to be distributed directly
to the Healthcare industry in North America.

Faceprint Global Solutions has completed its biometric
software that recognizes facial features of individuals
entering and leaving through airports, ship yards, banks,
large buildings, etc.

FCPG acquired Montreal-based Apometrix Technologies,
which enhances the companies mission of being a
full-service provider to the multi-application smart
card industry. The North American market appears ready
for significant expansion of price-competitive, proven,
multi-application solutions on smart cards. Apometrix's
forecast of over 300 customers and sales of more than $50
million in North America over the next five years, appears
very realistic, according to company management.


Faceprint Global Solutions is currently in contract negotiations
with over 40 governmental agencies and businesses seeking to use
their encryption, biometric, and smart-card technologies.

Breaking News for Faceprint Global Solutions (FCPG)

Faceprint Global Solutions (FCPG) is pleased to announce that
IBM will now offer the world�s leading encryption software to
its major Healthcare clients in North America.


With FCPG owning the exclusive North American rights to distribute
the worlds leading encryption and transmission software developed by
Keyvelop, FCPG is poised to capture large volumes of sales generated
by customers currently using IBM�s software in the healthcare and other
industries.


�This is a very positive move for FCPG and for Keyvelop,� said FCPG
CEO Pierre Cote. �We are very happy about the decision to go with IBM.
This is a continuation of the progress made by everyone associated
with FCPG and its partners.�

Buell Duncan, IBM's general manager of ISV & Developer Relations commented,
�Collaborating with Keyvelop will ensure that we develop open solutions that
are easy to maintain and cost effective for our customers in the healthcare
and life sciences industry.�

Among other things, this new software technology which is currently
being used by a number of European healthcare companies, is used to
send any file, regardless of format or size. Encryption keys, evidence
of transmission integrity with fingerprint calculation, time-stamping
of all actions and status record updating, pre-checking sender and
receiver identities, validating file opening dates are part of Keyvelop features.

About FacePrint Global Solutions, Inc.

FCPG operates a business, which develops and delivers a variety of
technology solutions, including biometric software applications on
smart cards and other support mediums (apometric solutions). FCPG�s
products provide biometric solutions for identity authentication and a
host of smart card- and biometrics-related hardware peripherals and
software applications. Apometrix, FCPG�s wholly-owned subsidiary,
combines on-card or in-chip multi-application management solutions
with best-of-breed �in-card matching� biometrics. Keyvelop�s secure
digital envelope solution and Apometrix�s on-card biometrics work
together to produce the winning combination in the fields of security,
traceability and identity management.

Conclusion:

The examples above show the Awesome, Earning Potential of little known
Companies That Explode onto Investor�s Radar Screens. This sto,ck will
not be a Secret for long. Then You May Feel the Desire to Act Right Now!
And Please Watch This One Trade!

GO FCPG!

Disclaimer:
Information within this email contains "forward |ooking statements" within
the meaning of Section 27Aof the Securities Act of 1933 and Section 21B of
the Securities Exchange Act of 1934. Any statements that express or involve
discussions with respect to predictions, expectations, beliefs, plans,
projections, objectives, goals, assumptions or future events or performance
are not statements of historical fact and may be "forward |ooking statements".
"Forward |ooking statements" are based on expectations, estimates and projections
at the time the statements are made that involve a number of risks and uncertainties
which could cause actual results or events to differ materially from those presently
anticipated. We were paid a sum of three thousand USD to disseminate this information
from ir marketing. Forward loking statements in this action may be identified through
the use of words such as "projects", "foresee", "expects", "will", "anticipates",
"estimates", "believes", "understands" or that by statements indicating
certain actions "may", "could", or "might" occur. Risk factors include
general economic and business conditions, the ability to acquire and develop
specific projects, the ability to fund operations and changes in consumer and
business consumption habits and other factors over which the company has little
or no control. The publisher of this newsletter does not represent that the
information contained herein are true and correct.