[XML-SIG] Another Sax2 Enhancement: dataSource

W. Eliot Kimber eliot@isogen.com
Fri, 27 Apr 2001 10:16:46 -0500


I need to be able to get from a DOM the filename or URI of the file it
was constructed from (if it was constructed from a file). I didn't see
anything in the code that preserved this data, so I've hacked my local
copy of the code to add an optional "dataSource" parameter to the
FromFile/URI/Stream methods that propogates to the Sax reader. This is
set as the friend property _dataSource on the resulting DOM node.

Is this an appropriate solution?

I need this because uparsed entity resolution does not preserve the
absolute path of the entities, only the system ID as specified in the
declaration. As I am using relative paths, I must have the path of the
declaring document in order to be able to construct new DOMs from
referenced XML document entities.

Unfortunately, the DOM spec does not provide a property on Entity to
hold the fully-resolved system ID so I think my approach is the only
solution.

My business problem is processing a hyperdocument consisting of many
subordinate documents, where each document is declared as an unparsed
entity with a relative path (this hyperdocument is generated by an
automatic process and the intent is for the resulting package of
documents to be self contained so that it can be packaged and moved
without the need to rework any external identifiers or catalog files).

Thanks,

Eliot
-- 
. . . . . . . . . . . . . . . . . . . . . . . .

W. Eliot Kimber | Lead Brain

1016 La Posada Dr. | Suite 240 | Austin TX  78752
    T 512.656.4139 |  F 512.419.1860 | eliot@isogen.com

w w w . d a t a c h a n n e l . c o m