FileGDB API for linux 提供了获取对象定义的函数,但是获取出来的结果都是以XML形式存在,对于表,FeatureClass,FeatureDataset等对象已经足够了,
以下的例子是获得各种对象定义的例子程序,包括Table, FeatureClass, FeatureDataset等等对象的定义。
#include
#include
#include <string>
#include
#include
#include
运行结果如下:
The geodatabase has been opened.
the table TSType definition:
xml version="1.0" encoding="UTF-8"?>
<DataElement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:esri="http://www.esri.com/schemas/ArcGIS/10.0" xsi:type="esri:DETable">
<CatalogPath>/TSType
CatalogPath>
<Name>TSType
Name>
<ChildrenExpanded>false
ChildrenExpanded>
<DatasetType>esriDTTable
DatasetType> <DSID>18
DSID> <Versioned>false
Versioned> <CanVersion>false
CanVersion> <ConfigurationKeyword/> <HasOID>true
HasOID> <OIDFieldName>OBJECTID
OIDFieldName> <Fields xsi:type="esri:Fields"> <FieldArray xsi:type="esri:ArrayOfField"> <Field xsi:type="esri:Field"> <Name>OBJECTID
Name> <Type>esriFieldTypeOID
Type> <IsNullable>false
IsNullable> <Length>4
Length> <Precision>0
Precision> <Scale>0
Scale> <Required>true
Required> <Editable>false
Editable> <AliasName>OBJECTID
AliasName> <ModelName>OBJECTID
ModelName>
Field> <Field xsi:type="esri:Field"> <Name>TSTypeID
Name> <Type>esriFieldTypeInteger
Type> <IsNullable>true
IsNullable> <Length>4
Length> <Precision>0
Precision> <Scale>0
Scale> <AliasName>TSTypeID
AliasName> <ModelName>TSTypeID
ModelName>
Field> <Field xsi:type="esri:Field"> <Name>Variable
Name> <Type>esriFieldTypeString
Type> <IsNullable>true
IsNullable> <Length>255
Length> <Precision>0
Precision> <Scale>0
Scale> <AliasName>Variable
AliasName> <ModelName>Variable
ModelName>
Field> <Field xsi:type="esri:Field"> <Name>Units
Name> <Type>esriFieldTypeString
Type> <IsNullable>true
IsNullable> <Length>20
Length> <Precision>0
Precision> <Scale>0
Scale> <AliasName>Units
AliasName> <ModelName>Units
ModelName>
Field> <Field xsi:type="esri:Field"> <Name>IsRegular
Name> <Type>esriFieldTypeInteger
Type> <IsNullable>true
IsNullable> <Length>4
Length> <Precision>0
Precision> <Scale>0
Scale> <AliasName>IsRegular
AliasName> <ModelName>IsRegular
ModelName> <Domain> <DomainName>AHBoolean
DomainName> <FieldType>esriFieldTypeInteger
FieldType> <MergePolicy>esriMPTDefaultValue
MergePolicy> <SplitPolicy>esriSPTDefaultValue
SplitPolicy> <Description/> <Owner/> <CodedValues xsi:type="esri:ArrayOfCodedValue"> <CodedValue xsi:type="esri:CodedValue"> <Name>True
Name> <Code xsi:type="xs:int">1
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>False
Name> <Code xsi:type="xs:int">0
Code>
CodedValue>
CodedValues>
Domain>
Field> <Field xsi:type="esri:Field"> <Name>TSInterval
Name> <Type>esriFieldTypeInteger
Type> <IsNullable>true
IsNullable> <Length>4
Length> <Precision>0
Precision> <Scale>0
Scale> <AliasName>TSInterval
AliasName> <ModelName>TSInterval
ModelName> <Domain> <DomainName>TSIntervalType
DomainName> <FieldType>esriFieldTypeInteger
FieldType> <MergePolicy>esriMPTDefaultValue
MergePolicy> <SplitPolicy>esriSPTDefaultValue
SplitPolicy> <Description/> <Owner/> <CodedValues xsi:type="esri:ArrayOfCodedValue"> <CodedValue xsi:type="esri:CodedValue"> <Name>1Minute
Name> <Code xsi:type="xs:int">1
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>2Minute
Name> <Code xsi:type="xs:int">2
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>3Minute
Name> <Code xsi:type="xs:int">3
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>4Minute
Name> <Code xsi:type="xs:int">4
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>5Minute
Name> <Code xsi:type="xs:int">5
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>10Minute
Name> <Code xsi:type="xs:int">6
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>15Minute
Name> <Code xsi:type="xs:int">7
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>20Minute
Name> <Code xsi:type="xs:int">8
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>30Minute
Name> <Code xsi:type="xs:int">9
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>1Hour
Name> <Code xsi:type="xs:int">10
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>2Hour
Name> <Code xsi:type="xs:int">11
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>3Hour
Name> <Code xsi:type="xs:int">12
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>4Hour
Name> <Code xsi:type="xs:int">13
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>6Hour
Name> <Code xsi:type="xs:int">14
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>8Hour
Name> <Code xsi:type="xs:int">15
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>12Hour
Name> <Code xsi:type="xs:int">16
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>1Day
Name> <Code xsi:type="xs:int">17
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>1Week
Name> <Code xsi:type="xs:int">18
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>1Month
Name> <Code xsi:type="xs:int">19
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>1Year
Name> <Code xsi:type="xs:int">20
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Other
Name> <Code xsi:type="xs:int">99
Code>
CodedValue>
CodedValues>
Domain>
Field> <Field xsi:type="esri:Field"> <Name>DataType
Name> <Type>esriFieldTypeInteger
Type> <IsNullable>true
IsNullable> <Length>4
Length> <Precision>0
Precision> <Scale>0
Scale> <AliasName>DataType
AliasName> <ModelName>DataType
ModelName> <Domain> <DomainName>TSDataType
DomainName> <FieldType>esriFieldTypeInteger
FieldType> <MergePolicy>esriMPTDefaultValue
MergePolicy> <SplitPolicy>esriSPTDefaultValue
SplitPolicy> <Description/> <Owner/> <CodedValues xsi:type="esri:ArrayOfCodedValue"> <CodedValue xsi:type="esri:CodedValue"> <Name>Instantaneous
Name> <Code xsi:type="xs:int">1
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Cumulative
Name> <Code xsi:type="xs:int">2
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Incremental
Name> <Code xsi:type="xs:int">3
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Average
Name> <Code xsi:type="xs:int">4
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Maximum
Name> <Code xsi:type="xs:int">5
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Minimum
Name> <Code xsi:type="xs:int">6
Code>
CodedValue>
CodedValues>
Domain>
Field> <Field xsi:type="esri:Field"> <Name>Origin
Name> <Type>esriFieldTypeInteger
Type> <IsNullable>true
IsNullable> <Length>4
Length> <Precision>0
Precision> <Scale>0
Scale> <AliasName>Origin
AliasName> <ModelName>Origin
ModelName> <Domain> <DomainName>TSOrigins
DomainName> <FieldType>esriFieldTypeInteger
FieldType> <MergePolicy>esriMPTDefaultValue
MergePolicy> <SplitPolicy>esriSPTDefaultValue
SplitPolicy> <Description/> <Owner/> <CodedValues xsi:type="esri:ArrayOfCodedValue"> <CodedValue xsi:type="esri:CodedValue"> <Name>Recorded
Name> <Code xsi:type="xs:int">1
Code>
CodedValue> <CodedValue xsi:type="esri:CodedValue"> <Name>Generated
Name> <Code xsi:type="xs:int">2
Code>
CodedValue>
CodedValues>
Domain>
Field>
FieldArray>
Fields> <CLSID>{7A566981-C114-11D2-8A28-006097AFF44E}
CLSID> <EXTCLSID/> <RelationshipClassNames xsi:type="esri:Names"/> <AliasName/> <ModelName>TSType
ModelName> <HasGlobalID>false
HasGlobalID> <GlobalIDFieldName/> <RasterFieldName/> <ExtensionProperties xsi:type="esri:PropertySet"> <PropertyArray xsi:type="esri:ArrayOfPropertySetProperty"/>
ExtensionProperties> <ControllerMemberships xsi:type="esri:ArrayOfControllerMembership"/> <Indexes xsi:type="esri:Indexes"> <IndexArray xsi:type="esri:ArrayOfIndex"> <Index xsi:type="esri:Index"> <Name>FDO_OBJECTID
Name> <IsUnique>true
IsUnique> <IsAscending>true
IsAscending> <FieldArray xsi:type="esri:ArrayOfField"> <Field xsi:type="esri:Field"> <Name>OBJECTID
Name> <Type>esriFieldTypeOID
Type> <IsNullable>false
IsNullable> <Length>4
Length> <Precision>0
Precision> <Scale>0
Scale> <Required>true
Required> <Editable>false
Editable> <AliasName>OBJECTID
AliasName> <ModelName>OBJECTID
ModelName>
Field>
FieldArray>
Index> <Index xsi:type="esri:Index"> <Name>G18TSTypeID
Name> <IsUnique>false
IsUnique> <IsAscending>true
IsAscending> <FieldArray xsi:type="esri:ArrayOfField"> <Field xsi:type="esri:Field"> <Name>TSTypeID
Name> <Type>esriFieldTypeInteger
Type> <IsNullable>true
IsNullable> <Length>4
Length> <Precision>0
Precision> <Scale>0
Scale> <AliasName>TSTypeID
AliasName> <ModelName>TSTypeID
ModelName>
Field>
FieldArray>
Index>
IndexArray>
Indexes>
DataElement> the featuredataset Drainage definition is: <DEFeatureDataset xsi:type='typens:DEFeatureDataset' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:typens='http://www.esri.com/schemas/ArcGIS/10.0'><CatalogPath>/Drainage
CatalogPath><Name>Drainage
Name><ChildrenExpanded>false
ChildrenExpanded><DatasetType>esriDTFeatureDataset
DatasetType><DSID>19
DSID><Versioned>false