Simple xml returns null value for attribute fieldDeserializing empty xml attribute value into nullable int property using XmlSerializerWrong ordering in generated table in jpaBest way of invoking getter by reflectionHow to deserialize a list using GSON or another JSON library in Java?Create the perfect JPA entityHow to tell Jackson to ignore a field during serialization if its value is null?How does the Simple XML library actually create and populate objects?Get private field values using Reflection API javaSimple XML: ValueRequiredExceptionFinding all private fields and their corresponding getters / setters for nested classes
Why do players in the past play much longer tournaments than today's top players?
Professor falsely accusing me of cheating in a class he does not teach, two months after end of the class. What precautions should I take?
How does a Potion of Poison work?
What is the best way to stacked subscripts for a matrix?
Is there a word for a message that is intended to be intercepted by an adversary?
How to know whether a Tamron lens is compatible with Canon EOS 60D?
Why isn't there research to build a standard lunar, or Martian mobility platform?
Why isn't pressure filtration popular compared to vacuum filtration?
Why was hardware diversification an asset for the IBM PC ecosystem?
Why does the U.S. tolerate foreign influence from Saudi Arabia and Israel on its domestic policies while not tolerating that from China or Russia?
How might the United Kingdom become a republic?
Why are they 'nude photos'?
Why does the autopilot disengage even when it does not receive pilot input?
Managing and organizing the massively increased number of classes after switching to SOLID?
Cops: The Hidden OEIS Substring
How is angular momentum conserved for the orbiting body if the centripetal force disappears?
Is anyone advocating the promotion of homosexuality in UK schools?
The monorail explodes before I can get on it
Setting MAC field to all-zero to indicate unencrypted data
Are randomly-generated passwords starting with "a" less secure?
Should I intentionally omit previous work experience when applying for jobs?
How can an advanced civilization forget how to manufacture its technology?
Is there any word for "disobedience to God"?
What explains 9 speed cassettes price differences?
Simple xml returns null value for attribute field
Deserializing empty xml attribute value into nullable int property using XmlSerializerWrong ordering in generated table in jpaBest way of invoking getter by reflectionHow to deserialize a list using GSON or another JSON library in Java?Create the perfect JPA entityHow to tell Jackson to ignore a field during serialization if its value is null?How does the Simple XML library actually create and populate objects?Get private field values using Reflection API javaSimple XML: ValueRequiredExceptionFinding all private fields and their corresponding getters / setters for nested classes
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to use Simple XML to deserialize the following XML into a POJO:
<shippingInfo>
<shippingServiceCost currencyId="USD">9.8</shippingServiceCost>
<shippingType>Flat</shippingType>
<shipToLocations>Worldwide</shipToLocations>
<expeditedShipping>true</expeditedShipping>
<oneDayShippingAvailable>false</oneDayShippingAvailable>
<handlingTime>3</handlingTime>
</shippingInfo>
I have created the following class to do so. However, I'm having trouble in that the currencyId attribute isn't being properly deserialized.
@Root(name = "shippingInfo")
public class ShippingInfo
@Element(name = "shippingServiceCost", required = false)
private BigDecimal shippingServiceCost;
@Attribute(name = "currencyId", required = false)
private String currencyId;
@Element(name = "shippingType", required = false)
private String shippingType;
@Element(name = "shipToLocations" ,required = false)
private String shipToLocations;
@Element(name = "expeditedShipping", required = false)
private Boolean expeditedShipping;
@Element(name = "oneDayShippingAvailable", required = false)
private Boolean oneDayShippingAvailable;
@Element(name = "handlingTime", required = false)
private Integer handlingTime;
// Getters & Setters
public BigDecimal getShippingServiceCost()
return shippingServiceCost;
public void setShippingServiceCost(BigDecimal shippingServiceCost)
this.shippingServiceCost = shippingServiceCost;
public String getCurrencyId()
return currencyId;
public void setCurrencyId(String currencyId)
this.currencyId = currencyId;
public String getShippingType()
return shippingType;
public void setShippingType(String shippingType)
this.shippingType = shippingType;
public String getShipToLocations()
return shipToLocations;
public void setShipToLocations(String shipToLocations)
this.shipToLocations = shipToLocations;
public Boolean isExpeditedShipping()
return expeditedShipping;
public void setExpeditedShipping(Boolean bool)
this.expeditedShipping = bool;
public Boolean isOneDayShippingAvailable()
return oneDayShippingAvailable;
public void setOneDayShippingAvailable(Boolean bool)
this.oneDayShippingAvailable = bool;
public Integer getHandlingTime()
return handlingTime;
public void setHandlingTime(Integer days)
this.handlingTime = days;
I would expect the value of currencyId to be "USD" after deserializing, but I'm getting null. All the element values appear to deserialize properly. Does anyone have a suggestion on how to fix this?
Moreover, in a case such as the following instance:
<sellingStatus>
<currentPrice currencyId="USD">125.0</currentPrice>
<convertedCurrentPrice currencyId="USD">125.0</convertedCurrentPrice>
<bidCount>2</bidCount>
<sellingState>EndedWithSales</sellingState>
</sellingStatus>
Where there are two attributes named currencyId on two distinct elements, how can I go about deserializing these into separate fields? I have created a similar SellingStatus class but am unsure how to distinguish between the currencyId attributes.
Thank you!
Edit: Per suggestions I tried adding a custom ShippingServiceCost class to ShippingInfo as follows:
@Element(name = "shippingServiceCost", required = false)
private ShippingServiceCost shippingServiceCost;
Which in turn looks like this:
public class ShippingServiceCost
@Element(name = "shippingServiceCost", required = false)
private BigDecimal shippingServiceCost;
@Attribute(name = "currencyId", required = false)
private String currencyId;
// getters and setters
But when I try to access both the shippingServiceCost field and the currencyId field, I get null in every instance (even though I know there is data). Any suggestions are greatly appreciated.
java xml simple-framework
add a comment |
I want to use Simple XML to deserialize the following XML into a POJO:
<shippingInfo>
<shippingServiceCost currencyId="USD">9.8</shippingServiceCost>
<shippingType>Flat</shippingType>
<shipToLocations>Worldwide</shipToLocations>
<expeditedShipping>true</expeditedShipping>
<oneDayShippingAvailable>false</oneDayShippingAvailable>
<handlingTime>3</handlingTime>
</shippingInfo>
I have created the following class to do so. However, I'm having trouble in that the currencyId attribute isn't being properly deserialized.
@Root(name = "shippingInfo")
public class ShippingInfo
@Element(name = "shippingServiceCost", required = false)
private BigDecimal shippingServiceCost;
@Attribute(name = "currencyId", required = false)
private String currencyId;
@Element(name = "shippingType", required = false)
private String shippingType;
@Element(name = "shipToLocations" ,required = false)
private String shipToLocations;
@Element(name = "expeditedShipping", required = false)
private Boolean expeditedShipping;
@Element(name = "oneDayShippingAvailable", required = false)
private Boolean oneDayShippingAvailable;
@Element(name = "handlingTime", required = false)
private Integer handlingTime;
// Getters & Setters
public BigDecimal getShippingServiceCost()
return shippingServiceCost;
public void setShippingServiceCost(BigDecimal shippingServiceCost)
this.shippingServiceCost = shippingServiceCost;
public String getCurrencyId()
return currencyId;
public void setCurrencyId(String currencyId)
this.currencyId = currencyId;
public String getShippingType()
return shippingType;
public void setShippingType(String shippingType)
this.shippingType = shippingType;
public String getShipToLocations()
return shipToLocations;
public void setShipToLocations(String shipToLocations)
this.shipToLocations = shipToLocations;
public Boolean isExpeditedShipping()
return expeditedShipping;
public void setExpeditedShipping(Boolean bool)
this.expeditedShipping = bool;
public Boolean isOneDayShippingAvailable()
return oneDayShippingAvailable;
public void setOneDayShippingAvailable(Boolean bool)
this.oneDayShippingAvailable = bool;
public Integer getHandlingTime()
return handlingTime;
public void setHandlingTime(Integer days)
this.handlingTime = days;
I would expect the value of currencyId to be "USD" after deserializing, but I'm getting null. All the element values appear to deserialize properly. Does anyone have a suggestion on how to fix this?
Moreover, in a case such as the following instance:
<sellingStatus>
<currentPrice currencyId="USD">125.0</currentPrice>
<convertedCurrentPrice currencyId="USD">125.0</convertedCurrentPrice>
<bidCount>2</bidCount>
<sellingState>EndedWithSales</sellingState>
</sellingStatus>
Where there are two attributes named currencyId on two distinct elements, how can I go about deserializing these into separate fields? I have created a similar SellingStatus class but am unsure how to distinguish between the currencyId attributes.
Thank you!
Edit: Per suggestions I tried adding a custom ShippingServiceCost class to ShippingInfo as follows:
@Element(name = "shippingServiceCost", required = false)
private ShippingServiceCost shippingServiceCost;
Which in turn looks like this:
public class ShippingServiceCost
@Element(name = "shippingServiceCost", required = false)
private BigDecimal shippingServiceCost;
@Attribute(name = "currencyId", required = false)
private String currencyId;
// getters and setters
But when I try to access both the shippingServiceCost field and the currencyId field, I get null in every instance (even though I know there is data). Any suggestions are greatly appreciated.
java xml simple-framework
Remove the currencyID attribute from the shipping info class. Create a separate class for shipping service cost and add the currencyID attribute there. Then link the shipping service cost class in the shipping info class.
– venkat
Mar 26 at 4:16
See my edit above, I tried this but I am still getting null for both shippingServiceCost and currencyId.
– opnightfall1771
Mar 26 at 23:49
Can you annotate your shippingServiceCost class with the following "@XmlAccessorType(XmlAccessType.FIELD)"
– venkat
Mar 27 at 5:02
I tried this, but still getting null values.
– opnightfall1771
Mar 27 at 15:23
add a comment |
I want to use Simple XML to deserialize the following XML into a POJO:
<shippingInfo>
<shippingServiceCost currencyId="USD">9.8</shippingServiceCost>
<shippingType>Flat</shippingType>
<shipToLocations>Worldwide</shipToLocations>
<expeditedShipping>true</expeditedShipping>
<oneDayShippingAvailable>false</oneDayShippingAvailable>
<handlingTime>3</handlingTime>
</shippingInfo>
I have created the following class to do so. However, I'm having trouble in that the currencyId attribute isn't being properly deserialized.
@Root(name = "shippingInfo")
public class ShippingInfo
@Element(name = "shippingServiceCost", required = false)
private BigDecimal shippingServiceCost;
@Attribute(name = "currencyId", required = false)
private String currencyId;
@Element(name = "shippingType", required = false)
private String shippingType;
@Element(name = "shipToLocations" ,required = false)
private String shipToLocations;
@Element(name = "expeditedShipping", required = false)
private Boolean expeditedShipping;
@Element(name = "oneDayShippingAvailable", required = false)
private Boolean oneDayShippingAvailable;
@Element(name = "handlingTime", required = false)
private Integer handlingTime;
// Getters & Setters
public BigDecimal getShippingServiceCost()
return shippingServiceCost;
public void setShippingServiceCost(BigDecimal shippingServiceCost)
this.shippingServiceCost = shippingServiceCost;
public String getCurrencyId()
return currencyId;
public void setCurrencyId(String currencyId)
this.currencyId = currencyId;
public String getShippingType()
return shippingType;
public void setShippingType(String shippingType)
this.shippingType = shippingType;
public String getShipToLocations()
return shipToLocations;
public void setShipToLocations(String shipToLocations)
this.shipToLocations = shipToLocations;
public Boolean isExpeditedShipping()
return expeditedShipping;
public void setExpeditedShipping(Boolean bool)
this.expeditedShipping = bool;
public Boolean isOneDayShippingAvailable()
return oneDayShippingAvailable;
public void setOneDayShippingAvailable(Boolean bool)
this.oneDayShippingAvailable = bool;
public Integer getHandlingTime()
return handlingTime;
public void setHandlingTime(Integer days)
this.handlingTime = days;
I would expect the value of currencyId to be "USD" after deserializing, but I'm getting null. All the element values appear to deserialize properly. Does anyone have a suggestion on how to fix this?
Moreover, in a case such as the following instance:
<sellingStatus>
<currentPrice currencyId="USD">125.0</currentPrice>
<convertedCurrentPrice currencyId="USD">125.0</convertedCurrentPrice>
<bidCount>2</bidCount>
<sellingState>EndedWithSales</sellingState>
</sellingStatus>
Where there are two attributes named currencyId on two distinct elements, how can I go about deserializing these into separate fields? I have created a similar SellingStatus class but am unsure how to distinguish between the currencyId attributes.
Thank you!
Edit: Per suggestions I tried adding a custom ShippingServiceCost class to ShippingInfo as follows:
@Element(name = "shippingServiceCost", required = false)
private ShippingServiceCost shippingServiceCost;
Which in turn looks like this:
public class ShippingServiceCost
@Element(name = "shippingServiceCost", required = false)
private BigDecimal shippingServiceCost;
@Attribute(name = "currencyId", required = false)
private String currencyId;
// getters and setters
But when I try to access both the shippingServiceCost field and the currencyId field, I get null in every instance (even though I know there is data). Any suggestions are greatly appreciated.
java xml simple-framework
I want to use Simple XML to deserialize the following XML into a POJO:
<shippingInfo>
<shippingServiceCost currencyId="USD">9.8</shippingServiceCost>
<shippingType>Flat</shippingType>
<shipToLocations>Worldwide</shipToLocations>
<expeditedShipping>true</expeditedShipping>
<oneDayShippingAvailable>false</oneDayShippingAvailable>
<handlingTime>3</handlingTime>
</shippingInfo>
I have created the following class to do so. However, I'm having trouble in that the currencyId attribute isn't being properly deserialized.
@Root(name = "shippingInfo")
public class ShippingInfo
@Element(name = "shippingServiceCost", required = false)
private BigDecimal shippingServiceCost;
@Attribute(name = "currencyId", required = false)
private String currencyId;
@Element(name = "shippingType", required = false)
private String shippingType;
@Element(name = "shipToLocations" ,required = false)
private String shipToLocations;
@Element(name = "expeditedShipping", required = false)
private Boolean expeditedShipping;
@Element(name = "oneDayShippingAvailable", required = false)
private Boolean oneDayShippingAvailable;
@Element(name = "handlingTime", required = false)
private Integer handlingTime;
// Getters & Setters
public BigDecimal getShippingServiceCost()
return shippingServiceCost;
public void setShippingServiceCost(BigDecimal shippingServiceCost)
this.shippingServiceCost = shippingServiceCost;
public String getCurrencyId()
return currencyId;
public void setCurrencyId(String currencyId)
this.currencyId = currencyId;
public String getShippingType()
return shippingType;
public void setShippingType(String shippingType)
this.shippingType = shippingType;
public String getShipToLocations()
return shipToLocations;
public void setShipToLocations(String shipToLocations)
this.shipToLocations = shipToLocations;
public Boolean isExpeditedShipping()
return expeditedShipping;
public void setExpeditedShipping(Boolean bool)
this.expeditedShipping = bool;
public Boolean isOneDayShippingAvailable()
return oneDayShippingAvailable;
public void setOneDayShippingAvailable(Boolean bool)
this.oneDayShippingAvailable = bool;
public Integer getHandlingTime()
return handlingTime;
public void setHandlingTime(Integer days)
this.handlingTime = days;
I would expect the value of currencyId to be "USD" after deserializing, but I'm getting null. All the element values appear to deserialize properly. Does anyone have a suggestion on how to fix this?
Moreover, in a case such as the following instance:
<sellingStatus>
<currentPrice currencyId="USD">125.0</currentPrice>
<convertedCurrentPrice currencyId="USD">125.0</convertedCurrentPrice>
<bidCount>2</bidCount>
<sellingState>EndedWithSales</sellingState>
</sellingStatus>
Where there are two attributes named currencyId on two distinct elements, how can I go about deserializing these into separate fields? I have created a similar SellingStatus class but am unsure how to distinguish between the currencyId attributes.
Thank you!
Edit: Per suggestions I tried adding a custom ShippingServiceCost class to ShippingInfo as follows:
@Element(name = "shippingServiceCost", required = false)
private ShippingServiceCost shippingServiceCost;
Which in turn looks like this:
public class ShippingServiceCost
@Element(name = "shippingServiceCost", required = false)
private BigDecimal shippingServiceCost;
@Attribute(name = "currencyId", required = false)
private String currencyId;
// getters and setters
But when I try to access both the shippingServiceCost field and the currencyId field, I get null in every instance (even though I know there is data). Any suggestions are greatly appreciated.
java xml simple-framework
java xml simple-framework
edited Mar 26 at 23:48
opnightfall1771
asked Mar 26 at 3:26
opnightfall1771opnightfall1771
42 bronze badges
42 bronze badges
Remove the currencyID attribute from the shipping info class. Create a separate class for shipping service cost and add the currencyID attribute there. Then link the shipping service cost class in the shipping info class.
– venkat
Mar 26 at 4:16
See my edit above, I tried this but I am still getting null for both shippingServiceCost and currencyId.
– opnightfall1771
Mar 26 at 23:49
Can you annotate your shippingServiceCost class with the following "@XmlAccessorType(XmlAccessType.FIELD)"
– venkat
Mar 27 at 5:02
I tried this, but still getting null values.
– opnightfall1771
Mar 27 at 15:23
add a comment |
Remove the currencyID attribute from the shipping info class. Create a separate class for shipping service cost and add the currencyID attribute there. Then link the shipping service cost class in the shipping info class.
– venkat
Mar 26 at 4:16
See my edit above, I tried this but I am still getting null for both shippingServiceCost and currencyId.
– opnightfall1771
Mar 26 at 23:49
Can you annotate your shippingServiceCost class with the following "@XmlAccessorType(XmlAccessType.FIELD)"
– venkat
Mar 27 at 5:02
I tried this, but still getting null values.
– opnightfall1771
Mar 27 at 15:23
Remove the currencyID attribute from the shipping info class. Create a separate class for shipping service cost and add the currencyID attribute there. Then link the shipping service cost class in the shipping info class.
– venkat
Mar 26 at 4:16
Remove the currencyID attribute from the shipping info class. Create a separate class for shipping service cost and add the currencyID attribute there. Then link the shipping service cost class in the shipping info class.
– venkat
Mar 26 at 4:16
See my edit above, I tried this but I am still getting null for both shippingServiceCost and currencyId.
– opnightfall1771
Mar 26 at 23:49
See my edit above, I tried this but I am still getting null for both shippingServiceCost and currencyId.
– opnightfall1771
Mar 26 at 23:49
Can you annotate your shippingServiceCost class with the following "@XmlAccessorType(XmlAccessType.FIELD)"
– venkat
Mar 27 at 5:02
Can you annotate your shippingServiceCost class with the following "@XmlAccessorType(XmlAccessType.FIELD)"
– venkat
Mar 27 at 5:02
I tried this, but still getting null values.
– opnightfall1771
Mar 27 at 15:23
I tried this, but still getting null values.
– opnightfall1771
Mar 27 at 15:23
add a comment |
1 Answer
1
active
oldest
votes
For the above code, SimpleXML expects the currencyId to be present as <shippingInfo currencyId="USD">
.
So to solve it, you need to create another class called ShippingServiceCost which will contain the currencyId attribute and the BigDecimal
This will also solve your second query. You can do it by creating two classes CurrentPrice
and ConvertedCurrentPrice
which will contain the currencyId attribute.
This is actually what I tried in the first place. However when I did this, I was getting null values for both the shipping service cost and the currency id. Placing the shipping service cost in the Shipping Info class solved that problem and I'm able to access it now, but I can't get at the currency id.
– opnightfall1771
Mar 26 at 13:36
Update: I tried this (see edit to original post), but I'm still getting null values.
– opnightfall1771
Mar 26 at 23:50
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55349422%2fsimple-xml-returns-null-value-for-attribute-field%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
For the above code, SimpleXML expects the currencyId to be present as <shippingInfo currencyId="USD">
.
So to solve it, you need to create another class called ShippingServiceCost which will contain the currencyId attribute and the BigDecimal
This will also solve your second query. You can do it by creating two classes CurrentPrice
and ConvertedCurrentPrice
which will contain the currencyId attribute.
This is actually what I tried in the first place. However when I did this, I was getting null values for both the shipping service cost and the currency id. Placing the shipping service cost in the Shipping Info class solved that problem and I'm able to access it now, but I can't get at the currency id.
– opnightfall1771
Mar 26 at 13:36
Update: I tried this (see edit to original post), but I'm still getting null values.
– opnightfall1771
Mar 26 at 23:50
add a comment |
For the above code, SimpleXML expects the currencyId to be present as <shippingInfo currencyId="USD">
.
So to solve it, you need to create another class called ShippingServiceCost which will contain the currencyId attribute and the BigDecimal
This will also solve your second query. You can do it by creating two classes CurrentPrice
and ConvertedCurrentPrice
which will contain the currencyId attribute.
This is actually what I tried in the first place. However when I did this, I was getting null values for both the shipping service cost and the currency id. Placing the shipping service cost in the Shipping Info class solved that problem and I'm able to access it now, but I can't get at the currency id.
– opnightfall1771
Mar 26 at 13:36
Update: I tried this (see edit to original post), but I'm still getting null values.
– opnightfall1771
Mar 26 at 23:50
add a comment |
For the above code, SimpleXML expects the currencyId to be present as <shippingInfo currencyId="USD">
.
So to solve it, you need to create another class called ShippingServiceCost which will contain the currencyId attribute and the BigDecimal
This will also solve your second query. You can do it by creating two classes CurrentPrice
and ConvertedCurrentPrice
which will contain the currencyId attribute.
For the above code, SimpleXML expects the currencyId to be present as <shippingInfo currencyId="USD">
.
So to solve it, you need to create another class called ShippingServiceCost which will contain the currencyId attribute and the BigDecimal
This will also solve your second query. You can do it by creating two classes CurrentPrice
and ConvertedCurrentPrice
which will contain the currencyId attribute.
answered Mar 26 at 4:04
Danish FaizanDanish Faizan
11 bronze badge
11 bronze badge
This is actually what I tried in the first place. However when I did this, I was getting null values for both the shipping service cost and the currency id. Placing the shipping service cost in the Shipping Info class solved that problem and I'm able to access it now, but I can't get at the currency id.
– opnightfall1771
Mar 26 at 13:36
Update: I tried this (see edit to original post), but I'm still getting null values.
– opnightfall1771
Mar 26 at 23:50
add a comment |
This is actually what I tried in the first place. However when I did this, I was getting null values for both the shipping service cost and the currency id. Placing the shipping service cost in the Shipping Info class solved that problem and I'm able to access it now, but I can't get at the currency id.
– opnightfall1771
Mar 26 at 13:36
Update: I tried this (see edit to original post), but I'm still getting null values.
– opnightfall1771
Mar 26 at 23:50
This is actually what I tried in the first place. However when I did this, I was getting null values for both the shipping service cost and the currency id. Placing the shipping service cost in the Shipping Info class solved that problem and I'm able to access it now, but I can't get at the currency id.
– opnightfall1771
Mar 26 at 13:36
This is actually what I tried in the first place. However when I did this, I was getting null values for both the shipping service cost and the currency id. Placing the shipping service cost in the Shipping Info class solved that problem and I'm able to access it now, but I can't get at the currency id.
– opnightfall1771
Mar 26 at 13:36
Update: I tried this (see edit to original post), but I'm still getting null values.
– opnightfall1771
Mar 26 at 23:50
Update: I tried this (see edit to original post), but I'm still getting null values.
– opnightfall1771
Mar 26 at 23:50
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55349422%2fsimple-xml-returns-null-value-for-attribute-field%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Remove the currencyID attribute from the shipping info class. Create a separate class for shipping service cost and add the currencyID attribute there. Then link the shipping service cost class in the shipping info class.
– venkat
Mar 26 at 4:16
See my edit above, I tried this but I am still getting null for both shippingServiceCost and currencyId.
– opnightfall1771
Mar 26 at 23:49
Can you annotate your shippingServiceCost class with the following "@XmlAccessorType(XmlAccessType.FIELD)"
– venkat
Mar 27 at 5:02
I tried this, but still getting null values.
– opnightfall1771
Mar 27 at 15:23