XML Tips from perfectxml.com [Page 3]
- What is XHTML?
The W3C is currently working on a proposed recommendation for an implementation of XML known as XHTML - this implementation
will obey all of the grammer rules of XML, while conforming to the vocabulary of HTML. The XHTML document that you create
may be sent to client with a mime-type of HTML or XML, allowing the greatest flexibility in rendering and manipulation at
the client side. The XML DOM may then be used to manipulate the contents of the XHTML document directly.
- XML and Binary data
XML document is a text document with tags and text data enclosed within tags.
If you want to send binary data as part of XML document (for ex: <BookImage>some binary data, image</BookImage>),
you'll have to encode the binary data using base64 encoding.
Base64 processes data as 24-bit groups, mapping this data to four encoded characters.
It is sometimes referred to as 3-to-4 encoding.
And again, on the recieving side, decoding the base64 data to binary data.
There are many ways to do this encoding/decoding (including using MSXML.dll),
if you need additional details and code sample, please send mail to Darshan Singh.
- What is ROPE?
Remote Object Proxy Engine, or ROPE, is a powerful COM component built to make life easier for SOAP
developers who are used to programming in Visual Basic. SOAP provides several distinct objects that can
be used by both the client and the server. ROPE COM component abstracts all SOAP's implementation details.
One of the objects ROPE can be used to encode binary data into HTTP-compatible (Base64) form.
The XML-RPC protocol defines a way for RPC requests and responses to be serialized into XML documents and sent across an
HTTP connection. One major difference between SOAP and XML-RPC is that XML-RPC uses a <methodName> element with the method
name; SOAP however uses the method name as the name of the element. Partemeters in XML-RPC are encoded with type information
elements such as <string>, which in contrary to SOAP which allows the use of XML Schemas to describe the data types.
- XML Certification
Check out www.perfectxml.com/Certify - the complete and up-to-date resource center dedicated to IBM XML Certification Test 141
When everybody is studying hard to finish their MCSDs and MCSEs,
if you think, you know XML well, why not appear for XML certification and
tell your friends/co-workers that you are a "XML certified" professional.
Check out more details at:
- What is UDDI?
UDDI, or "Universal Description, Discovery and Integration" initiative
is essentially a Web Service registry, implemented with
a programmatic SOAP interface that allows businesses to basically advertise
the existence of their web-based services or to query for the existence of
other web-based services. At the moment, at least, UDDI does not appear to
be a mechanism for describing specific SOAP services (as is the case with
SCL and NASSL), yet rather a mechanism for describing where and how to access
SOAP service descriptions and the services they describe. Essentially the
Yahoo of Web Services.
For more details check out: UDDI.org
- XML And Special Characters
XML predefines five entity references for special characters that would
otherwise be interpreted as part of markup language. These five characters are:
&, <, >,
", and '.
Microsoft published a KB Article (http://support.microsoft.com/support/kb/articles/Q251/3/54.ASP)
on how to deal with these special characters,
but code in this article is not that useful.
Here are the two functions that I wrote to deal with these special characters.
Function ReplaceXMLSpecChars(ByVal strSource)
lngPointer1 = InStr(strSource, "&")
lngPointer2 = InStr(strSource, "<")
lngPointer3 = InStr(strSource, ">")
lngPointer4 = InStr(strSource, """")
lngPointer5 = InStr(strSource, "'")
If lngPointer1 = 0 And lngPointer2 = 0 And lngPointer3 = 0 And lngPointer4 = 0 And lngPointer5 = 0 Then
ReplaceXMLSpecChars = strSource
strNew = ReplaceSingleXMLSpecChar(strSource, "&", "&")
strNew = ReplaceSingleXMLSpecChar(strNew, "<", "<")
strNew = ReplaceSingleXMLSpecChar(strNew, ">", ">")
strNew = ReplaceSingleXMLSpecChar(strNew, """", """)
strNew = ReplaceSingleXMLSpecChar(strNew, "'", "'")
ReplaceXMLSpecChars = strNew
Function ReplaceSingleXMLSpecChar(ByVal strSource, ByVal strSearchFor , ByVal strReplace )
lngPointer = InStr(strSource, strSearchFor)
If lngPointer = 0 Then
ReplaceSingleXMLSpecChar = strSource
strValidString = ""
While Not lngPointer = 0
strValidString = strValidString & Mid(strSource, 1, lngPointer - 1) & strReplace
strSource = Mid(strSource, lngPointer + 1)
lngPointer = InStr(strSource, strSearchFor)
strValidString = strValidString & strSource
ReplaceSingleXMLSpecChar = strValidString