转换 XML 中的任何 ActionScript 类
对于我正在编写的程序,我需要将 ActionScript 类编组为稍后由 Java 读取(并再次读取)的格式。 针对这种需求有哪些解决方案?
有没有一种方法(例如通过 XMLEncoder/XMLDecoder 使用 Java 时)使用标准 Flex 库生成 XML(这将与以后使用 XMLDecoder 进行解码兼容)? 或者有没有一个好的现有图书馆?
编辑是的,这个问题与是否有通过 xml 序列化和反序列化将 JavaBeans 映射到 ActionScript 类的工具?,但我会接受正确的答案,如果没有答案,我最终会开始悬赏满足我的需求。 (换句话说,我计划将之前的 - 未回答的 - 问题复制为我的问题)。
编辑2 更准确地说,我的应用程序分为两部分:一个 Flex GUI 和一个 Java 核心。他们通过非http< /strong> 层,需要在 XML。在这种情况下,我在 Flex 中复制了 Java 对象(使用 GAS3),现在希望将其中一些对象从 Flex 发送到 Java 并再次发送回来。 为此,我必须在 XML 中序列化对象(在 Flex 端)并在 Java 中反序列化它们(然后再返回)。
For a program i'm writing I need to marshal ActionScript classes to a format that is later to be read by Java (and back again).
What solutions exists for such a need ?
Is there a way (like when using Java through XMLEncoder/XMLDecoder) to generate that XML using standard flex libraries (that would be compatible with later decoding using XMLDecoder) ?
Or is there a good existing library ?
EDIT Yes, this question is a duplicate of Are there any tool mapping of JavaBeans to ActionScript Class through xml serialization and deserialization?, but I will accept correct answers and eventually start a bounty if no answer satisfies my needs. (in other words, i plan to make the previous - unanswered - question a duplicate of mine).
EDIT 2 To be even more precise, I have an application divided in two parts : one Flex GUI and one Java core. They communicate over a non http layer which requires data to be sent in XML. In this context, I replicated my Java objects in Flex (using GAS3) and now want some of these objects to be sent from Flex to Java and back again.
For that purpose, I have to serialize objects (on the Flex end) in XML and deserialize them in Java (and all that back again).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我们使用 http://www.spicefactory.org/parsley/index.php支持 XML 到对象的来回转换。他们的文档非常不错: http://www.spicefactory.org/parsley/docs/ 2.4/手册/。
We are using http://www.spicefactory.org/parsley/index.php which supports XML-to-object conversions back-and-forth. Their documentation is very decent: http://www.spicefactory.org/parsley/docs/2.4/manual/.
请参阅describeType 如果您确实需要 XML,请使用该函数。但我强烈建议您也考虑其他序列化格式。
你可以看看JSON。 ActionScript 序列化/反序列化所需的类是 as3corelib 库的一部分。
您可能还想查看 BlazeDS。
See describeType function if you really want XML. But I seriously recommend considering the other serializations formats too.
You can look into JSON. The classes needed for the actionscript serialization/deserialization are part of the as3corelib library.
You might also want to take a look at BlazeDS.
使用的解决方案是将 XStream 放在 java 端,并将 FleXMLer (可以在那里找到一些修改:https://github.com/Riduidel/FleXMLer)在 Flex 端。它工作得很好(一旦 FleXMLer 适应 XStream 架构)。
Solution used was to put XStream on the java side and FleXMLer (with some adaptations that can be found there : https://github.com/Riduidel/FleXMLer) on the Flex side. it works quite good (once FleXMLer is adapted to XStream architecture).