You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Elena Litani <el...@ca.ibm.com> on 2002/10/17 19:45:47 UTC
XNI: making NamesapaceContext read/write
The following are the only interfaces in the XNI that are read-only:
* NamespaceContext
* XMLResourceIdentifier
* XMLLocator
Given that XNI now uses NamespaceContext, instead of
start/endPrefixMapping, some components in the pipeline need to be able
to add namespace declarations. Consider, for example, the following
case:
an XNI application adds components down the pipeline that inserts XML
fragment into the document. In this case, the application most likely
needs to update NamespaceContext for appropriate namespace binding
information in the fragment.
I could imagine that for same reasons you might also want to change
XMLLocator and XMLResourceIdentifier.
Thus, I suggest to make the following changes:
NamespaceContext: add 3 read/write and 1 read/only methods
----------------------------------------------------------
/**
* Start a new Namespace context.
* <p>
* You should push a new context at the beginning
* of each XML element: the new context will automatically inherit
* the declarations of its parent context, but it will also keep
* track of which declarations were made within this context.
* <p>
*
* @see #popContext
*/
public void pushContext() {}
/**
* Revert to the previous Namespace context.
* <p>
* You should pop the context at the end of each
* XML element. After popping the context, all Namespace prefix
* mappings that were previously in force are restored.
* <p>
* You must not attempt to declare additional Namespace
* prefixes after popping a context, unless you push another
* context first.
*
* @see #pushContext
*/
public void popContext() {
} // popContext()
/**
* Declare a Namespace prefix.
* <p>
* This method declares a prefix in the current Namespace
* context; the prefix will remain in force until this context
* is popped, unless it is shadowed in a descendant context.
* <p>
* Note that to declare a default Namespace, use the empty string.
* The prefixes "xml" and "xmlns" can't be rebound.
* <p>
* Note that you must <em>not</em> declare a prefix after
* you've pushed and popped another Namespace.
*
* @param prefix The prefix to declare, or null for the empty
* string.
* @param uri The Namespace URI to associate with the prefix.
*
* @return true if the prefix was legal, false otherwise
*
* @see #getURI
* @see #getDeclaredPrefixAt
*/
public boolean declarePrefix(String prefix, String uri) {}
/**
* Look up a prefix and get the currently-mapped Namespace URI.
* <p>
* This method looks up the prefix in the current context.
* Use the empty string ("") for the default Namespace.
*
* @param prefix The prefix to look up.
*
* @return The associated Namespace URI, or null if the prefix
* is undeclared in this context.
*/
public String getURI(String prefix);
XMLResourceIdentifier: add 4 read/write
---------------------------------------
public void setPublicId(String publicId);
public void setExpandedSystemId(String systemId);
public void setLiteralSystemId(String systemId);
public void setBaseSystemId(String systemId);
XMLLocator
-----------
public void setLineNumber();
public void setColumnNumber();
Comments? Suggestions?
Thank you,
--
Elena Litani / IBM Toronto
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
Re: XNI: making NamesapaceContext read/write
Posted by Joseph Kesselman <ke...@us.ibm.com>.
Making NamespaceContext writable sounds like it might simplify
constructing XNI pipelines... Sounds reasonable to me. (I'm almost tempted
to suggest a non-writable subset interface implemented by the same
objects, so you can use the type system to say whether you think folks
should be writing to it or not and possibly catch a few coding errors...
but that may be overkill.)
______________________________________
Joe Kesselman / IBM Research
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
Re: XNI: making NamesapaceContext read/write
Posted by Andy Clark <an...@apache.org>.
Elena Litani wrote:
> The following are the only interfaces in the XNI that are read-only:
>
> * NamespaceContext
> * XMLResourceIdentifier
> * XMLLocator
>
> Given that XNI now uses NamespaceContext, instead of
> start/endPrefixMapping, some components in the pipeline need to be able
> to add namespace declarations. Consider, for example, the following
> case:
Yes, this seems like the natural progression. Everything
*else* is read/write so why aren't these interfaces that
you list the same? Since we're trying to round out XNI
by the end of the year and make the final 1.0 changes, I
think that this is worthwhile.
What does everyone else think?
--
Andy Clark * andyc@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org