New XML API from Microsoft
John Tigue
john at datachannel.com
Thu Jul 24 19:03:25 BST 1997
I think it is great that XML is developing so quickly. I welcome
Microsoft's hard work. I think, though, that we need a well designed
object model for developer to use. From the below snippet taken from the
MS site, we can see that MS-XOM is based on the Java processor work. In
both these cases, I feel that a most basic object type, Element, is
misdefined. I do not think that text, comments, DTDs and "other" are
types of elements. Perhaps they are Markup but not Element.
I hope that we can work out a model which will be good for the
developers. I would also hope that MS would return to open,
collaborative discussion of XML development issues. Previous to the
beginning of work on Xapi-J this list had valuable and productive input
from MS and its developers. They have since grown silent. For an
alternative object model, please consider the collectively developed
Xapi-J. I have been maintaining a site for tracking the Xapi-J work. The
URL is http://www.datachannel.com/ChannelWorld/xml/dev.
MS-XOM IXMLElement most closely resembles Xapi-J's IContent interface.
IContent could be extended to include MS's work on IXMLElement perhaps
with a method, such as, getContentType() but not IXMLELement::get_
type(). MS's Java XML processor has already influence Xapi-J so merging
the differences would not be anything new in terms of process. The XML
spec (section 3.1) clearly defines the term "element type". The spec's
production [33] is as follows:
STag ::= '<' Name (S Attribute)* S? '>'
The above "Name" is the "element type". Text, Comment, DTDs simply do
not have "element type". MS-XOM is misusing the spec's terminology. I
hope in the end we have a standard which reflects the best of everyone's
ideas. Only by collaborating together can we get there. It would be a
shame if less well informed developers started learning XML doc
interfacing as curently modeled by MS-XOM.
<beginSnippet>
IXMLElement::get_type
HRESULT IXMLElement::get_type(
long *plType)
Returns S_OK on success.
*plType
Indirect pointer to return the type.
Each node of the tree is labeled as being one of the following types:
typedef enum xmlelemTYPE {
XMLELEMTYPE_ELEMENT,
XMLELEMTYPE_TEXT,
XMLELEMTYPE_COMMENT,
<!-- XMLELEMTYPE_DOCUMENT,
XMLELEMTYPE_DTD, -->
XMLELEMTYPE_OTHER
} XMLELEM_TYPE;
For Internet Explorer 4.0, the interesting element types are
XMLELEMTYPE_ELEMENT, XMLELEMTYPE_TEXT, and
XMLELEMTYPE_COMMENT.
In the following code, both the CHANNEL and the TITLE elements are
marked as being of type XMLELEMTYPE_ELEMENT. Their names are
returned as "CHANNEL" and "TITLE", respectively. (The names are always
all uppercase). The TITLE element has one child, which is a text
element marked as being of type XMLELEMTYPE_TEXT.
<CHANNEL>
<title> Breaking News </title>
<!-- This is a comment element-->
</CHANNEL>
<endSnippet>
--
John Tigue
Programmer
jtigue at datachannel.com
DataChannel (http://www.datachannel.com)
206-462-1999
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vcard.vcf
Type: text/x-vcard
Size: 263 bytes
Desc: Card for John Tigue
Url : http://mailman.ic.ac.uk/pipermail/xml-dev/attachments/19970724/ebd92887/vcard.vcf
More information about the Xml-dev
mailing list