Okay first output time:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:gml="http://www.opengis.net/gml"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:import namespace="http://www.opengis.net/gml"
schemaLocation="http://localhost//gml/2.1.2/feature.xsd"/>
<xsd:complexType name="location">
<xsd:complexContent>
<xsd:extension base="gml:AbstractFeatureType">
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="0" name="geom" nillable="true"
type="gml:PointPropertyType"/>
<xsd:element maxOccurs="1" minOccurs="0" name="name" nillable="true"
type="xsd:string"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="location" substitutionGroup="gml:_Feature"
type="location"/>
</xsd:schema>
Generated by:
SimpleFeatureType TYPE =
DataUtilities.createType("location","geom:Point,name:String");
ByteArrayOutputStream out = new ByteArrayOutputStream();
GMLEncoder encode = new GMLEncoder( out );
encode.setBaseURL( new URL("http://localhost/"));
encode.setGML("gml2");
encode.encode( TYPE );
out.close();
String xsd = out.toString();
System.out.println( xsd );
assertNotNull
The following also works:
- encoder.setGML("gml3" )
Jody
On 03/06/2010, at 8:05 AM, Jody Garnett wrote:
> Code is posted in the gt-xml module; I am almost following you about XSD type
> maping profiles. Can I navigate from one to the other; or do I have to create
> the ordering myself.
>
> Jody
>
> On 03/06/2010, at 1:32 AM, Justin Deoliveira wrote:
>
>> On 10-06-02 7:07 AM, Jody Garnett wrote:
>>> Hi Justin;
>>>
>>> Thought I would walk before I run and have started the GMLEncoder in the
>>> gt-xml module. The idea is to configure it for what you want to do using a
>>> nice big "gml2" or "gml3" switch, and then perform common tasks such as
>>> encoding a feature collection, or a featureType. I have all the
>>> implementations available so we should be able to choose the right tool for
>>> the job; and/or perform any migrations between encoders smoothly.
>>>
>>> I am slowly going through how you do things in geoserver and have gotten
>>> bogged down going from a java binding to a typeName.
>>>
>>> The GeoServer code has a very magic class that I think you wanted to do
>>> properly as a geotools Profile of a Schema? I suspect the idea is to
>>> minimise duplicates where one Java class has more then one option it can be
>>> mapped to.
>>>
>>> Any guidance; am i on the right track.
>>
>> Yes, the magic instance is available via XSD.getTypeMappingProfile(). Those
>> are unique java class to xml types. Remember that XSD's have dependencies,
>> and each one has its own type mapping profile. So start with the one for
>> WFS, work to GML3, and down the line... eventually pulling in the XS type
>> mapping profile which contains all the "primitive" mappings such as Integer,
>> Double, etc..
>>
>> Post your code and I will do a code review. Glad to hear you are making
>> progress.
>>>
>>> Jody
>>
>>
>> --
>> Justin Deoliveira
>> OpenGeo - http://opengeo.org
>> Enterprise support for open source geospatial.
>
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel