[
Lists Home |
Date Index |
Thread Index
]
At 02:41 PM 2/1/2002 -0500, Daniel Veillard wrote:
>Let's have a look of the alternatives in XML:
>
> #foo
>
>Hard to rely on it with XML, well last time I suggested on this forum xml:id
>I got a lot of flack back, I won't try again.
I don't think I was in on that debate. At first blush, xml:id seems like
just what the doctor ordered - why did people object? It meets the
following useful criteria:
1. It works with or without DTDs or Schemas.
2. References remain stable in the face of changes to the document.
3. It is very simple.
Of course, people may have additional schemes by which they wish to address
into documents, but would these need to own the fragment identifier?
> So either you accept to force validation of document (and hence
>possibly have to fetch and trust remote DTD in your framework) or you
>need other pointing schemes.
>
> #/root/foo[1]/bar[2]
>
> Just doesn't work as is because it doesn't allow for namespace support
>and hence out of scope (or you put schemes in to allow binding namespace
>prefixes to URI, possible but I don't remember anybody suggesting it).
I think that XPointer already has a way of declaring namespaces:
#xmlns(x=http://example.com/foo) xpointer(/x:root/x:foo[1]/x:bar[2])
> #1/2/3
>
>breaks as soon as an ancestor or any predecessor of those is modified
>would work for really static content, but the maintainance cost looks ...
>interesting
Ah, but that's what you get for trying to create stable references into
documents that change. If you want to guarantee that you can actually do
that, you need identifiers in the referenced document, and these
identifiers serve as a contract on behalf of the referenced document which
has agreed to provide these addresses.
If you don't have that guarantee from the referenced document, then there
is no way to ever guarantee references will not break. XPointer has worked
really hard to get as close as possible to being robust in the face of
change, but it can still fall on its face when a document changes.
> If you think that
> #foo
>is simple and fast, yes in a very well defined context, in general it's
>an horrible solution, you have to rely on something outside the document
>itself to simply make that request. //*[@id=foo] at least can work directly
>on the document.
I'm not sure what semantics you intend for the above syntax. Suppose the
meaning of #foo is identical to the following XPath expression:
//*[@xml:id="foo"]
That seems cheap and effective. At any rate, I have not studied this
particular problem extensively, but at first blush, any one of the three
solutions you consider unworkable seems reasonable. The middle one seems
more complex, because it requires namespace processing, so I would be
inclined to rule this out of the minimum conformance level for whatever
language owns the fragment identifier.
Let me be clear though, I think that full-fledged hypertext along the lines
of the original XPointer vision is a good thing, and I am not at all saying
it should not exist. I am, however, saying I do not believe it should own
the fragment identifier for XML. That should be reserved for a very simple
and efficient kind of pointer.
Jonathan
|