Skip to content

Commit

Permalink
XSD/XML Schema version tweaking
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Sep 9, 2015
1 parent 7984261 commit 5254d76
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 32 deletions.
47 changes: 24 additions & 23 deletions schemas/LAS.xsd
Expand Up @@ -4,15 +4,15 @@
<xs:simpleType name="interpretationType">
<xs:annotation>
<xs:documentation>
Common interpretations of the data that may be used. This
type may be extended under the expectation that clients
know how to consume the data. In the case of string-like
data, use uint8_t (common byte) as the interpretation
and transform accordingly. Because nulls (or even
multi-byte strings) might be allowed, there are
Common interpretations of the data that may be used. This
type may be extended under the expectation that clients
know how to consume the data. In the case of string-like
data, use uint8_t (common byte) as the interpretation
and transform accordingly. Because nulls (or even
multi-byte strings) might be allowed, there are
no common string interpretations provided by default.
</xs:documentation>
</xs:annotation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="int8_t"/>
<xs:enumeration value="uint8_t"/>
Expand All @@ -38,13 +38,13 @@
<xs:documentation>
Used to describe the storage endianness of the data in the dimension.
</xs:documentation>
</xs:annotation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="big"/>
<xs:enumeration value="little"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="dimensionType">
<xs:all>
<xs:element name="position" type="xs:positiveInteger">
Expand All @@ -53,7 +53,7 @@
The dimension's position in the block of point data
(counting from 1)
</xs:documentation>
</xs:annotation>
</xs:annotation>
</xs:element>

<xs:element name="size" type="xs:positiveInteger">
Expand All @@ -62,8 +62,8 @@
The size of this dimension in bytes.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:element>

<xs:element minOccurs="0" name="name" type="xs:string"/>
<xs:element minOccurs="0" name="description" type="xs:string"/>

Expand All @@ -77,7 +77,7 @@
</xs:annotation>
</xs:element>


<xs:element minOccurs="0" name="interpretation" type="pc:interpretationType">
<xs:annotation>
<xs:documentation>
Expand All @@ -89,37 +89,37 @@
</xs:documentation>
</xs:annotation>
</xs:element>

<xs:element minOccurs="0" name="minimum" type="pc:rangeType">
<xs:annotation>
<xs:documentation>
The minimum value of this dimension.
</xs:documentation>
</xs:annotation>
</xs:annotation>
</xs:element>

<xs:element minOccurs="0" name="maximum" type="pc:rangeType">
<xs:annotation>
<xs:documentation>
The maximum value of this dimension.
</xs:documentation>
</xs:annotation>
</xs:annotation>
</xs:element>

<xs:element minOccurs="0" name="offset" type="xs:double">
<xs:annotation>
<xs:documentation>
The double offset to use when applying a scaling
The double offset to use when applying a scaling
factor to an integer dimension
</xs:documentation>
</xs:annotation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="scale" type="xs:double">
<xs:annotation>
<xs:documentation>
The scale of this dimension. Used to support scaled integer types
</xs:documentation>
</xs:annotation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="endianness" type="pc:endiannessType">
<xs:annotation>
Expand Down Expand Up @@ -151,28 +151,29 @@
<xs:annotation>
<xs:documentation>
Used to describe the storage orientation of the word. The
orientation of dimension might be point-major or dimension-major.
orientation of dimension might be point-major or dimension-major.
A point-major dimension, the default orientation,
has its dimensions composed as XYZXYZXYZ. A dimension-major
one has data composed as XXXYYYZZZ.
</xs:documentation>
</xs:annotation>
</xs:annotation>
<xs:restriction base="xs:string">
<xs:enumeration value="point"/>
<xs:enumeration value="dimension"/>
<xs:enumeration value="unknown"/>
</xs:restriction>
</xs:simpleType>

<xs:element name="PointCloudSchema">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="1" name="dimension" type="pc:dimensionType"/>
<xs:element name="metadata" minOccurs="0" maxOccurs="1" type="xs:anyType"/>
<xs:element name="orientation" minOccurs="0" maxOccurs="1" type="pc:orientationType"/>
<xs:element name="version" minOccurs="0" maxOccurs="1" type="xs:decimal"/>
</xs:sequence>
</xs:complexType>
</xs:element>


</xs:schema>
5 changes: 3 additions & 2 deletions src/XMLSchema.cpp
Expand Up @@ -205,8 +205,6 @@ std::string XMLSchema::xml() const
(const xmlChar*)"xsi", NULL,
(const xmlChar*)"http://www.w3.org/2001/XMLSchema-instance");

xmlTextWriterWriteAttribute(w, (const xmlChar*)"version",
(const xmlChar*)PDAL_XML_SCHEMA_VERSION);
writeXml(w);

xmlTextWriterEndElement(w);
Expand Down Expand Up @@ -622,6 +620,9 @@ void XMLSchema::writeXml(xmlTextWriterPtr w) const
(const xmlChar*)"orientation", NULL,
(const xmlChar*)orientation.str().c_str());

xmlTextWriterWriteElementNS(w, (const xmlChar*)"pc", (const xmlChar*)"version", NULL,
(const xmlChar*)PDAL_XML_SCHEMA_VERSION);


xmlTextWriterEndElement(w);
xmlTextWriterFlush(w);
Expand Down
17 changes: 10 additions & 7 deletions test/unit/XMLSchemaTest.cpp
Expand Up @@ -204,13 +204,16 @@ TEST(XMLSchemaTest, utf8)

XMLDimList dims = s1.xmlDims();
EXPECT_EQ(dims.size(), 1U);
XMLDim& dim = *dims.begin();
EXPECT_EQ(descripValue, dim.m_description);
MetadataNodeList mlist = s1.getMetadata().children();
EXPECT_EQ(mlist.size(), 1U);
MetadataNode& m = *mlist.begin();
EXPECT_EQ(m.name(), metaName);
EXPECT_EQ(m.value(), metaValue);
if (dims.size())
{
XMLDim& dim = *dims.begin();
EXPECT_EQ(descripValue, dim.m_description);
MetadataNodeList mlist = s1.getMetadata().children();
EXPECT_EQ(mlist.size(), 1U);
MetadataNode& m = *mlist.begin();
EXPECT_EQ(m.name(), metaName);
EXPECT_EQ(m.value(), metaValue);
}
}

TEST(XMLSchemaTest, precision)
Expand Down

0 comments on commit 5254d76

Please sign in to comment.