230 likes | 516 Views
MSXML 2.0 DLL. DOM 1.0 Element: getElementsByTagName, getAttribute, getAttributeNode NamedNodeMap: getNamedItem, SetNamedItem, removeNamedItem, item, length parseError Object Node: AddElement, Addattribute,appendchild InsertElementBefore, ReplaceChild, removeChild, createAttribute
E N D
MSXML 2.0 DLL • DOM 1.0 • Element: getElementsByTagName, getAttribute, getAttributeNode • NamedNodeMap: getNamedItem, SetNamedItem, removeNamedItem, item, length • parseError Object • Node: AddElement, Addattribute,appendchild InsertElementBefore, ReplaceChild, removeChild, createAttribute • SelectNodes, SelectSingleNode, Nodefromid
MSXML 2.0 DLL • XSLT: TransformNode, TransformNodetoObject • xmlhttpRequest: Get, Post XML file
MSXML 3.0 DLL • MSXML 3.0 Supports Xpath 1.0, XSLT 1.0, XDR, and SAX2 • XSLT: XSLTemplate30 to create cached Stylesheet to increase the performance, CreateCachedStylesheet, input, output, addparameter, addObject • http://msdn.microsoft.com/library/periodic/period00/xml0900.htm
MSXML 3.0 DLL-XSLT <xsl:transform version=“1.0” xmlns:xsl=http://www.w3.org/1999/xsl/transform xmlns:mylib=“urn:mylib”> <xsl:template match=“/”> Message: <Xsl:value-of select=“mylib:GetMessage()”/> Time: <xsl:value-of selec=“mylib:get-time()”/> </xsl:template> <xsl:transform> Set obj = createObject(“mylib.myobject”) Processor.addobject obj, “urn:mylib” Processor.Transform
MSXML 3.0 DLL-XPath • Doc.setProperty "SelectionLanguage", "XPath“, ixmlDomSelection • Dim sel as ixmlxmldomselection sel=doc.selectnodes(“child::bar/*”) sel.clone,matches,context,expr,getproperty,peeknode, removeAll, removeNext
MSXML 3.0 DLL-SAX • SAX(simple API for XML):startDocument, startElement, characters, endElement, endDocument
MSXML 3.0 DLL-XDR • XDR: XML-Data Reduced Dim cache as IXMLDOMschemaCollection Set Cache = new XMLschemaCache30 Cache.add “urn:bar”, xdrdom Doc1.schemas = cache Doc1.load “foo.xml” Doc1.vallidate
MICROSOFT ACTIVEX DATA OBJECTS 2.5 LIBRARY • Recordset.open • Recordset.save Response, adPersistXML • Recordset.save “xxx.xml”, adPersistXML • Recordset.save ST, adPersistXML • Recordset.open ST
MICROSOFT ACTIVEX DATA OBJECTS 2.5 LIBRARY • ADODB.STREAM Public Function GetEmployees() dim ostrm dim rs dim objGetEmployees set objGetEmployees = Server.CreateObject( “HRApp.CempMgr”) set rs = objGetEmployees.getEmployees() Set oStrm=server.createObject( “ADODB.Stream”) Ostrm.open Rs.save ostrm,1 Ostrm.position=0 GetEmployees=oStrm.ReadText GetEmployees=oStrem.ReadText Set oStrm=nothing Set rs=nothing Set objGetEmployees=NOTHING End Function
MICROSOFT ACTIVEX DATA OBJECTS 2.5 LIBRARY Private Function XML2RS(sXML as string) as adodb.recordset Dim oStrm as ADODB.Stream Set oStrm = new Stream Set XML2RS = new ADODB.Recordset oStrm.open oStrm.WriteText sXML oStrm.Position = 0 XML2RS.Open oStrm Set oStrm = nothing End Function
SOAP TOOLKIT WIZARD • ASP:Create an ASP file and an SDL file in XML format. ASP+SDL+Listener in the same Web folder • ISAPI: Create an ASP file and an Sod file. (<? Xml version=“1.0” ?> • <SOD progID=“progamID.ClassID” schemaLoc=“f:\Web\Class.xml”/> )
<serviceDescription name='SoapDest' xmlns='urn:schemas-xmlsoap-org:sdl.2000-01-25' xmlns:dt='http://www.w3.org/1999/XMLSchema' xmlns:CStringTest='CStringTest' > <import namespace='CStringTest' location='#CStringTest'/> <soap xmlns='urn:schemas-xmlsoap-org:soap-sdl-2000-01-25'> <interface name='CStringTest'> <requestResponse name='StringReverse'> <request ref='CStringTest:StringReverse'/> <response ref='CStringTest:StringReverseResponse'/> <parameterorder>sText</parameterorder> </requestResponse> </interface> <service> <addresses> <address uri='http://localhost/CStringTest.asp'/> </addresses> <implements name='CStringTest'/> </service> </soap>
<CStringTest:schema id='CStringTest' targetNamespace='CStringTest' xmlns='http://www.w3.org/1999/XMLSchema'> <element name='StringReverse'> <type> <element name='sText' type='dt:string'/> </type> </element> <element name='StringReverseResponse'> <type> <element name='return' type='dt:string'/> <element name='sText' type='dt:string'/> </type> </element> </CStringTest:schema>
<%@ Language=VBScript%> <% Option Explicit Response.Expires = 0 Const SOAP_SDLURI = "http://localhost/CStringTest.xml" 'URI of service description file Const MSDNSOAP_SDL = "MSDNSOAP_CStringTest" 'Application Variable name for caching SDL %> <!--#include file="listener.asp"--> <%Public Function StringReverse (ByRef sText) Dim objStringReverse Set objStringReverse = Server.CreateObject("SoapDest.CStringTest") StringReverse = objStringReverse.StringReverse(sText) 'Insert additional code here Set objStringReverse = NOTHING End Function%>
SOAP TOOLKIT :ASP • Soap RequestListener.asp Load class.xml (sdl) call class.asp call sub method in class.asp actual methodlistener.asp use response.write sends the result back
ROPE(Remote Object Proxy Engine) 1.0 TYPE LIBRARY : proxy • Proxy: Wrapper class for use by client Set objProxy = New ROPE.Proxy objProxy.LoadServicesDescription(icURI, "http://192.168.1.1/Inventory.xml") objProxy.getTitlePrice(“Rocking Chair”)
ROPE 1.0 TYPE LIBRARY : SOAPPackager • SOAPPackager: Creates SOAP messages. Serializes and deserializes parameters .LoadServicesDescription getmethodname,getParameter Public Function GetEmployeesXML() dim objgetEmployeesXML set objgetEmployeesXML= Server.CreateObject( _ “HRApp.CEmpMgr”) GetEmployeesXML= objGetEmployeesXML.GetEmployeesXML() Dim oPkgr Set oPkgr=Server.CreateObject(“ROPE.SOAPPackager”) GetEmployeesXML= oPkgr.Cdataize(GetEmployeesXML) set oPkgr=nothing set objGetEmployeesXML= Nothing End function
WireTransfer: POSTS HTTP requests. Sets and gets HTTP headers. oWire=CREATEOBJECT("Rope.WireTransfer") oXML=oWire.GetPageByURI("http://www.digi.com/rr.xml")