Post on 31-Mar-2015
Integrating XML in Business Integrating XML in Business
Ken Spencer Ken Spencer Vice PresidentVice President32X Corporation32X Corporation
www.32x.comwww.32x.com
6-3116-311
Cross-Platform InteropCross-Platform Interop
Application
DataComm
Windows DNA 2000 Other Platforms
Application
Frameworkimplementation
DataComm
Core Standards
Application Schemas
Frameworks
Platform/Tools
Solutions and Applications
Platform/Tools
Solutions and Applications
Frameworkimplementation
Where is XML used?Where is XML used?
Sample XMLSample XML<?xml version="1.0"?><?xml version="1.0"?>
<Books><Books>
<Book><Book>
<Title_ID>BU1032</Title_ID><Title_ID>BU1032</Title_ID>
<Title>The Busy Executive's Database <Title>The Busy Executive's Database Guide</Title>Guide</Title>
<Notes>An overview of available database <Notes>An overview of available database systems with emphasis on common business systems with emphasis on common business applications. Illustrated.</Notes>applications. Illustrated.</Notes>
</Book></Book>
</Books></Books>
Getting StartedGetting Started
XML must play by rulesXML must play by rules XML DeclarationXML Declaration
<?xml version="1.0"?> <?xml version="1.0"?> Define TagsDefine Tags Add DataAdd Data
VB and XMLVB and XML
Wire into componentsWire into components Use with serialization techniquesUse with serialization techniques
Move data into and out of componentsMove data into and out of components Generate XML from componentsGenerate XML from components
Send to ASPSend to ASP Generate from ASP and send to Generate from ASP and send to
BrowserBrowser VendorVendor CustomerCustomer
XMLGen.GeneratorXMLGen.Generator
Custom VB XML GeneratorCustom VB XML Generator SimpleSimple No frillsNo frills Designed to get data outDesigned to get data out Useful in intranet / Internet Useful in intranet / Internet
applicationsapplications Where full parser not required Where full parser not required
XMLGen.Generator InterfaceXMLGen.Generator Interface
XMLDeclarationXMLDeclaration Format – formats dataFormat – formats data BeginTag – generates starting tagBeginTag – generates starting tag EndTag – generates ending tagEndTag – generates ending tag
Generating the Declaration Generating the Declaration
Set output var to return valueSet output var to return valuevOutPut = oXML.XMLDeclaration()vOutPut = oXML.XMLDeclaration()
Results in this:Results in this:<?xml version="1.0"?><?xml version="1.0"?>
Creating the XML StreamCreating the XML Stream
Call Format method to generate Call Format method to generate tagstags
sTitle = oXML.Format("Title", rsTitle("title"))sTitle = oXML.Format("Title", rsTitle("title"))
sID = oXML.Format("Title_ID", rsTitle("title_id"))sID = oXML.Format("Title_ID", rsTitle("title_id"))
sNotes = oXML.Format("Notes", rsTitle("notes"))sNotes = oXML.Format("Notes", rsTitle("notes"))
sReturn = sID & sTitle & sNotessReturn = sID & sTitle & sNotes
Return all XML as string from VB Return all XML as string from VB methodmethodRetrieveTitleRetrieveTitle = sReturn = sReturn
ADO and XMLADO and XML
ADO 2.x can save RS as XMLADO 2.x can save RS as XML ADO 2.5 can save or stream RS as ADO 2.5 can save or stream RS as
XMLXML Use ADO to generate stream to other Use ADO to generate stream to other
applications applications
ADO 2.5 Stream ObjectADO 2.5 Stream Object
Stream objectStream object Can hold different types of dataCan hold different types of data Load from ADO RSLoad from ADO RS Feed to MSXML ParserFeed to MSXML Parser
XML from ASPXML from ASP
ADO 2.5 XML SupportADO 2.5 XML Support Generate XML from RSGenerate XML from RS
Send to Response objectSend to Response object
Use Customer FormatterUse Customer Formatter Why?Why?
XML MappingXML Mapping
B2B or B2C requirementsB2B or B2C requirements Map DB Schema to XML Map DB Schema to XML Should use XMLFilter objectShould use XMLFilter object
Handle mapping automaticallyHandle mapping automatically Read XML SchemaRead XML Schema Map Schema to DB SchemaMap Schema to DB Schema Output XMLOutput XML Resist temptation to generate XML Resist temptation to generate XML
directly in Stored Procs or from databasedirectly in Stored Procs or from database
Storing XML In DatabaseStoring XML In Database
Not easily searchableNot easily searchable Works best for self described dataWorks best for self described data
Query definition, state info (non Query definition, state info (non searchable)searchable)
Watch column sizeWatch column size Be careful with varchar vs. Be careful with varchar vs.
char/int/etc.char/int/etc.
HTML vs. XMLHTML vs. XML
Use HTML Files when PossibleUse HTML Files when Possible Does note require script or XML Does note require script or XML
processingprocessing Simple file / HTTP processingSimple file / HTTP processing IIS 5 improves processing of ASP files IIS 5 improves processing of ASP files
with no scriptwith no script
Session SupportSession Support
Turn offTurn off Frees up resources on serverFrees up resources on server Lets IIS process multithreaded Lets IIS process multithreaded
applications fasterapplications faster HowHow
Rework applications first (see Rework applications first (see FMStocks 1 & 2000 for sample FMStocks 1 & 2000 for sample code)code)
Remove reference to Session varsRemove reference to Session vars Use the ISM to turn off on serverUse the ISM to turn off on server
Session State DataSession State Data
Don’t use ASP session objectDon’t use ASP session object Use XML to store stateUse XML to store state Store data in SQL Server Store data in SQL Server
The Microsoft XML EngineThe Microsoft XML Engine
Freely distributedFreely distributed Fast parserFast parser Great for reading XML filesGreat for reading XML files Combine with ADO or other Combine with ADO or other
formatterformatter
SQL ServerSQL Server
SQL Server 2000SQL Server 2000 Generate XML directlyGenerate XML directly More…More…
With BrowserWith Browser
IE 5 Data IslandsIE 5 Data Islands Treat XML data as objectTreat XML data as object
Work with MSXML parserWork with MSXML parser Interact with DHTMLInteract with DHTML
With XSLWith XSL
XSLXSL Extensible Style SheetExtensible Style Sheet
Works with XML on client or serverWorks with XML on client or server Used to transform XML data into Used to transform XML data into
something elsesomething else