[Geoserver-users] SLD validation -implications if it doesn´t validate? - SLD CODE

The SLD that is causing the problem for me is this...
It is a line with a rhombus on it...funny thing is - it gets rendered!! The
error messages are added on the end. Is this something to do with the order of
the sld elements?

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<sld:StyledLayerDescriptor version="1.0.0"
xmlns:sld="http://www.opengis.net/sld&quot; xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:xlink="http://www.w3.org/1999/xlink&quot;&gt;
  <sld:NamedLayer>
    <sld:Name>AendBereich</sld:Name>
    <sld:UserStyle>
      <sld:Name>Style1</sld:Name>
      <sld:FeatureTypeStyle>
      
        <sld:FeatureTypeName>FNP_Stadt_Peine_08_01_l_Proj</sld:FeatureTypeName>
        
         <!-- durch -->
        
        <sld:Rule>
      <sld:Name>FNP_Stadt_Peine_08_01_l_Proj</sld:Name>
      <sld:Title>FNP_Stadt_Peine_08_01_l_Proj</sld:Title>
      
      <sld:MinScaleDenominator>100</sld:MinScaleDenominator>
      <sld:MaxScaleDenominator>50000</sld:MaxScaleDenominator>
      
      <sld:LineSymbolizer>
          <sld:Stroke>
        <sld:CssParameter name="stroke">#00004A</sld:CssParameter>
        <sld:CssParameter name="stroke-width">1</sld:CssParameter>
        <sld:CssParameter name="stroke-opacity">1</sld:CssParameter>
        
          </sld:Stroke>
      </sld:LineSymbolizer>
        </sld:Rule>
        
        <sld:Rule>
          <sld:Name>FNP_Stadt_Peine_08_01_l_Proj</sld:Name>
          <sld:Title>FNP_Stadt_Peine_08_01_l_Proj</sld:Title>
          
          <sld:MinScaleDenominator>50001</sld:MinScaleDenominator>
          <sld:MaxScaleDenominator>150000</sld:MaxScaleDenominator>
          
          <sld:LineSymbolizer>
          <sld:Stroke>
        <sld:CssParameter name="stroke">#00004A</sld:CssParameter>
        <sld:CssParameter name="stroke-width">0.4</sld:CssParameter>
        <sld:CssParameter name="stroke-opacity">1</sld:CssParameter>
        
          </sld:Stroke>
          </sld:LineSymbolizer>
        </sld:Rule>
        
        <!-- graphic -->
       
       <sld:Rule>
             <sld:Name>FNP_Stadt_Peine_08_01_l_Proj</sld:Name>
             <sld:Title>FNP_Stadt_Peine_08_01_l_Proj</sld:Title>
             
             <sld:MinScaleDenominator>100</sld:MinScaleDenominator>
             <sld:MaxScaleDenominator>20000</sld:MaxScaleDenominator>
             
             <LineSymbolizer>
       <sld:Stroke>
        <sld:GraphicStroke>
         <sld:Graphic>
          <sld:ExternalGraphic>
           <sld:OnlineResource
            xlink:href="symbolik/linegraphic8.svg"/>
           <sld:Format>image/svg</sld:Format>
          </sld:ExternalGraphic>
          <sld:Size>20</sld:Size>
         </sld:Graphic>
        </sld:GraphicStroke>
    
       </sld:Stroke>
      </LineSymbolizer>
        </sld:Rule>
       
       <sld:Rule>
                    <sld:Name>FNP_Stadt_Peine_08_01_l_Proj</sld:Name>
                    <sld:Title>FNP_Stadt_Peine_08_01_l_Proj</sld:Title>
                   
                    <sld:MinScaleDenominator>20000</sld:MinScaleDenominator>
                    <sld:MaxScaleDenominator>50000</sld:MaxScaleDenominator>
                    
                    <LineSymbolizer>
              <sld:Stroke>
               <sld:GraphicStroke>
                <sld:Graphic>
                 <sld:ExternalGraphic>
                  <sld:OnlineResource
                   xlink:href="symbolik/linegraphic8.svg"/>
                  <sld:Format>image/svg</sld:Format>
                 </sld:ExternalGraphic>
                 <sld:Size>10</sld:Size>
                </sld:Graphic>
               </sld:GraphicStroke>
         
              </sld:Stroke>
             </LineSymbolizer>
        </sld:Rule>
       
        <sld:Rule>
              <sld:Name>FNP_Stadt_Peine_08_01_l_Proj</sld:Name>
              <sld:Title>FNP_Stadt_Peine_08_01_l_Proj</sld:Title>
             
              <sld:MinScaleDenominator>50001</sld:MinScaleDenominator>
              <sld:MaxScaleDenominator>150000</sld:MaxScaleDenominator>
              
              <sld:LineSymbolizer>
                 <sld:Stroke>
                  <sld:GraphicStroke>
                   <sld:Graphic>
                    <sld:ExternalGraphic>
                     <sld:OnlineResource
                      xlink:href="symbolik/linegraphic7.svg"/>
                     <sld:Format>image/svg</sld:Format>
                    </sld:ExternalGraphic>
                    <sld:Size>20</sld:Size>
                   </sld:Graphic>
                  </sld:GraphicStroke>
          
                 </sld:Stroke>
      </sld:LineSymbolizer>
        </sld:Rule>
       
      </sld:FeatureTypeStyle>
    </sld:UserStyle>
  </sld:NamedLayer>
