Java Doc for Encoder.java in  » GIS » GeoTools-2.4.1 » org » geotools » xml » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » GeoTools 2.4.1 » org.geotools.xml 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.geotools.xml.Encoder

Encoder
public class Encoder (Code)
Encodes objects as xml based on a schema.

The function of the encoder is to traverse a tree of objects seializing them out as xml as it goes. Navigation and serialization of the tree is performed by instances of org.geotools.xml.Binding which are bound to types in the schema.


To execute the encoder, one must have 3 bits of information:

  1. The root object in the tree to be encoded
  2. The schema / configuration of the intsance document being encoded.
  3. A name of the element defined in the schema which corresponds to the root object in the tree.


As an exmaple, consider the encoding of a org.opengis.filter.Filter instance.

 
 //instantiate hte configuration for the filter schmea
 Configuration configuration = new OGCConfiguration();
 //create the encoder
 Encoder encoder = new Encoder( configuration );
 //get a filter
 Filter filter = ...;
 //get the name of the 'filter' element in the schema
 QName name = new QName( "http://www.opengis.net/ogc", "Filter" );
 //encode
 encoder.encode( filter, name ); 
 
 


author:
   Justin Deoliveira, The Open Planning Project



Constructor Summary
public  Encoder(Configuration configuration)
     Creates an encoder from a configuration.
public  Encoder(Configuration configuration, XSDSchema schema)
     Creates an encoder from a configuration and a specific schema instance.

Method Summary
public  voidencode(Object object, QName name, OutputStream out)
     Encodes an object.

An object is encoded as an object, name pair, where the name is the name of an element declaration in a schema.

public  voidencode(Object object, QName name, ContentHandler handler)
     Encodes an object.

An object is encoded as an object, name pair, where the name is the name of an element declaration in a schema.

protected  Nodeencode(Object object, XSDNamedComponent component)
    
protected  voidend(Element element)
    
public  BindingWalkergetBindingWalker()
    
public  XSDSchemagetSchema()
    
public  SchemaIndexgetSchemaIndex()
    
public  voidsetEncodeFullDocument(boolean encodeFullDocument)
    
public  voidsetNamespaceAware(boolean namespaceAware)
     Sets wether the encoder should be namespace aware.
public  voidsetOutputFormat(OutputFormat outputFormat)
     Sets hte output format to be used by the encoder.
public  voidsetSchemaLocation(String namespaceURI, String location)
     Sets the schema location for a particular namespace uri.
protected  voidstart(Element element)
    
public  voidwrite(Object object, QName name, OutputStream out)
    


Constructor Detail
Encoder
public Encoder(Configuration configuration)(Code)
Creates an encoder from a configuration.

This constructor calls through to Encoder.Encoder(Configuration,XSDSchema) obtaining the schema instance from Configuration.schema .


Parameters:
  configuration - The encoder configuration.



Encoder
public Encoder(Configuration configuration, XSDSchema schema)(Code)
Creates an encoder from a configuration and a specific schema instance.
Parameters:
  configuration - The encoder configuration.
Parameters:
  schema - The schema instance.




Method Detail
encode
public void encode(Object object, QName name, OutputStream out) throws IOException, SAXException(Code)
Encodes an object.

An object is encoded as an object, name pair, where the name is the name of an element declaration in a schema.


Parameters:
  object - The object being encoded.
Parameters:
  name - The name of the element being encoded in the schema.
Parameters:
  out - The output stream.
throws:
  IOException -
throws:
  SAXException -



encode
public void encode(Object object, QName name, ContentHandler handler) throws IOException, SAXException(Code)
Encodes an object.

An object is encoded as an object, name pair, where the name is the name of an element declaration in a schema.


Parameters:
  object - The object being encoded.
Parameters:
  name - The name of the element being encoded in the schema.
Parameters:
  handler - true if this encode run is trying to encode a full xml document, false if otherwisethe generated xml is part of a bigger xml file
throws:
  IOException -
throws:
  SAXException -



encode
protected Node encode(Object object, XSDNamedComponent component)(Code)



end
protected void end(Element element) throws SAXException(Code)



getBindingWalker
public BindingWalker getBindingWalker()(Code)
The walker used to traverse bindings, this method is for internal use only.



getSchema
public XSDSchema getSchema()(Code)
the schema.



getSchemaIndex
public SchemaIndex getSchemaIndex()(Code)
The index of schema components, this method is for internal use only.



setEncodeFullDocument
public void setEncodeFullDocument(boolean encodeFullDocument)(Code)



setNamespaceAware
public void setNamespaceAware(boolean namespaceAware)(Code)
Sets wether the encoder should be namespace aware.

Warning that setting this to false will result in no namespace prefixes on encoded elements and attributes, and no schema declarations on the root element.document;


Parameters:
  namespaces -



setOutputFormat
public void setOutputFormat(OutputFormat outputFormat)(Code)
Sets hte output format to be used by the encoder.
Parameters:
  outputFormat - The output format.



setSchemaLocation
public void setSchemaLocation(String namespaceURI, String location)(Code)
Sets the schema location for a particular namespace uri.

Registering a schema location will include it on the "schemaLocation" attribute of the root element of the encoding.


Parameters:
  namespaceURI - A namespace uri.
Parameters:
  location - A schema location.



start
protected void start(Element element) throws SAXException(Code)



write
public void write(Object object, QName name, OutputStream out) throws IOException, SAXException(Code)
Encoder.encode(Object,QName,OutputStream)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.