Content by Category
.NET 1.x
.NET 2.0
.NET 3.0
.NET 3.5
.NET 4.0
.NET 4.5
.NET Assemblies
.NET Framework
.NET Getting Started
Accessibility
ADO.NET
Advertorials
Agile Development
AJAX
Amazon Web Services
Analysis Services
Android
Architecture
Arduino
ASP .NET Web API
ASP.NET
ASP.NET MVC
ASP.NET WebForms
Azure
B2B (Business Integration)
BDD
Big Data
Bing
BizTalk
Book Excerpts
Build and Deploy
Business Intelligence
C#
C++
ClickOnce
Cloud Computing
Code Contracts
CODE Framework Info - non Technical
CODE on the Road!
COM+
Community
Conferences
Continuous Integration
Crystal Reports
CSLA.NET
CSS
Data
Debugger
Design Patterns
Development Process
Display Technologies
Distributed Computing
Document Database
DotNetNuke
DSL
Dynamic Languages
Dynamic Programming
Editorials
Enterprise Services ("COM+")
Entity Framework
Events
Expression Blend
F#
Fox to Fox
Frameworks
Functional Programming
Git
Graphics
HTML 5
Internet Explorer 8.0
Interviews
IOS
iPhone
Iron Ruby
Java
Java Script
JavaScript
jQuery
JSON
Lightswitch
LINQ
Linux
LUA
Mac OS X
MDX
Messaging
Metro
Microsoft Application Blocks
Microsoft Business Rules Framework
Microsoft Dynamics
Microsoft Expression
Microsoft Office
Mobile Development
Mobile PC
Mono
MsBuild
MVVM
MySQL
Network
NHibernate
node.js
NOSQL
Nuget
Object Oriented Development
Objective C
Odata
OLAP
Open Source
Opinion
Opinions
Oracle
ORM
Other Languages
Parallel Programming
Patterns
PHP
Podcasts
Post Mortem
PowerPoint
Print/Output
Prism
Product News
Product Reviews
Project Management
Prolog
Python
Q&A
Rails
Rake
Razor
Reporting Services
REST
RIA Services
Ruby
Ruby on Rails
Scheme
Search
Security
Services
SharePoint
SignalR
Silverlight
SOA
Social Networks
Software & Law
Software Business
Source Control
Speech-Enabled Applications
SQL Server
SQL Server 2000
SQL Server 2005
SQL Server 2008
SQL Server 2012
SQL Server CE/AnyWhere/Mobile/Compact
SSIS
Subversion
Sync Framework
Tablet PC
TDD
Team System
Techniques
Testing and Quality Control
TFS
Tips
TypeScript
UI Design
UML
User Groups
VB Script
VB.NET
Version Control
VFP and .NET
VFP and SQL Server
Virtual Earth
Vista
Visual Basic
Visual Basic 6 (and older)
Visual FoxPro
Visual Studio .NET
Visual Studio 11
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio 2011
Visual Studio 2012
Visual Studio Tools for Office
VSX
WCF
Web Development (general)
Web Services
WebMatrix
WF
Whitepapers
Windows 7
Windows 8
Windows Azure
Windows Live
Windows Phone 7
Windows Phone SDK
Windows Server
Windows Vista
WinForms
WinRT
Workflow
WPF
XAML
Xiine Documentation
XML
XNA
XSLT



LearnNow


XAMALOT
 


DevTeach

Reader rating:
Click here to read 4 comments about this article.
Article source: CoDe (2003 - Vol. 1 - Issue 1 - Visual FoxPro 8.0)


Article Pages:  1  2 3 4 5 - Next >


The VFP 8 XMLAdapter Class

Visual FoxPro 8.0 introduces a whole new way to work with eXtensible Markup Language (XML).The XMLAdapter class works with hierarchical XML, provides an object-oriented approach to working with XML data, and leverages your familiarity with tables and fields in the way it exposes the XML contents.

Many developers have come to realize the enormous potential of a platform-neutral way to exchange structured data over the Intranet / Internet by using XML. XML makes it possible to integrate your applications with others, even if they're using platforms and systems completely different than yours. Integrating business applications has become an essential need. XML is the key to this kind of integration.

