Hi Karl,

There is not anything (that I know of) that you can call standalone to
go from xml to a feature type. There is definitely code that does this
but its kind of hidden in the gml parsers.

You could try using the gml datastore. Once you create the datastore you
can call getSchema(). The downside is that you will need an instance
document to pass to the datastore when you create it.

-Justin

Karl Guillotte wrote:
> Hi,
> 
> I have transformed a FeatureType to a XML document using this code:
> 
> FeatureTypeFactory builder = FeatureTypeBuilder.newInstance("EXEMPLE");
> attr = AttributeTypeFactory.newAttributeType("ATTRIBUT2", LineString.class);
> builder.addType(attr);
> AttributeType attr = AttributeTypeFactory.newAttributeType("ATTRIBUT1", 
> String.class);
> builder.addType(attr);
> FeatureType type = builder.getFeatureType();
> FeatureTypeTransformer t = new FeatureTypeTransformer();
> File file = new File("T://temp//featureType.xml");
> OutputStream stream = new FileOutputStream(file);
> t.transform(type , stream);
> 
> I get this kind of file :
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:complexType xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
> name="EXEMPLE_Type">
>     <xs:complexContent>
>         <xs:extension base="gml:AbstractFeatureType">
>             <xs:sequence>
>                 <xs:element name="ATTRIBUT1" minOccurs="0" nillable="true">
>                     <xs:simpleType>
>                         <xs:restriction base="xs:string">
>                             <xs:maxLength value="2147483647"/>
>                         </xs:restriction>
>                     </xs:simpleType>
>                 </xs:element>
>                 <xs:element name="ATTRIBUT2" minOccurs="0" 
> nillable="true" type="gml:LineStringPropertyType"/>
>             </xs:sequence>
>         </xs:extension>
>     </xs:complexContent>
> </xs:complexType>
> 
> 
> Now, I would to do the inverse the process : XML => FeatureType
> 
> I have checked over all the GeoTools API, but it as still confusing how 
> I can get a FeatureType from an XML file...
> 
> Any help will be appreciated !
> 
> Thanks,
> Karl
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Geotools-gt2-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


-- 
Justin Deoliveira
The Open Planning Project
[EMAIL PROTECTED]

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to