|
[hidden email] wrote:
> Author: adrianc > Date: Sun Feb 14 18:38:34 2010 > New Revision: 910060 > > URL: http://svn.apache.org/viewvc?rev=910060&view=rev > Log: > Created a SOAP serializer facade class to decouple SOAP code from XmlSerialize. > > Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java?rev=910060&r1=910059&r2=910060&view=diff > ============================================================================== > --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java (original) > +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java Sun Feb 14 18:38:34 2010 > @@ -58,8 +58,8 @@ > import org.xml.sax.SAXException; > > /** > - * <p><b>Title:</b> XmlSerializer > - * <p><b>Description:</b> Simple XML serialization/deserialization routines with embedded type information > + * XmlSerializer class. This class is deprecated - new code should use the > + * Java object marshalling/unmarshalling methods in <code>UtilXml.java</code>. > * > */ > public class XmlSerializer { > @@ -80,23 +80,26 @@ > // readXmlDocument with false second parameter to disable validation > Document document = UtilXml.readXmlDocument(content, false); > if (document != null) { > - Element rootElement = document.getDocumentElement(); > - // find the first element below the root element, that should be the object > - Node curChild = rootElement.getFirstChild(); > - > - while (curChild != null && curChild.getNodeType() != Node.ELEMENT_NODE) { > - curChild = curChild.getNextSibling(); > - } > - if (curChild == null) return null; > - Element element = (Element) curChild; > - > - return deserializeSingle(element, delegator); > + return deserialize(document, delegator); > } else { > Debug.logWarning("Serialized document came back null", module); > return null; > } > } > > + public static Object deserialize(Document document, Delegator delegator) throws SerializeException { > + Element rootElement = document.getDocumentElement(); > + // find the first element below the root element, that should be the object > + Node curChild = rootElement.getFirstChild(); > + while (curChild != null && curChild.getNodeType() != Node.ELEMENT_NODE) { > + curChild = curChild.getNextSibling(); > + } > + if (curChild == null) { > + return null; > + } > + return deserializeSingle((Element) curChild, delegator); > + } > + This should have been a separate commit. |
|
Adam Heath wrote:
> [hidden email] wrote: >> Author: adrianc >> Date: Sun Feb 14 18:38:34 2010 >> New Revision: 910060 >> >> URL: http://svn.apache.org/viewvc?rev=910060&view=rev >> Log: >> Created a SOAP serializer facade class to decouple SOAP code from XmlSerialize. >> >> Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java >> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java?rev=910060&r1=910059&r2=910060&view=diff >> ============================================================================== >> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java (original) >> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/serialize/XmlSerializer.java Sun Feb 14 18:38:34 2010 >> @@ -58,8 +58,8 @@ >> import org.xml.sax.SAXException; >> >> /** >> - * <p><b>Title:</b> XmlSerializer >> - * <p><b>Description:</b> Simple XML serialization/deserialization routines with embedded type information >> + * XmlSerializer class. This class is deprecated - new code should use the >> + * Java object marshalling/unmarshalling methods in <code>UtilXml.java</code>. >> * >> */ >> public class XmlSerializer { >> @@ -80,23 +80,26 @@ >> // readXmlDocument with false second parameter to disable validation >> Document document = UtilXml.readXmlDocument(content, false); >> if (document != null) { >> - Element rootElement = document.getDocumentElement(); >> - // find the first element below the root element, that should be the object >> - Node curChild = rootElement.getFirstChild(); >> - >> - while (curChild != null && curChild.getNodeType() != Node.ELEMENT_NODE) { >> - curChild = curChild.getNextSibling(); >> - } >> - if (curChild == null) return null; >> - Element element = (Element) curChild; >> - >> - return deserializeSingle(element, delegator); >> + return deserialize(document, delegator); >> } else { >> Debug.logWarning("Serialized document came back null", module); >> return null; >> } >> } >> >> + public static Object deserialize(Document document, Delegator delegator) throws SerializeException { >> + Element rootElement = document.getDocumentElement(); >> + // find the first element below the root element, that should be the object >> + Node curChild = rootElement.getFirstChild(); >> + while (curChild != null && curChild.getNodeType() != Node.ELEMENT_NODE) { >> + curChild = curChild.getNextSibling(); >> + } >> + if (curChild == null) { >> + return null; >> + } >> + return deserializeSingle((Element) curChild, delegator); >> + } >> + > > > This should have been a separate commit. And in any event, this change wasn't describe in the changelog. |
| Free forum by Nabble | Edit this page |
