[fdo-trac] #738: XmlFeatureSerialiser Does not Handle XMLFlags

FDO trac_fdo at osgeo.org
Wed Jan 12 10:30:12 EST 2011


#738: XmlFeatureSerialiser Does not Handle XMLFlags
----------------------------+-----------------------------------------------
   Reporter:  crispinatime  |       Owner:  gregboone
       Type:  defect        |      Status:  new      
   Priority:  minor         |   Milestone:  3.6.0    
  Component:  FDO API       |     Version:  3.6.0    
   Severity:  3             |    Keywords:           
External_id:                |  
----------------------------+-----------------------------------------------
 When the XmlFeatureSerialiser has xmlFlags, but the XmlFeatureWriter does
 not, then xmlSerializer.Serialize should temporarily pass the flags down
 to the XmlFeatureWriter

 This would mean that that application would only need to set the flags on
 the topmost object rather than on both of them.

 I have set priority as minor as there is a workaround

 WORKING EXAMPLE

 {{{

  // set flags first so that can be included in writer
  OSGeo_FDO.Xml.XmlFeatureFlags xmlFlags = new
 OSGeo.FDO.Xml.XmlFeatureFlags();
  xmlFlags.DefaultNamespace = "1Spatial";

  // set options for GML format
  #if FDO36
  try
  {
        if (radioGML311.Checked)
                xmlFlags.GmlVersion =
 OSGeo.FDO.Xml.GmlVersion.GmlVersion_311;
  }
  catch
  {
        MessageBox.Show("Failed to Set GML Version to 3.1.1 - Reverting to
 GML 2.1.2");
        xmlFlags.GmlVersion = OSGeo.FDO.Xml.GmlVersion.GmlVersion_212;
  }
  #endif

  // create writer with flags, then serialize
  String szTemp = System.IO.Path.GetTempFileName();
  OSGeo_FDO.Common.Xml.XmlWriter xmlWriter = new
 OSGeo.FDO.Common.Xml.XmlWriter(szTemp, true,
 OSGeo.FDO.Common.Xml.XmlWriter.LineFormat.LineFormat_Indent);
  OSGeo_FDO.Xml.XmlFeatureWriter xmlFtWriter = new
 OSGeo.FDO.Xml.XmlFeatureWriter(xmlWriter, xmlFlags);

  OSGeo_FDO.Xml.XmlFeatureSerializer.XmlSerialize(readFeature,
 xmlFtWriter);

 }}}



 FAILING (DOES NOT SET GML311) EXAMPLE



 {{{
  String szTemp = System.IO.Path.GetTempFileName();
  OSGeo_FDO.Common.Xml.XmlWriter xmlWriter = new
 OSGeo.FDO.Common.Xml.XmlWriter(szTemp, true,
 OSGeo.FDO.Common.Xml.XmlWriter.LineFormat.LineFormat_Indent);
  OSGeo_FDO.Xml.XmlFeatureWriter xmlFtWriter = new
 OSGeo.FDO.Xml.XmlFeatureWriter(xmlWriter);

  OSGeo_FDO.Xml.XmlFeatureFlags xmlFlags = new
 OSGeo.FDO.Xml.XmlFeatureFlags();
  xmlFlags.DefaultNamespace = "1Spatial";

  // set options for GML format
  #if FDO36
  try
  {
        if (radioGML311.Checked)
                xmlFlags.GmlVersion =
 OSGeo.FDO.Xml.GmlVersion.GmlVersion_311;
  }
  catch
  {
        MessageBox.Show("Failed to Set GML Version to 3.1.1 - Reverting to
 GML 2.1.2");
        xmlFlags.GmlVersion = OSGeo.FDO.Xml.GmlVersion.GmlVersion_212;
  }
  #endif

  // despite serialising with xmlFlags they are *NOT* applied
  OSGeo_FDO.Xml.XmlFeatureSerializer.XmlSerialize(readFeature, xmlFtWriter,
 xmlFlags);

 }}}

-- 
Ticket URL: <http://trac.osgeo.org/fdo/ticket/738>
FDO <http://fdo.osgeo.org/>
Feature Data Objects


More information about the fdo-trac mailing list