org.geotools.styling
Class SLDParser

java.lang.Object
  extended byorg.geotools.styling.SLDParser

public class SLDParser
extends java.lang.Object

TODO: This really needs to be container ready

Author:
jgarnett

Field Summary
protected  StyleFactory factory
           
protected  org.xml.sax.InputSource source
           
 
Constructor Summary
SLDParser(StyleFactory factory)
          Create a Stylereader - use if you already have a dom to parse.
SLDParser(StyleFactory factory, java.io.File f)
          Creates a new SLDStyle object.
SLDParser(StyleFactory factory, java.io.InputStream s)
          Creates a new SLDStyle object.
SLDParser(StyleFactory factory, java.io.Reader r)
          Creates a new SLDStyle object.
SLDParser(StyleFactory factory, java.lang.String filename)
          Creates a new instance of SLDStyler
SLDParser(StyleFactory factory, java.net.URL url)
          Creates a new SLDStyle object.
 
Method Summary
 StyledLayerDescriptor parseDescriptor(org.w3c.dom.Node root)
           
 NamedStyle parseNamedStyle(org.w3c.dom.Node n)
          Parses a NamedStyle from node.
 StyledLayerDescriptor parseSLD()
           
 Style parseStyle(org.w3c.dom.Node n)
          build a style for the Node provided
 Style[] readDOM(org.w3c.dom.Document document)
          Read the DOM provided and create a Style object for each user style found
 Style[] readXML()
          Read the xml inputsource provided and create a Style object for each user style found
 void setInput(java.io.File f)
          Sets the file to use to read the SLD from
 void setInput(java.io.InputStream in)
          Sets the input stream to read the SLD from
 void setInput(java.io.Reader in)
          Sets the input stream to read the SLD from
 void setInput(java.lang.String filename)
          set the file to read the SLD from
 void setInput(java.net.URL url)
          sets an URL to read the SLD from
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

protected org.xml.sax.InputSource source

factory

protected StyleFactory factory
Constructor Detail

SLDParser

public SLDParser(StyleFactory factory)
Create a Stylereader - use if you already have a dom to parse.

Parameters:
factory - The StyleFactory to use to build the style

SLDParser

public SLDParser(StyleFactory factory,
                 java.lang.String filename)
          throws java.io.FileNotFoundException
Creates a new instance of SLDStyler

Parameters:
factory - The StyleFactory to use to read the file
filename - The file to be read.
Throws:
java.io.FileNotFoundException - - if the file is missing

SLDParser

public SLDParser(StyleFactory factory,
                 java.io.File f)
          throws java.io.FileNotFoundException
Creates a new SLDStyle object.

Parameters:
factory - The StyleFactory to use to read the file
f - the File to be read
Throws:
java.io.FileNotFoundException - - if the file is missing

SLDParser

public SLDParser(StyleFactory factory,
                 java.net.URL url)
          throws java.io.IOException
Creates a new SLDStyle object.

Parameters:
factory - The StyleFactory to use to read the file
url - the URL to be read.
Throws:
java.io.IOException - - if something goes wrong reading the file

SLDParser

public SLDParser(StyleFactory factory,
                 java.io.InputStream s)
Creates a new SLDStyle object.

Parameters:
factory - The StyleFactory to use to read the file
s - The inputstream to be read

SLDParser

public SLDParser(StyleFactory factory,
                 java.io.Reader r)
Creates a new SLDStyle object.

Parameters:
factory - The StyleFactory to use to read the file
Method Detail

setInput

public void setInput(java.lang.String filename)
              throws java.io.FileNotFoundException
set the file to read the SLD from

Parameters:
filename - the file to read the SLD from
Throws:
java.io.FileNotFoundException - if the file is missing

setInput

public void setInput(java.io.File f)
              throws java.io.FileNotFoundException
Sets the file to use to read the SLD from

Parameters:
f - the file to use
Throws:
java.io.FileNotFoundException - if the file is missing

setInput

public void setInput(java.net.URL url)
              throws java.io.IOException
sets an URL to read the SLD from

Parameters:
url - the url to read the SLD from
Throws:
java.io.IOException - If anything goes wrong opening the url

setInput

public void setInput(java.io.InputStream in)
Sets the input stream to read the SLD from

Parameters:
in - the inputstream used to read the SLD from

setInput

public void setInput(java.io.Reader in)
Sets the input stream to read the SLD from

Parameters:
in - the inputstream used to read the SLD from

readXML

public Style[] readXML()
Read the xml inputsource provided and create a Style object for each user style found

Returns:
Style[] the styles constructed.
Throws:
java.lang.RuntimeException - if a parsing error occurs

readDOM

public Style[] readDOM(org.w3c.dom.Document document)
Read the DOM provided and create a Style object for each user style found

Parameters:
document - a dom containing the SLD
Returns:
Style[] the styles constructed.

parseSLD

public StyledLayerDescriptor parseSLD()

parseDescriptor

public StyledLayerDescriptor parseDescriptor(org.w3c.dom.Node root)

parseNamedStyle

public NamedStyle parseNamedStyle(org.w3c.dom.Node n)
Parses a NamedStyle from node.

A NamedStyle is used to refer to a style that has a name in a WMS, and is defined as:


 
  
    A NamedStyle is used to refer to a style that has a name in a WMS. 
  
  
   
    
   
  
 
 

Parameters:
n -
Returns:

parseStyle

public Style parseStyle(org.w3c.dom.Node n)
build a style for the Node provided

Parameters:
n - the node which contains the style to be parsed.
Returns:
the Style constructed.
Throws:
java.lang.RuntimeException - if an error occurs setting up the parser


Copyright © GeoTools. All Rights Reserved.