simple-framework

Should I consider the Simple XML Framework for Java?

不想你离开。 提交于 2019-12-04 03:50:39
Lately the Simple XML Framework gained popularity and some sites are presenting it. I am thinking about replacing Apache Xerces-J with a new framework and I am considering Simple to be its successor. Do you have any experiences with Simple ? What are its advantages and disadvantages? Is it recommended for the use with enterprise software/within a servlet container or application server? bdoughan JAXB is the enterprise standard for converting objects to/from XML. There are many implementations: Metro (the reference implementation included in Java SE 6), EclipseLink MOXy (I'm the tech lead),

XML With SimpleXML Library - Performance on Android

你。 提交于 2019-12-04 00:28:52
I'm using the Simple XML library to process XML files in my Android application. These file can get quite big - around 1Mb, and can be nested pretty deeply, so they are fairly complex. When the app loads one of these files, via the Simple API, it can take up to 30sec to complete. Currently I am passing a FileInputStream into the [read(Class, InputStream)][2] method of Simple's Persister class. Effectively it just reads the XML nodes and maps the data to instances of my model objects, replicating the XML tree structure in memory. My question then is how do I improve the performance on Android?

How can I configure Simple Framework to require SSL client authentication?

两盒软妹~` 提交于 2019-12-03 17:16:05
I am writing an HTTP server using the Simple Framework and would like to require clients to present a valid certificate signed by my certificate authority in order to establish a connection. I have the following bare-bones server written. How can I modify this code to require client certificate authentication for all SSL connections? public static void main(String[] args) throws Exception { Container container = createContainer(); Server server = new ContainerServer(container); Connection connection = new SocketConnection(server); SocketAddress address = new InetSocketAddress(8443);

How to serialize a null string as a single empty tag?

烂漫一生 提交于 2019-12-03 14:06:00
I serialize this class using the Simple XML framework: @Root public class HowToRenderEmptyTag { @Element(required=false) private String nullString; } I want to get: <howToRenderNull> <nullString/> </howToRenderNull> But I get: <howToRenderNull/> I have tried assigning an empty string: @Root public class HowToRenderEmptyTag { @Element(required=false) private String emptyString = ""; } But then I get one opening and one closing tag: <howToRenderNull> <emptyString></emptyString> </howToRenderNull> This is not sadly accepted correctly by the client consuming the XML and changing the client is out

Deserializing an XML tag with text AND subtags using Retrofit

我只是一个虾纸丫 提交于 2019-12-03 08:46:58
I'm using Retrofit and SimpleXML in order to parse an XML response from some public API. I've been doing pretty well with all content, till I stumbled upon XML tags that contain both free-text AND sub-tags - as illustrated by the following example: <a> Some free-style text <b>Even more text!</b> </a> In an attempt to deserialize using Simple-XML annotations, I've gone two ways. Keep in mind that basically the 'a's are a list of entry tags: The first: @ElementList(entry = "a", inline = true, required = false) List<A> aList; Having 'A' defined like so: public static class A { @Text(required =

Very easy to solve issue with SimpleXML. What i'm doing wrong?

拟墨画扇 提交于 2019-12-03 00:20:07
i'm working with Java and SimpleXML I need to parse this XML file with SimpleXML: <magazine title="N˙mero 1" id="1"> <description>yutyutyu</description> <miniature>http://web.com/scripts/getImage.php?idMagazine=1&resource=miniature.jpg</miniature> <summary>2</summary> <pages> <page src="http://web.com/scripts/getImage.php?idMagazine=1&resource=page_001.jpg" id="1" thumbnail="http://web.com/scripts/getImage.php?idMagazine=1&resource=thumbnail_001.jpg"> <areas> <area id="1"> <top>188</top> <left>204</left> <width>399</width> <height>319</height> <action type="openBrowser">http://www.web.com<

Simpleframework. Can nulls be retained in collections?

狂风中的少年 提交于 2019-12-02 05:33:09
问题 I have a object -> XML -> object process in one project I have to support. The object is containing List and if it gets serialized, all the null values which where present in list are omitted. My question is, can it be done with Simpleframework or should I use something else? What? Here is what I do: import java.io.StringWriter; import java.util.Arrays; import java.util.List; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.ElementList; import org.simpleframework.xml

Empty entry in ElementList SimpleXML

喜欢而已 提交于 2019-12-01 22:40:29
my question is simple, but I can't find nothing about it. I Have a list class and an entry class for XML Serialization: @Root(name = "entries") public class List { @ElementList(required = false, entry = "entry", inline = true, empty = true) private List<Entry> entries; } @Root public class Entry { @Element(name = "entry_id", required = true) private long id; @Element(name = "text", required = true) private String Text; } I'm trying to parse this XML, which don't have any entries in the list: <entries> <entry /> <entries> The follow error is returned: W/System.err(3335): org.simpleframework.xml

Deserialization of xml with simplexml in java

僤鯓⒐⒋嵵緔 提交于 2019-12-01 19:29:15
I'm trying to deserialize an xml string with SimpleXML, i've looked at their examples but i'm not really sure that wether i grasp the concept or not. Sample XML (validates): <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <Response xmlns="http://localhost/webservices/"> <Result> <Item><ID>0</ID><language /><price>168</price></Item> <Item><ID>1</ID><language /><price>178</price></Item> <Item><ID>2</ID><language /><price>195<

How to serialize a Map<String, String> using Simple XML?

对着背影说爱祢 提交于 2019-12-01 18:58:43
How would you go about serialising a Map using simple XML so that it looks something like: <elem foo="value">key</elem> Instead of the normal <elem foo="key">value</elem> (The map is one to many, and since this will be edited by humans, I wanted it to be clearer.) [EDIT]: Doesn't Fix. Have you tried something like: @ElementMap(entry="property", value="value", attribute=true, inline=true) private Map<String, String> map; or some combination, i.e. to use the other attributes of the @ElementMap annotation too? 来源: https://stackoverflow.com/questions/3353500/how-to-serialize-a-mapstring-string