我有以下XML
<Messages>
<PopUpMessages>
<Message no=”1” type=”game” name=”DONATION”>
Congratulation You won
</Message>
</PopUpMessages>
我正在使用这个http://code.google.com/p/asaxb/,它用于ActionScript,它具有JAXB的基本功能。
问题是我可以获得PopUpMessages,一切都很好,但我无法获得内容
“祝贺你赢了”,这是在消息内。
定义如下:
package
{
[XmlRootNode(name = 'Message')]
public class Message {
[XmlAttribute(name = "no")]
public var no:Number;
[XmlAttribute(name = "type")]
public var type:String;
[XmlAttribute(name = "imageSource")]
public var imageSource:String;
[XmlAttribute(name = "name")]
public var name:String;
[XmlAttribute(name = "k")]
public var k:String;
}
}
// The class that I unmarsahall
public class GCPResponse {
[XmlElement(name="Messages")]
public var message:Messages;
}
package
{
[XmlRootNode(name = "PopUpMessages")]
public class PopUpMessages {
[XmlElement(name="Message")]
public var message:Message;
}
}
答案 0 :(得分:0)
您需要利用@XmlValue
注释。