In the Google Checkout integration, I'm needing to parse the following
xml string... <?xml version="1.0" encoding="UTF-8"?><checkout-redirect xmlns="http://checkout.google.com/schema/2" serial-number="ec09382f-c1b3-4ab2-8090-35906e3918e6"> <redirect-url> https://sandbox.google.com/checkout/view/buy?o=shoppingcart&shoppingcart=dgfi89u2398 </redirect-url> </checkout-redirect> I have it contained as a string. How do I get the value of the redirect-url (https://sandbox.google.com/checkout/view/buy?o=shoppingcart&shoppingcart=dgfi89u2398)? I've tried the following: ============= response = <?xml version ... (from above) document = org.ofbiz.base.util.UtilXml.readXmlDocument(response); rootElement = document.getRootElement; childList = org.ofbiz.base.util.UtilXml.childElementList(rootElement); childListIter = childList.iterator(); while (childListIter.hasNext()){ child = childListIter.next(); nodeName = child.getNodeName(); if ("call-map-processor".equals(nodeName)){ redirect = org.ofbiz.base.util.UtilXml.elementValue(child); } ============== document ends up returning [#document: null] any ideas would greatly be appreciated. Thanks! -Chris |
FlexibleLocation perhaps?
That's just a guess and from memory though ;-) - Andrew On Tue, 2007-02-06 at 07:40 -0800, Chris Howe wrote: > In the Google Checkout integration, I'm needing to parse the following > xml string... > > <?xml version="1.0" encoding="UTF-8"?><checkout-redirect > xmlns="http://checkout.google.com/schema/2" > serial-number="ec09382f-c1b3-4ab2-8090-35906e3918e6"> > <redirect-url> > https://sandbox.google.com/checkout/view/buy?o=shoppingcart&shoppingcart=dgfi89u2398 > </redirect-url> > </checkout-redirect> > > I have it contained as a string. How do I get the value of the > redirect-url > (https://sandbox.google.com/checkout/view/buy?o=shoppingcart&shoppingcart=dgfi89u2398)? > > > I've tried the following: > ============= > response = <?xml version ... (from above) > document = org.ofbiz.base.util.UtilXml.readXmlDocument(response); > rootElement = document.getRootElement; > childList = org.ofbiz.base.util.UtilXml.childElementList(rootElement); > childListIter = childList.iterator(); > while (childListIter.hasNext()){ > child = childListIter.next(); > nodeName = child.getNodeName(); > if ("call-map-processor".equals(nodeName)){ > redirect = org.ofbiz.base.util.UtilXml.elementValue(child); > } > > ============== > > document ends up returning [#document: null] > > any ideas would greatly be appreciated. Thanks! > -Chris Kind Regards Andrew Sykes <[hidden email]> Sykes Development Ltd http://www.sykesdevelopment.com |
Andrew,
Thanks for the response. It ended up being that I didn't change my copy and paste :-) if ("call-map-processor".equals(nodeName)){ should have been: if ("redirect-url".equals(nodeName)){ --- Andrew Sykes <[hidden email]> wrote: > FlexibleLocation perhaps? > > That's just a guess and from memory though ;-) > > - Andrew > > On Tue, 2007-02-06 at 07:40 -0800, Chris Howe wrote: > > In the Google Checkout integration, I'm needing to parse the > following > > xml string... > > > > <?xml version="1.0" encoding="UTF-8"?><checkout-redirect > > xmlns="http://checkout.google.com/schema/2" > > serial-number="ec09382f-c1b3-4ab2-8090-35906e3918e6"> > > <redirect-url> > > > > > </redirect-url> > > </checkout-redirect> > > > > I have it contained as a string. How do I get the value of the > > redirect-url > > > (https://sandbox.google.com/checkout/view/buy?o=shoppingcart&shoppingcart=dgfi89u2398)? > > > > > > I've tried the following: > > ============= > > response = <?xml version ... (from above) > > document = org.ofbiz.base.util.UtilXml.readXmlDocument(response); > > rootElement = document.getRootElement; > > childList = > org.ofbiz.base.util.UtilXml.childElementList(rootElement); > > childListIter = childList.iterator(); > > while (childListIter.hasNext()){ > > child = childListIter.next(); > > nodeName = child.getNodeName(); > > if ("call-map-processor".equals(nodeName)){ > > redirect = org.ofbiz.base.util.UtilXml.elementValue(child); > > } > > > > ============== > > > > document ends up returning [#document: null] > > > > any ideas would greatly be appreciated. Thanks! > > -Chris > -- > Kind Regards > Andrew Sykes <[hidden email]> > Sykes Development Ltd > http://www.sykesdevelopment.com > > |
Free forum by Nabble | Edit this page |