</sld:StyledLayerDescriptor>

ERROR MESSAGES

  * org.xml.sax.SAXParseException: TargetNamespace.2: Expecting no namespace,
but the schema document has a target namespace of 'http://www.opengis.net/sld’.

  * org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was
found starting with element 'LineSymbolizer'. One of
'{"http://www.opengis.net/sld&quot;:Symbolizer\}' is expected.

  * org.xml.sax.SAXParseException: TargetNamespace.2: Expecting no namespace,
but the schema document has a target namespace of 'http://www.opengis.net/sld’.

  * org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was
found starting with element 'LineSymbolizer'. One of
'{"http://www.opengis.net/sld&quot;:Symbolizer\}' is expected.

On Thu, Jul 22, 2010 at 3:24 AM, Robert Buckley
<robertdbuckley@anonymised.com> wrote:

The SLD that is causing the problem for me is this...
It is a line with a rhombus on it...funny thing is - it gets rendered!! The
error messages are added on the end. Is this something to do with the order of
the sld elements?

You can either have an SLD namespace in which case *all* the (SLD)
elements must have an sld: prefix or you can have a default namespace
for the SLD elements in which case *none* of the (SLD) elements should
have a prefix.

So either start your file with:
<sld:StyledLayerDescriptor version="1.0.0"
xmlns:sld="http://www.opengis.net/sld&quot; ...

   and use sld: for all the elements

or start with:
<sld:StyledLayerDescriptor version="1.0.0"
xmlns="http://www.opengis.net/sld&quot; ...

   and delete all the prefixes.

Your problem is that you are mixing the two styles.

Ian
--
Ian Turton

Robert Buckley wrote:

The SLD that is causing the problem for me is this...
It is a line with a rhombus on it...funny thing is - it gets
rendered!! The error messages are added on the end. Is this something
to do with the order of the sld elements?

If you don't specify a default namespace for the document, you must specify a namespace for each individual element. More to the point, you have a <LineSymbolizer> instead of a <sld:LineSymbolizer>. I would recommend you specify a default namespace so that you can clean up your document a bit; try the following StyledLayerDescriptor element and remove the "sld:" namespace from all your elements. You will still need to specify the ogc namespace to Filters and the like, if you end up using them.

<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld&quot; xmlns:ogc="http://www.opengis.net/ogc&quot;
  xmlns:xlink="http://www.w3.org/1999/xlink&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd&quot;&gt;

  ...

</StyledLayerDescriptor>

Regards,

Miles

___________________________________________________________________________

    Australian Antarctic Division - Commonwealth of Australia
IMPORTANT: This transmission is intended for the addressee only. If you are not the
intended recipient, you are notified that use or dissemination of this communication is
strictly prohibited by Commonwealth law. If you have received this transmission in error,
please notify the sender immediately by e-mail or by telephoning +61 3 6232 3209 and
DELETE the message.
        Visit our web site at http://www.antarctica.gov.au/
___________________________________________________________________________