You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by os...@ie.ibm.com on 2001/03/30 19:37:06 UTC

RE: Resolving tag location during call to createElement() in a cu stom DocumentImpl



> Are namespaces out of the question?

I'm afraid so.  The DTD is from a 3rd party and is an adaptation of a
standard vertical industry object model.  That said, the elements are
really part of the same namespace since they are part of the same vertical
model.  (Actually, the DTD isn't the best - the problem causing elements
should been defined as attributes of their parent element instead of
elements themselves but we've all seen that happen before, and will again
:)

I do have a reason for persisting in this approach.  I'm using an XML
Schema for (potentially) validating the incoming XML messages.  The main
design of the Schema is based on the Venetian Blind Design (see "XML
Schemas : Best Practive -  Global Vs Local"
http://www.xfront.com/BestPracticesHomepage.htm) so I've got lots of
ComplexType definitions for primary components (reusable), while lesser,
unreusable, element components are defined inline.

OK so far?  Each type definition has a "annotation/appinfo" child element
into which I put some tags which will be consulted by the (custom)
DocumentImpl when the XML messages are being parsed.  (I parse the Schema
into a DOM and make that available to the DocumentImpl via a factory prior
to actual message parsing)  When the DocumentImpl is given a tag by the
parser, it looks up the definition of that type in the Schema and consults
the appinfo tag to determine what type of element to create.  Given the
scoped nature of schema element declarations, I can have multiple elements
with the same tag name in different parts of the XML document, and
annotation/appinfo to customize the type of Element created.  Essentially,
I'm using the Schema to validate the XML and also customize my
DocumentImpl.

I like this approach - it is compact, fast and easy for my users to
understand and extend since they already know about Schemas (speed and
extensibility are my primary concerns).  Unfortunately, Xerces, or rather,
the DOM API, doesn't seem to be designed to scope tag names during the
parse phase which is my road block :(

Regards,

John.



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org