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

Re: Next Round

  • From: Tyler Baker <tyler@i...>
  • To: james anderson <James.Anderson@m...>
  • Date: Thu, 21 Jan 1999 15:37:59 -0500

Re: Next Round
james anderson wrote:

> yes, but...
>
> Tyler Baker wrote:
> >
> > Don Park wrote:
> >
> > First, we will need to define a new type, namely Name.
> >
> > public interface Name {
> >   String getPrefix(); // inappropriate
> >   String getLocalName();
> >   String getQualifiedName(); // inappropriate
> >   String getNamespace();
> >   String getExpandedName();
> >   Name clone();
> > }
>
> Neither the prefix nor the qualified name have the same permanence as the
> local name, the namespace and the expanded name. One could well collect all
> prefixes in connection with which as symbol appeared, but the values are of no
> use as the bindings have dynamic extent.
> the prefix and the qualified name need to be handled separately, through an
> interface which combines symbols (here called names) with a dynamic parsing or
> serialization  context.
>
> The other additions have to be modified accordingly: as the prefix has no
> meaning outside of the parser's dynamic context, those interfaces have no purpose.

Very true, but sometimes applications (or even the DOM) may want to preserve the exact
document structure in memory and be able to write out that exact document structure as
well.  That is the only reason for providing the prefix and qualified name methods.

> I know the spec gives you no binding for a prefix to a uri within the dtd, but
> using the prefix is worse setting some binding rules and sticking to them.
> Setting binding rules yields the same results as using the perfix in cases
> which are unambiguous, offers a consistent interfaces, and - by virtue of the
> bindings rules - at least yields defined results in cases where using the
> prefix would yields an undefined result due to ambiguity. Three arguments for
> the approach and none against.

Good point.  I have a bad habit of only thinking positively sometimes (-:

> >
> > Then change the startElement method to:
> >
> > ...
> >
> this, for example, is defined only at the moment the element is being
> processed. outside of the element's scope there is no defined result.
> > String getTypeByQualifiedName(String prefix, String localName);
> > // prefix + ':' + localName
> > String getTypeByQualifiedName(String qualifiedName);
> >
>
> It would be better to use functions like the following (the results of which
> are always defined)

I agree, it is just that there may be reasons I cannot ascertain that an application
may want the exact document structure presented to the application.  Perhaps an XML
tree viewer for example or as I said before the DOM.  Calling
getTypeByQualifiedName(String qualifiedName) would function pretty much exactly as
things are defined now.  In other words, if an XML document does not implement
namespaces, then using this method may be your cup of tea.

> > String getTypeByExpandedName(String namespace, String localName);
> > // namespace + ':' + localName
> > String getTypeByExpandedName(String expandedName);
>
> The former can be combined with a function to determine the uri bound to a
> prefix - if need be. In my experience this latter function is of no use to an
> application, as an application operates is better operating in terms of the
> universal names only.

It can be of use in Java if the entire expanded name is interned and you do your
string comparisons by identity.  It is just a matter of whether you want to process
things like:

if (namespace == "foo") {
  if (localName == "bar") {
    // Do something
  }
}

or else do something like:

if (expandedName == "foo:bar") {
  // Do something
}

Tyler


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.