MSXML in 2000
description
Transcript of MSXML in 2000
MSXML In-Depth Features: MSXML In-Depth Features: Current And FutureCurrent And Future
Charlie HeinemannCharlie HeinemannProgram ManagerProgram ManagerXML Core ServicesXML Core ServicesMicrosoft CorporationMicrosoft Corporation
9-3269-326
MSXML in 2000MSXML in 2000
What’s available today?What’s available today?
What’s available tomorrow?What’s available tomorrow?
What’s on the horizon?What’s on the horizon?
MSXML in Windows 2000
MSXML2 in SQL Server 2000
MSXML3 on the Web
MSXML in Windows 2000 MSXML in Windows 2000
XML 1.0 XML 1.0 Namespace 1.0 Namespace 1.0 DOM 1.0 (Document Object Model)DOM 1.0 (Document Object Model) Schema (Validation)Schema (Validation) XSL (Transformations)XSL (Transformations) XSL Pattern (Querying)XSL Pattern (Querying) XMLHTTP (Posting and Getting XML)XMLHTTP (Posting and Getting XML) XML Data Source Object XML Data Source Object IE 5 XML SupportIE 5 XML Support
MSXML in ProductionMSXML in Production
Microsoft.comMicrosoft.com Document ManagementDocument Management Document InterchangeDocument Interchange 200,000 – 2 million hits/day200,000 – 2 million hits/day
MSXML2: PerformanceMSXML2: Performance
Advanced XML InterfacesAdvanced XML Interfaces In-line SchemasIn-line Schemas General Performance General Performance
EnhancementsEnhancements Improved ScalabilityImproved Scalability
Advanced XML API’sAdvanced XML API’s
XSL InterfacesXSL Interfaces XSLTemplate InterfaceXSLTemplate Interface XSLProcessor InterfaceXSLProcessor Interface
DOMSelection InterfaceDOMSelection Interface SchemaCollection InterfaceSchemaCollection Interface
XSL InterfacesXSL Interfaces
Passing parameters to stylesheetsPassing parameters to stylesheets Passing objects to stylesheetsPassing objects to stylesheets Caching stylesheetsCaching stylesheets
Demo Part 1Demo Part 1
XSLT TransformXSLT Transform Passing ParametersPassing Parameters Passing ObjectsPassing Objects
XSL Interfaces: Passing XSL Interfaces: Passing ParametersParameters
xslprocessor.addParameter(“color”, “red”)xslprocessor.addParameter(“color”, “red”)
. . .. . .
<xsl:param name=“color”/><xsl:param name=“color”/>
<xsl:template name=“BodyTemplate”><xsl:template name=“BodyTemplate”>
<tr style="color:{$color}"><tr style="color:{$color}">
… …
</tr></tr>
</xsl:template></xsl:template>
XSL Interfaces: Passing XSL Interfaces: Passing ObjectsObjects
myObj.numberValue = .15myObj.numberValue = .15xslproc.addObject(myObj,xslproc.addObject(myObj, "urn:my-percent-object")"urn:my-percent-object")……<xsl:stylesheet <xsl:stylesheet
xmlns:perObj=“urn:my-percent-object” …>xmlns:perObj=“urn:my-percent-object” …><xsl:template match="price"><xsl:template match="price">
<xsl:value-of select="."/> @ <xsl:value-of select="."/> @ <xsl:value-of <xsl:value-of
select="perObj:get-percent()"/> select="perObj:get-percent()"/> discountdiscount
</xsl:template></xsl:template>
DOMSelection InterfaceDOMSelection Interface Querying the DOM using XpathQuerying the DOM using Xpathxmldoc.setProperty(“SelectionLanguage”, “XPath”)xmldoc.setProperty(“SelectionLanguage”, “XPath”)
domsel = xmldoc.selectNodes(“//child::*”)domsel = xmldoc.selectNodes(“//child::*”) Returns an DOMSelection ObjectReturns an DOMSelection Object
Inherits from IXMLDOMNodeList Inherits from IXMLDOMNodeList Added functionality for managing result sets Added functionality for managing result sets
returned from a queryreturned from a query Caching queriesCaching queries
Compile the XPath expression onceCompile the XPath expression once Programmatically set multiple contextsProgrammatically set multiple contexts
SchemaCollection InterfaceSchemaCollection Interface
Caching schemas to improve Caching schemas to improve performanceperformance
Validating XML against external Validating XML against external schemas schemas
Validating XML at run-timeValidating XML at run-time
Demo Part 2Demo Part 2
In-line Schema SupportIn-line Schema Support Validating against external schemasValidating against external schemas Re-applying the schema cacheRe-applying the schema cache
In-Line Schema SupportIn-Line Schema Support
<root xmlns:foo=“x-schema:#mySchema”><root xmlns:foo=“x-schema:#mySchema”>
<Schema name=“mySchema” <Schema name=“mySchema” xmlns=“urn:schemas-microsoft-com:xml-xmlns=“urn:schemas-microsoft-com:xml-data”>data”>
<ElementType name=“bar”/><ElementType name=“bar”/>
</Schema></Schema>
<foo:bar>Hello World</foo:bar><foo:bar>Hello World</foo:bar>
</root></root>
SchemaCollection Interface: SchemaCollection Interface: Creating a Schema CacheCreating a Schema Cachecache = new cache = new
ActiveXObject(“MSXML2.XMLSchemaCache");ActiveXObject(“MSXML2.XMLSchemaCache");
cache.add("myFooURI",cache.add("myFooURI",
"http://server/xmldataschema1.xml");"http://server/xmldataschema1.xml");
cache.add("uri3", myDomDocument);cache.add("uri3", myDomDocument);
xmldoc.schemas = cache;xmldoc.schemas = cache;
xmdoc.load("http://myserver/mydata.xml");xmdoc.load("http://myserver/mydata.xml");
SchemaCollection Interface: SchemaCollection Interface: Applying the Schema CacheApplying the Schema Cache
cache.add(“urn:book-ns”, schemaDoc)cache.add(“urn:book-ns”, schemaDoc)xmldoc.schemas = cachexmldoc.schemas = cachexmldoc.load(“xmlfile.xml”)xmldoc.load(“xmlfile.xml”)
newNode = xmldoc.createElement(“pub”)newNode = xmldoc.createElement(“pub”)docEl = xmldoc.documentElementdocEl = xmldoc.documentElementdocEl.appendChild(newNode)docEl.appendChild(newNode)
xmldoc.validate()xmldoc.validate()
General Performance General Performance EnhancementsEnhancements XSLT TransformationsXSLT Transformations
Up to 3x Improvement over MSXMLUp to 3x Improvement over MSXML Querying the DOMQuerying the DOM Walking the DOMWalking the DOM Plug in MSXML2 and improve Plug in MSXML2 and improve
performance of old scenariosperformance of old scenarios
Improved ScalabilityImproved Scalability
100% increase in scaling100% increase in scaling Greatest increase in 4+ procsGreatest increase in 4+ procs See See
http://msdn.microsoft.com/xml/articles/http://msdn.microsoft.com/xml/articles/xml03202000.aspxml03202000.asp
for numbers and scenariosfor numbers and scenarios
MSXML3: StandardsMSXML3: Standards
Full XSLT SupportFull XSLT Support Full XPath SupportFull XPath Support SAX (Simple API for XML)SAX (Simple API for XML) Finishing touches on XML 1.0Finishing touches on XML 1.0
XSLT/XPath SupportXSLT/XPath Support
XSLTXSLT Full compliance Full compliance Script BlocksScript Blocks
XPathXPath Full complianceFull compliance SelectNodes SupportSelectNodes Support
Demo Part 3Demo Part 3
XPath QueryingXPath Querying XPath support in the DOM - XPath support in the DOM -
selectNodesselectNodes
SAX2SAX2
Low-level Parser InterfacesLow-level Parser Interfaces Event-driven parserEvent-driven parser Parsing w/o building a DOM treeParsing w/o building a DOM tree Needed for messaging and other high-Needed for messaging and other high-
throughput scenariosthroughput scenarios Needed for processing large Needed for processing large
documentsdocuments Currently available for C++ Currently available for C++
programmers - VB interfaces programmers - VB interfaces coming sooncoming soon
Demo Part 4Demo Part 4
SAXXMLReaderSAXXMLReader SAX in VBSAX in VB
Event-driven ParserEvent-driven Parser
Private Sub ISAXContentHandler_StartElement( Private Sub ISAXContentHandler_StartElement(
NamespaceURI, LocalName, RawName, NamespaceURI, LocalName, RawName, Attributes)Attributes)
If LocalName = “Book” ThenIf LocalName = “Book” Then
Debug.Print "Book Data Present"Debug.Print "Book Data Present"
End IfEnd If
End SubEnd Sub
Full XML 1.0 ComplianceFull XML 1.0 Compliance
Put the finishing touches on 1.0 Put the finishing touches on 1.0 compliancecompliance
Full Namespace 1.0 complianceFull Namespace 1.0 compliance
Advanced XMLDSO SupportAdvanced XMLDSO Support
Better integration with ADOBetter integration with ADO Binding Flat XML to Controls using Binding Flat XML to Controls using
ADO 2.5ADO 2.5 Binding Complex XML to Binding Complex XML to
Hierarchical Controls using ADO 2.6Hierarchical Controls using ADO 2.6
Demo Part 5Demo Part 5
XML Data Source ObjectXML Data Source Object Displaying XML in ExcelDisplaying XML in Excel
Binding XML to Grid Binding XML to Grid ControlsControls
CN.Provider = “MSDAOSP”CN.Provider = “MSDAOSP”
CN.Properties(“DataSource”) = “MSXML2.DSOControl”CN.Properties(“DataSource”) = “MSXML2.DSOControl”
CN.OpenCN.Open
RS.Open “http://server/simple.xml”, CNRS.Open “http://server/simple.xml”, CN
Set DataGrid1.DataSource = RSSet DataGrid1.DataSource = RS
XML
ConclusionConclusion
MSXML in Production NowMSXML in Production Now MSXML2 – new Performance-MSXML2 – new Performance-
enhancing XML API’s, additional enhancing XML API’s, additional schema work, general performance schema work, general performance improvementsimprovements
MSXML3 – Standards Release: Full MSXML3 – Standards Release: Full XSLT and XPath support, SAX2, Full XSLT and XPath support, SAX2, Full XML 1.0 ComplianceXML 1.0 Compliance
Resources and ServicesResources and Services XML Developer CenterXML Developer Center
http://msdn.microsoft.com/xmlhttp://msdn.microsoft.com/xml SOAP ToolkitSOAP Toolkit
http://msdn.microsoft.com/xml/general/http://msdn.microsoft.com/xml/general/toolkit_intro.asptoolkit_intro.asp
SQL Server 2000 BetaSQL Server 2000 Betahttp://www.microsoft.com/SQL/productinfo/http://www.microsoft.com/SQL/productinfo/sql2kord.htmsql2kord.htm
Biztalk Server 2000 Technical PreviewBiztalk Server 2000 Technical Previewhttp://www.microsoft.com/biztalkserver/http://www.microsoft.com/biztalkserver/techres/techpreview.asptechres/techpreview.asp
Call to ActionCall to Action
Download the latest MSXML release Download the latest MSXML release (MSXML3)(MSXML3)
Visit the XML Developer Center and Visit the XML Developer Center and check out the new materials therecheck out the new materials there
Start prototyping and developing Start prototyping and developing applications using XML applications using XML technologiestechnologies