- From: "Michael Kay" <mike@s...>
- To: "'liam mail'" <liam.list@g...>,<xml-dev@l...>
- Date: Thu, 19 Feb 2009 16:03:17 -0000
You can get access to this data without parsing it yourself
by using schema-aware XQuery or XSLT 2.0. If you do this, the typed value of a
vector4 element will be a sequence of four floats.
It's
not hard to parse it yourself in non-schema-aware XQuery or XSLT 2.0 either - a
simple call on tokenize() will do it for you.
Michael Kay
http://www.saxonica.com/
Hello Until recently I use the following format for a
matrix <matrix m01="1.000000" m02="0.000000" m03="0.000000"
m04="0.000000" m05="0.000000" m06="1.000000" m07="0.000000" m08="0.000000"
m09="0.000000" m10="0.000000" m11="1.000000" m12="0.000000" m13="0.000000"
m14="0.000000" m15="0.000000" m16="1.000000" />
Yet after reading
the schema primer I changed this to the following format
<matrix16>
<vector4>1.000000 0.000000 0.000000 0.000000</vector4>
<vector4>0.000000 1.000000 0.000000 0.000000</vector4>
<vector4>0.000000 0.000000 1.000000 0.000000</vector4>
<vector4>0.000000 0.000000 0.000000 1.000000</vector4>
</matrix16>
Which is validated by the following snippet of schema
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<xsd:element name="matrix16" type="matrix16_type"/> <xsd:simpleType name="float_list">
<xsd:list itemType="xsd:float"/> </xsd:simpleType> <xsd:simpleType name="vector4_type"> <xsd:restriction base="float_list">
<xsd:length value="4"/> </xsd:restriction> </xsd:simpleType> <xsd:complexType name="matrix16_type">
<xsd:sequence> <xsd:element name="vector4" type="vector4_type" minOccurs="4" maxOccurs="4"/>
</xsd:sequence> </xsd:complexType> </xsd:schema>
Now the xml file passes validation but I do not know of an xml libraries which allows me access to this data without myself parsing it, as I was informed that "XML specifies that the innermost content of a tag is CDATA". If I used this list in an attribute of an
element the same situation would apply.
So my question to the mailing list is should I have changed the organisation of the xml from my original format or how can I get to the data without having to parse it myself.
Thanks.
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
|