Basic XMLSchema questions

Brett McLaughlin bmclaugh at
Thu Jan 6 00:33:54 GMT 2000

Alan Santos wrote:
> > >
> > > Syntactically it appears to be legal to simply have <type> on it's own,
> Sorry, I meant to say <type name='xxx'>,  I'm pretty clear on type now.
> Thanks very much.
> You may have missed another question in a previous email....
> At one point you had made a critical remark regarding XML schema to model a
> class...
> "Your schema is one-to-one with a Java class?  This wouldn't be a good
> idea, unless I'm misunderstanding your intent.  Maybe your _XML_ is
> based on a class, and it specifies the class, but then multiple XML docs
> (therefore multiple classes) all use the same Schema."
> Originally, this is what I was trying to use an XML Schema to do (that is:
> store class info), and use an XML document to store instance values. (Sort
> of a simplified XMI)

I'll be very blunt; I think XML is great as a data representation.  I
think it is not quite there for mapping of objects.  What you are
talking about, I actually have built to a great extent in XML, so I can
graph Java objects (and instances of those objects) for an XML-RPC
application to talk across a network.  I just don't think it is
necessarily there yet.

I still am not sure why you would want this graphing?  Even in my
XML-RPC, I found that most times it was worth the cost to completely
graph an object/instance, it was worth using RMI.  It was only when
making procedural calls that returned simple primitives or very simple
objects that XML-RPC shone (although it's highly recommended for those

Why not use the schema for more of a constraining validation scenario? 
It is fairly simple to use almost the exact same XML document to
represent both an object in general and an instance of said object.  In
fact, I could create a dirty XML map of an object, that could be
"extended" (in this case, I mean elements added/attributes changed)
without changing the original elements to represent any given instance. 
Then my schema is across all Java objects, ensuring that other apps can
"understand" and de-map what I am sending them.  All in all, a better
solution, I think.  Certainly faster... schema validation ain't quick
yet ;-)  Although with SAX2 I know that will improve much (b/c of
standard interface - more heads = better solutions).

> I'm not sure I can do this, in any manner that doesn't break XML schemas.
> There doesn't appear to be a mechanism in place to expand the functionality
> of XML-Schemas

As Henry pointed out, there are what I would consider "hacks" and
"back-doors" that make it *possible*.

> But if it is possible, I'm interested in why you feel this is a bad idea?

I think you are better to do this sort of thing in raw Java.  Of course,
I still haven't seen what you are trying to accomplish, so maybe that
would help ;-)


> (BTW, I think this is similar to what was done with Quick)
> Finally, .
> thanks,
> alan

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list