The XMLAdapter class provides new support for working with XML. One capability of this new class is support for hierarchical XML. This means that an XML file that represents a collection of different and potentially related tables, such as a Windows .NET DataSet, will render into separate Visual FoxPro cursors.

Flexibility and control over data is enhanced by being able to control the schema of the XML that is created, as well as control the data types that the cursor creates from the XML of the schema. This allows you to load in the XML, change the schema, then generate the cursor. In addition, you can take a cursor in memory, control the schema, then generate the XML in a different format.

Working with XML in Visual FoxPro 8.0 vs. Visual FoxPro 7.0

The XMLTOCURSOR() / CURSORTOXML() functions that were new to Visual FoxPro 7.0 restricted you to working with XML files that contained data for only one table. If more than one table is contained in the XML file, you need to parse through the file manually. In addition, you don't have the full control of the schema that was contained in the XML file to change the data types before converting the XML to a Visual FoxPro cursor. When the XML was generated from the cursor, you don't have control of the schema that is generated.

The XMLAdapter class in Visual FoxPro 8.0 greatly enhances XML support to provide you with the ability to work with multiple tables in one XML file, and the compatibility of working with XML from different sources. The schema can be modified to allow you control over how data is converted to a cursor and how the XML is generated from Visual FoxPro cursors.

Introduction to the XMLAdapter, XMLTable, and XMLField Classes

The XMLAdapter Class allows the you to load XML from an XML source, parses the XML Schema (when it exists), and add one or more XMLTable object(s) to its tables collection. In turn one or more XMLField object(s) are added to the fields collection of each XMLTable.

"
Integrating business applications has become an essential need. XML is the key to this kind of integration.
"

XMLAdapter class can also create an XML document representing the contained tables and fields that have been populated. XMLAdapter class includes two other child member classes: XMLTable and XMLField. These provide the ability to walk through the schema programmatically and access or set information.

The primary functionality that the XMLAdapter Class provides is to retrieve XML via the LoadXML() method, then parse the XML via the contained XML Schema, as appropriate, into one or more XMLTable objects, which in turn contain XMLField object(s).

The XMLTable class is a collection of all tables contained in the XML and functions to allow you to step through the table to perform procedures on them.

The collection of XMLTable objects describes the XML as a Visual FoxPro cursor or cursors, along with any relational information. The XMLAdapter does not store the actual XML schema or content, but does store object references to them.

The developer may then use the XMLTable.ToCursor() method to produce a cursor that contains the data of all the fields represented by the child member XMLField collection.

The XML and XML Schema data retrieved via the XMLAdapter.LoadXML() method remains in memory until replaced via a subsequent call to LoadXML(), or when it is specifically released by calling the ReleaseXML() method.

The XMLField class is a collection created for each XMLTable and contains all the fields in the table. The developer can iterate through the field objects and make any necessary changes. There are no methods associated with the XMLField class.

&

By: Cathi Gero

cgero@prenia.com

Fast Facts

The new XMLAdapter class in VFP 8 greatly enhances your ability to work with XML data sources, including hierarchical XML documents, such as .NET DataSets. Cathi explains how this and related new classes open new possibilities for your applications.



Article Pages:  1  2 3 4 5 - Next Page: 'Converting XML to VFP Cursors Using the XMLAdapter' >>

Page 1: Intro
Page 2: Converting XML to VFP Cursors Using the XMLAdapter
Page 3: XMLAdapter Class with SQLXML
Page 4: Working with Diffgrams
Page 5: Working with the new CursorAdapter Class

How would you rate the quality of this article?
1 2 3 4 5
Poor      Outstanding

Tell us why you rated the content this way. (optional)

Average rating:
4.3 out of 5

55 people have rated this article.

Instantly Search Terabytes Of Text
“Lightning Fast”
– Redmond Mag
“Covers all data
sources” – eWeek
25+ fielded & full-text search options
dtSearch’s own document filters highlight hits in popular file types
Web Spider supports static & dynamic data
APIs for .NET, Java, C++, SQL, etc.
Win / Linux (64-bit & 32-bit)
www.dtSearch.com
 

      CODE Training

 

SSWUG