simplexml


SimpleXML Sigle Depth Element with Attribute in Inline List


I want to parse the following XML
<entry key="9" type="9">
<value>
<amount stake="10">50000000</amount>
<amount stake="1">5000000</amount>
<winner>0.0</winner>
<description>9 Correct Numbers</description>
</value>
</entry>
I try to achieve this with the follow classes:
#Root(name="entry")
public class OddsEntryXMLObject {
#Attribute(name="key")
private String iKey;
#Attribute(name="jackpot", required=false)
private String iJackpot;
#Attribute(name="type", required=false)
private String iType;
#Element(name="value")
private OddsValueXMLObject iOddsValueXMLObject;
}
public class OddsAmountXMLObject {
#Element(name="amount")
private String iAmount;
#Attribute(name="stake", required=false)
private String iStake;
}
However I get the following exception:
java.lang.RuntimeException: org.simpleframework.xml.core.ValueRequiredException: Unable to satisfy #org.simpleframework.xml.Element(data=false, name=amount, required=true, type=void) on field 'iAmount' private java.lang.String OddsAmountXMLObject.iAmount for class OddsAmountXMLObject at line 1
Anyone know how to parse this?

Related Links

SimpleXml tar.gz
simplexml_load_file error in PHP 5.3
simplexml_load_file not a valid URI issue
Can't turn XML response into an simplexml object
Having trouble getting Fogbugz API response into a SimpleXML object
Upgraded to php 5.3.10 and simpleXMLelement is broken
Parsing RSS Feed with SimpleXML
php simplexml_load_file (script url) failed to open stream
PHP - SimpleXML not returning object
Having trouble processing XML with PHP SimpleXML
Simplexml How to access all element of the same node
simplexml_load_file failed to open stream Http request failed
Using XML node names with hyphens in PHP [duplicate]
SimpleXML Reading node with a hyphenated name
PHP simplexml Entities
PHP simplexml_load_string include form field data

Categories

HOME
java
sendgrid
date
cloud
gerrit
mfc
homebrew
layout
relative-path
iterator
tesseract
jpeg
node-notifier
esper
applepay
metatrader4
google-cloud-spanner
hapi
ghc
after-effects
ef-migrations
code-review
dbext
kryo
visjs
ml
autoconf
intentfilter
tar
jndi
smb
dynamic-featured-image
fgetcsv
social-media
vision
subdomains
bpel
react-chartjs
directx-10
siesta-swift
repo
serve
withings
ws-security
powershell-dsc
janrain
nand2tetris
eigenvalue
estimote
outlook-api
hibernate-tools
atomicity
qsslsocket
dds
rails-routing
gabor-filter
statsd
nsarray
sybase-asa
akka-cluster
pillow
jspdf-autotable
smart-table
wdf
httplistener
bonobo
database-optimization
phishing
mongocsharpdriver
angstrom-linux
sigabrt
testng-dataprovider
make-install
sdf
xpath-1.0
cloudbees
ford-fulkerson
iad
ora-00900
content-length
tarjans-algorithm
npapi
website-monitoring
qpainter
gulp-less
elliptic-curve
comexception
web2py-modules
dotnetnuke-5
excel-2003
hungarian-algorithm
distutils
jquery-knob
multipage
external-accessory
mod-auth
psi
locationlistener
netbeans-7.1
sql-server-profiler
lang
w3wp.exe
gin
mediarss

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App