Skip to content

Commit 0a8dc92

Browse files
committed
Drop XMLEncoder.
1 parent dfa89ef commit 0a8dc92

File tree

7 files changed

+3
-387
lines changed

7 files changed

+3
-387
lines changed

README.md

Lines changed: 3 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ This guide introduces the HTTP-RPC framework and provides an overview of its key
1919
* [API Documentation](#api-documentation)
2020
* [JSONEncoder and JSONDecoder](#jsonencoder-and-jsondecoder)
2121
* [CSVEncoder and CSVDecoder](#csvencoder-and-csvdecoder)
22-
* [XMLEncoder](#xmlencoder)
2322
* [TemplateEncoder](#templateencoder)
2423
* [BeanAdapter](#beanadapter)
2524
* [ResultSetAdapter and Parameters](#resultsetadapter-and-parameters)
@@ -33,7 +32,7 @@ The complete HTTP-RPC framework can be downloaded as a single JAR file [here](ht
3332
Alternatively, dependencies can be specified individually:
3433

3534
* [org.httprpc:httprpc-client](http://repo1.maven.org/maven2/org/httprpc/httprpc-client/) - provides support for consuming web services and working with JSON/CSV and relational databases
36-
* [org.httprpc:httprpc-server](http://repo1.maven.org/maven2/org/httprpc/httprpc-server/) - depends on client; provides support for implementing web services and working with XML and template documents
35+
* [org.httprpc:httprpc-server](http://repo1.maven.org/maven2/org/httprpc/httprpc-server/) - depends on client; provides support for implementing web services and working with template documents
3736

3837
HTTP-RPC requires Java 8 or later and a servlet container supporting Java Servlet specification 3.1 or later.
3938

@@ -54,7 +53,6 @@ The HTTP-RPC framework includes the following classes:
5453
* `JSONDecoder` - decodes an object hierarchy from JSON
5554
* `JSONEncoder` - an object hierarchy to JSON
5655
* `TemplateEncoder` - encodes an object hierarchy using a template document
57-
* `XMLEncoder` - encodes an object hierarchy to XML
5856
* `org.httprpc.beans`
5957
* `BeanAdapter` - presents the properties of a Java bean object as a map and vice versa
6058
* `Ignore` - indicates that a bean property should be ignored
@@ -452,99 +450,6 @@ JSONEncoder jsonEncoder = new JSONEncoder();
452450
jsonEncoder.write(months, System.out);
453451
```
454452

455-
## XMLEncoder
456-
The `XMLEncoder` class can be used to serialize an object hierarchy as XML (for example, to prepare it for further transformation via [XSLT](https://www.w3.org/TR/xslt/all/)).
457-
458-
The root object provided to the encoder is an iterable sequence of map values. For example:
459-
460-
```java
461-
List<Map<String, ?>> values = ...;
462-
463-
XMLEncoder xmlEncoder = new XMLEncoder();
464-
465-
xmlEncoder.write(values, writer);
466-
```
467-
468-
Sequences are serialized as shown below. Each `<item>` element corresponds to a map value produced by the sequence's iterator:
469-
470-
```xml
471-
<?xml version="1.0" encoding="UTF-8"?>
472-
473-
<root>
474-
<item/>
475-
<item/>
476-
<item/>
477-
...
478-
</root>
479-
```
480-
481-
Map values are generally encoded as XML attributes. For example, given this map:
482-
483-
```json
484-
{
485-
"a": 1,
486-
"b": 2,
487-
"c": 3
488-
}
489-
```
490-
491-
the resulting XML would be as follows:
492-
493-
```xml
494-
<item a="1" b="2" c="3"/>
495-
```
496-
497-
Nested maps are encoded as sub-elements. For example, given this map:
498-
499-
```json
500-
{
501-
"d": {
502-
"e": 4,
503-
"f": 5
504-
}
505-
}
506-
```
507-
508-
the XML output would be as follows:
509-
510-
```xml
511-
<item>
512-
<d e="4" f="5"/>
513-
</item>
514-
```
515-
516-
Nested sequences are also supported. For example, this JSON:
517-
518-
```json
519-
{
520-
"g": [
521-
{
522-
"h": 6
523-
},
524-
{
525-
"h": 7
526-
},
527-
{
528-
"h": 8
529-
}
530-
]
531-
}
532-
```
533-
534-
would produce the following output:
535-
536-
```xml
537-
<item>
538-
<g>
539-
<item h="6"/>
540-
<item h="7"/>
541-
<item h="8"/>
542-
</g>
543-
</item>
544-
```
545-
546-
Enums are encoded using their ordinal values. Instances of `java.util.Date` are encoded as a long value representing epoch time. All other values are encoded via `toString()`. Unsupported (i.e. non-map) sequence elements are ignored.
547-
548453
## TemplateEncoder
549454
The `TemplateEncoder` class transforms an object hierarchy into an output format using a [template document](template-reference.md). It provides the following constructors:
550455

@@ -634,7 +539,7 @@ templateEncoder.getModifiers().put("uppercase", (value, argument, locale, timeZo
634539
Note that modifiers must be thread-safe, since they are shared and may be invoked concurrently by multiple encoder instances.
635540

636541
## BeanAdapter
637-
The `BeanAdapter` class implements the `Map` interface and exposes any properties defined by a bean as entries in the map, allowing custom data structures to be easily serialized to JSON, CSV, or XML.
542+
The `BeanAdapter` class implements the `Map` interface and exposes any properties defined by a bean as entries in the map, allowing custom data structures to be easily serialized.
638543

639544
If a property value is `null` or an instance of one of the following types, it is returned as is:
640545

@@ -800,7 +705,7 @@ root.getChildren().get(0).getChildren().get(0).getName(); // "January"
800705
```
801706

802707
## ResultSetAdapter and Parameters
803-
The `ResultSetAdapter` class implements the `Iterable` interface and makes each row in a JDBC result set appear as an instance of `Map`, allowing query results to be efficiently serialized as JSON, CSV, or XML, or to any other format via a template. `ResultSetAdapter` also implements `AutoCloseable` and ensures that the underlying result set is closed when the adapter itself is closed.
708+
The `ResultSetAdapter` class implements the `Iterable` interface and makes each row in a JDBC result set appear as an instance of `Map`, allowing query results to be efficiently serialized. `ResultSetAdapter` also implements `AutoCloseable` and ensures that the underlying result set is closed when the adapter itself is closed.
804709

805710
For example:
806711

httprpc-server/src/main/java/org/httprpc/io/XMLEncoder.java

Lines changed: 0 additions & 124 deletions
This file was deleted.

0 commit comments

Comments
 (0)