[
Lists Home |
Date Index |
Thread Index
]
7/9/2002 2:05:15 PM, Jonathan Robie <jonathan.robie@datadirect-technologies.com> wrote:
>>
>>Now, I am parsing xml file using DOM. How can I get the data type for year,
>>month etc?????
>
>Whose DOM are you using?
It doesn't matter, there is no straightforward, standard way to
access this information.
[What follows is my personal assessment, not that of the DOM wG or
my employer]
The DOM (levels 1, 2, and in the current conception of level 3) operates on
the XML InfoSet, i.e., what an XML parser produces. In the overall W3C
model, the type information is added to the InfoSet by a W3C Schema
validator, and this known as the Post Schema Validation Infoset or PSVI.
The DOM does not have any conception of the PSVI, so there is no straightforward
way incorporate the type information without adopting the WXS worldview,
and this seems premature given the immaturity of and controversy surrounding
the WXS specification.
The DOM WG attempted to define an "Abstract Schema" module that would have
provided standard APIs to access the information contained in a DTD or
schema ("schema" in the generic sense, not limited to WxS). This proved
unsatisfactory, and the the work is now suspended, for reasons which
long-time XML-DEV readers may appreciate: the result was too complex
for DTD or RELAX NG users and inadequate to meet the needs of WXS users;
it was "computer science by committee" rather than a standardization of
existing practice, so it was unclear whether it could be implemented or
used in the real world; and it stumbled over the numerous PSVI issues that
we love to debate here. (A simpler "validation" API to check whether an
instance is valid against a DTD or schema, and to query for valid
elements/attributes at some point in an instance, will be in Level 3).
Proprietary DOM extensions (probably Microsoft's, perhaps Apache's) may provide
"DOM" APIs to access the type information in the PSVI, but applications which
use these APIs will not work with other implementations. Use them if they
work for you, but use them with caution.
The possibility of the next major version of the DOM supporting the PSVI is
under consideration inside the W3C; members may wish to look into this issue
and make sure that their opinion is registered ... I don't think I can be
more explicit due to the confidentiality guidelines, sorry.
|