Hi,
I'm trying to write an XML document using multiple namespaces, the output 
should be something like this:

<?xml version="1.0" encoding="UTF-8"?>
<Collections
   service="WFS"
   version="3.0.0"
   xmlns="http://www.opengis.net/wfs/3.0";
   xmlns:atom="http://www.w3.org/2005/Atom";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://www.opengis.net/wfs/3.0 ../wfs.xsd ">
   <Collection>
      <Name>aerofacp_1m</Name>
      <Title>Airport Facilities Points</Title>
      <atom:link rel="item"
            title="Airport Facilities Points"
            type="application/geo+json"
            
href="http://www.acme.com/3.0/wfs/collections/aerofacp_1m/items?f=application%2Fvnd.geo%2Bjson"/>
      <atom:link rel="item"
            title="Airport Facilities Points"
            
type="application/gml+xml;version=3.2;profile=http://www.opengis.net/def/profile/ogc/2.0/gml-sf0";
            
href="http://www.acme.com/3.0/wfs/collections/aerofacp_1m/items?f=application%2Fgml%2Bxml%3Bversion%3D3.2%3Bprofile%3Dhttp%3A%2F%2Fwww.opengis.net%2Fdef%2Fprofile%2Fogc%2F2.0%2Fgml-sf0"/>
      <atom:link rel="alternate"
            title="Airport Facilities Points"
            type="text/html"
            
href="http://www.acme.com/3.0/wfs/collections/aerofacp_1m/items?f=text%2Fhtml"/>
      <atom:link rel="describedBy"
            title="Schema for Airport Facilities Points"
            type="application/xml"
            
href="http://www.acme.com/3.0/wfs/collections/aerofacp_1m/schema"/>
      <Extent>
         <Spatial crs="http://www.opengis.net/def/crs/OGC/1.3/CRS84";>
            <LowerCorner>-179.878326416016 -54.9311103820801</LowerCorner>
            <UpperCorner>179.339859008789 79.52944183349609</UpperCorner>
         </Spatial>
         <Temporal 
trs="http://www.opengis.net/def/uom/ISO-8601/0/Gregorian";>
            <begin>2017-01-01T00:00:00Z</begin>
            <end>2017-12-31T23:59:59Z</end>
         </Temporal>
      </Extent>
      <DefaultCRS>http://www.opengis.net/def/crs/OGC/1.3/CRS84</DefaultCRS>
   </Collection>
   ...
</Collections>


However, checking the existing annotations, I only could get as far as the 
following:

<Collections xmlns="http://www.opengis.net/wfs/3.0";>
  <Collection>
    <Name>cgf__Lines</Name>
    <Title>Lines</Title>
    <Description/>
    <extent>
      <extent>-180.0</extent>
      <extent>-90.0</extent>
      <extent>180.0</extent>
      <extent>90.0</extent>
    </extent>
    <wstxns1:link xmlns:wstxns1="http://www.w3.org/2005/Atom"; 
wstxns1:href="http://localhost:8080/geoserver/wfs3/cgf__Lines?f=text%2Fxml%3B%20subtype%3Dgml%2F2.1.2";
 
wstxns1:rel="about" wstxns1:title="cgf__Lines as text/xml; 
subtype=gml/2.1.2" wstxns1:type="text/xml; subtype=gml/2.1.2"/>
    <wstxns2:link xmlns:wstxns2="http://www.w3.org/2005/Atom"; 
wstxns2:href="http://localhost:8080/geoserver/wfs3/cgf__Lines?f=text%2Fxml%3B%20subtype%3Dgml%2F3.1.1";
 
wstxns2:rel="about" wstxns2:title="cgf__Lines as text/xml; 
subtype=gml/3.1.1" wstxns2:type="text/xml; subtype=gml/3.1.1"/>
    <wstxns3:link xmlns:wstxns3="http://www.w3.org/2005/Atom"; 
wstxns3:href="http://localhost:8080/geoserver/wfs3/cgf__Lines?f=application%2Fgml%2Bxml%3B%20version%3D3.2";
 
wstxns3:rel="about" wstxns3:title="cgf__Lines as application/gml+xml; 
version=3.2" wstxns3:type="application/gml+xml; version=3.2"/>
    <wstxns4:link xmlns:wstxns4="http://www.w3.org/2005/Atom"; 
