[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Back to XObjects was XLink - where a

  • From: David Brownell <db@E...>
  • To: David Brownell <db@E...>
  • Date: Fri, 13 Nov 1998 10:31:10 -0800

xobjects xlink
Responding to Graham's comment about binding elements to classes, I wrote:
> 
> I've got an API driven approach, which could be driven based on config
> files using an XML syntax like the one I suggested a while back.  But
> the API can also be driven in other ways, too.  ("Element Factory", an
> interface that can be implemented in many ways.  I'll post more later.)

It's "later", after a busy Thursday and a morning cuppa Java ...

	// to customize DOM tree building
	public interface ElementFactory {
		// like DOM createElement, used with namespaces disabled
		ElementEx createElementEx (String tag);

		// ... namespace aware version
		ElementEx createElementEx (String uri, String tag);
	}

	// implemented by elements and attributes for namespace support
	public interface NamespaceScoped extends Node {
		// returns "local part" of node name, no prefix
		String getLocalName ();

		// returns URI of namespace, null for default
		String getNamespace ();
	}

	// extended element functionality
	public interface ElementEx extends Element, NamespaceScoped {
		// namespace-aware
		String getAttribute (String uri, String name);

		// namespace-aware
		Attr getAttributeNode (String uri, String name);

		// basic delegation hook
		Object getUserObject ();

		// basic delegation hook
		void setUserObject (Object obj);

		// has more, for other purposes ...
		...
	}

That "user object" bit is a delegation hook; it's just stored for use by
applications.  Supports many-to-one association of elements to objects in
an application model, no backlink.  I don't know if it suffices, but I
suspect that any more would become specific to some problem domain.

For the moment, I'm not listing the DocumentBuilder bit here.  Basically,
you can feed an ElementFactory in to a DocumentBuilder and it'll use it
when building the DOM tree; if you don't, it has defaults.  And there's a
simple table-driven implementation that's easily customized.  (Maybe it'll
learn a standard "config file" syntax -- in XML of course!)

Other implementations are clearly possible, including ones using heuristics
like those like James Anderson posted.

- Dave

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.