[
Lists Home |
Date Index |
Thread Index
]
Philippe Poulard wrote:
> Where are XML types ?
> People know xs:string, xs:int and xs:QName, because they are taken from
> raw data,
These are defined in XML Schema. I don't know what "taken from raw data"
means.
> but is there high level types for XML items such as
> xml:element, xml:attribute, or xml:namespace ?
XML Schema does not define such a type because all elements would belong
to it, and adding an attribute to an element to say that it is an
element would be superfluous. The XML Infoset identifies the various
kinds of nodes, and most APIs or XML languages can recognize instances
of these things.
> I have to name (with a QName) objects (that can be XML items) as if they
> were types.
You can certainly assign QNames in some contexts. You can't add a type
label directly to an attribute, because there's no place to put it. But
what would be the point of adding information to an element to say that
it is an element? Or are you trying to do something else?
> I really really don't think that XPath2 offers a reasonable solution with :
> "5 instance of xs:integer"
> ". instance of element()"
> the last one frightened me :(
The type names in those two expressions are:
xs:integer
element()
You also have syntax for testing whether something has a given type.
Hope this helps!
Jonathan
|