wstxns4:href="http://localhost:8080/geoserver/wfs3/cgf__Lines?f=SHAPE-ZIP"; 
wstxns4:rel="about" wstxns4:title="cgf__Lines as SHAPE-ZIP" 
wstxns4:type="SHAPE-ZIP"/>
    <wstxns5:link xmlns:wstxns5="http://www.w3.org/2005/Atom"; 
wstxns5:href="http://localhost:8080/geoserver/wfs3/cgf__Lines?f=csv"; 
wstxns5:rel="about" wstxns5:title="cgf__Lines as csv" wstxns5:type="csv"/>
    <wstxns6:link xmlns:wstxns6="http://www.w3.org/2005/Atom"; 
wstxns6:href="http://localhost:8080/geoserver/wfs3/cgf__Lines?f=application%2Fjson";
 
wstxns6:rel="about" wstxns6:title="cgf__Lines as application/json" 
wstxns6:type="application/json"/>
  </Collection>
  ... full document skipped ...
    <wstxns169:link xmlns:wstxns169="http://www.w3.org/2005/Atom"; 
wstxns169:href="http://localhost:8080/geoserver/wfs3/sf__PrimitiveGeoFeature?f=text%2Fxml%3B%20subtype%3Dgml%2F2.1.2";
 
wstxns169:rel="about" wstxns169:title="sf__PrimitiveGeoFeature as text/xml; 
subtype=gml/2.1.2" wstxns169:type="text/xml; subtype=gml/2.1.2"/>
    <wstxns170:link xmlns:wstxns170="http://www.w3.org/2005/Atom"; 
wstxns170:href="http://localhost:8080/geoserver/wfs3/sf__PrimitiveGeoFeature?f=text%2Fxml%3B%20subtype%3Dgml%2F3.1.1";
 
wstxns170:rel="about" wstxns170:title="sf__PrimitiveGeoFeature as text/xml; 
subtype=gml/3.1.1" wstxns170:type="text/xml; subtype=gml/3.1.1"/>
    <wstxns171:link xmlns:wstxns171="http://www.w3.org/2005/Atom"; 
wstxns171:href="http://localhost:8080/geoserver/wfs3/sf__PrimitiveGeoFeature?f=application%2Fgml%2Bxml%3B%20version%3D3.2";
 
wstxns171:rel="about" wstxns171:title="sf__PrimitiveGeoFeature as 
application/gml+xml; version=3.2" wstxns171:type="application/gml+xml; 
version=3.2"/>
    <wstxns172:link xmlns:wstxns172="http://www.w3.org/2005/Atom"; 
wstxns172:href="http://localhost:8080/geoserver/wfs3/sf__PrimitiveGeoFeature?f=SHAPE-ZIP";
 
wstxns172:rel="about" wstxns172:title="sf__PrimitiveGeoFeature as 
SHAPE-ZIP" wstxns172:type="SHAPE-ZIP"/>
    <wstxns173:link xmlns:wstxns173="http://www.w3.org/2005/Atom"; 
wstxns173:href="http://localhost:8080/geoserver/wfs3/sf__PrimitiveGeoFeature?f=csv";
 
wstxns173:rel="about" wstxns173:title="sf__PrimitiveGeoFeature as csv" 
wstxns173:type="csv"/>
    <wstxns174:link xmlns:wstxns174="http://www.w3.org/2005/Atom"; 
wstxns174:href="http://localhost:8080/geoserver/wfs3/sf__PrimitiveGeoFeature?f=application%2Fjson";
 
wstxns174:rel="about" wstxns174:title="sf__PrimitiveGeoFeature as 
application/json" wstxns174:type="application/json"/>
  </Collection>
</Collections>

The output is formally correct, but:

   - Repeats the atom namespace over and over while a single declaration at 
   the top of the document would be suffient
   - Prefixes the attributes, but I don't think that's actually required, 
   they should inherit the namespace of the owning element by default

Wondering if I could achieve the results I'm looking for by subclassing? 
I've looked in the code of jackson-dataformat, but could not find the right 
spot.
Ah, I'm using version 2.9.5, checked the issue tracker, but found no 
discussion on the topic, so I'm guessing it could still be an issue with the
latest version (however, did not try to build from sources).

Best regards
Andrea

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to