Hey Fellows,
>
> We are having an issue with Xerces versions 1.3 and above in our
> application layer, One of the pieces of our application is to convert
> Java Objects to
> their XML representations, while we were using Xerces-1.2.3 jar, the
> converions from a java object to its equivalent representation in XML
> were taking place perfectly, we upgraded to Xerces 1.3/1.3.1 we got a
> NullPointerException, I tried using Xerces 1.4 same exception was
> thrown again, when I rolled back to Xerces 1.2.3 jar, there were no
> exceptions anymore everything went absolutely fine.I am copying the
> exception that took place and also am attaching the Class in which
> this exception takes place.
>
> From the System println's it can be seen that, that the NodeList that
> we are trying to get has a length of '1' but the node within the
> NodeList is "Null". This is problem is making us to have the older
> Xerces jar(Version 1.2.3) within our application layer and any other
> third party tool that we use, which is in sync with the newer versions
> of Xerces creates a version conflict for our application layer.
>
> I would really appreciate any help in resolving this backward
> compatibility issue.
>
>
> thanks,
> Krishna
>
>
> %%%%%%%%%%%%%% EXCEPTION STACK TRACE
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > </CustomerOrder>, submitordercommerceflow, TMOrder, 2] . .
> .ID:P106002
> > DEBUG 2001-6-13 22:57:3:163 . . .electron/10.1.1.50 OpenVan version
> > RC3.2 . . .invoked by
> > electroneconomy.openvan.commerceflow.converter.XMLConverter . .
> > .@@@@@@@@ XMLConverter Initialized @@@@@@@@@@ . . .ID:P106002
> > DEBUG 2001-6-13 22:57:3:164 . . .electron/10.1.1.50 OpenVan version
> > RC3.2 . . .invoked by
> > electroneconomy.openvan.commerceflow.converter.XMLConverter . . .the
> > JNDI Bind Name is : ee.openvan.openvan.conversionstrategy.TMOrder .
> .
> > .ID:P106002
> > DEBUG 2001-6-13 22:57:3:185 . . .electron/10.1.1.50 OpenVan version
> > RC3.2 . . .invoked by
> > electroneconomy.common.openvan.repository.JNDIDOMRepository . . .Got
> > new instance of resource 'ee.peerproperties.dom.template.order'from
> > JNDI . . .ID:P106002
> > DEBUG 2001-6-13 22:57:3:165 . . .electron/10.1.1.50 OpenVan version
> > RC3.2 . . .invoked by
> > electroneconomy.common.openvan.repository.JNDIDOMRepository . .
> > .Cached instance of object ee.peerproperties.dom.template.order does
> > not exist, will get new one . . .ID:P106002
> > @@@@@@ #### Lenght is : 1
> > @@@@@@ #### ValueNode is : [#text: ] J : 0
> > @@@@@@ #### Lenght is : 1
> > @@@@@@ #### ValueNode is : [#text: submitordercommerceflow] J : 0
> > @@@@@@ #### Lenght is : 1
> > @@@@@@ #### ValueNode is : [#text: ] J : 0
> > @@@@@@ #### Lenght is : 1
> > @@@@@@ #### ValueNode is : [#text: ] J : 0
> > @@@@@@ #### Lenght is : 1
> > @@@@@@ #### ValueNode is : [#text: genericwarehouse] J : 0
> > @@@@@@ #### Lenght is : 1
> > @@@@@@ #### ValueNode is : [#text: openvan] J : 0
> > @@@@@@ #### Lenght is : 1
> > @@@@@@ #### ValueNode is : [#text: ] J : 0
> > @@@@@@ #### Lenght is : 1
> > @@@@@@ #### ValueNode is : [#text: ] J : 0
> > @@@@@@ #### Lenght is : 1
> > @@@@@@ #### ValueNode is : null J : 0
> > java.lang.NullPointerException
> > at
> > com.electroneconomy.common.util.DOMtoXML.getXML(DOMtoXML.java:66)
> > at
> > com.electroneconomy.common.util.DOMtoXML.getXML(DOMtoXML.java:94)
> > at
> > com.electroneconomy.common.util.DOMtoXML.getXML(DOMtoXML.java:94)
> > at
> > com.electroneconomy.common.util.DOMtoXML.getXML(DOMtoXML.java:31)
> > at
> >
> electroneconomy.commerceflow.conversionstrategy.SubmitOrderXMLConversi
> > onStrategy.convertBOtoXML(SubmitOrderXMLConversionStrategy.java:860)
> > at
> >
> electroneconomy.openvan.commerceflow.converter.XMLConverter.toXML(XMLC
> > onverter.java:500)
> > at
> >
> electroneconomy.actions.openvan.common.SendMessageA.action(SendMessage
> > A.java:180)
> > at
> > electroneconomy.openvan.actions.Action.execute(Action.java:146)
> > at
> >
> electroneconomy.openvan.actions.ActionRepository.executeAction(ActionR
> > epository.java:99)
> > at
> >
> electroneconomy.openvan.processes.Process.executeLocalAction(Process.j
> > ava:402)
> > at
> >
> electroneconomy.processes.openvan.MsgWarehouseCaptP.process(MsgWarehou
> > seCaptP.java:49)
> > at
> > electroneconomy.openvan.processes.Process.execute(Process.java:494)
> > at
> >
> electroneconomy.openvan.commerceflow.CommerceFlow.executeNode(Commerce
> > Flow.java:439)
> > at
> >
> electroneconomy.openvan.commerceflow.CommerceFlow.execute(CommerceFlow
> > .java:338)
> > at
> >
> electroneconomy.openvan.commerceflow.CommerceFlow.executeFlow(Commerce
> > Flow.java:126)
> > at
> >
> electroneconomy.openvan.commerceflow.CommerceFlowInitiator.executeComm
> > erceFlow(CommerceFlowInitiator.java:193)
> > at
> >
> electroneconomy.openvan.commerceflow.CommerceFlowInitiator.initiateCom
> > merceFlow(CommerceFlowInitiator.java:119)
> > at
> >
> electroneconomy.common.GenericReceiver.onMessage(GenericReceiver.java:
> > 32)
> > at
> >
> electroneconomy.common.OPMessageConsumer.run(OPMessageConsumer.java:10
> > 8)
> > at java.lang.Thread.run(Thread.java:479)
> > electroneconomy.businessdataobject.MessagingNotSupportedException:
> > Passed in BusinessDataObject is not messageable BusinessDataObject
> > java.lang.NullPointerException
> > at java.lang.Throwable.fillInStackTrace(Native Method)
> > at java.lang.Throwable.<init>(Throwable.java:94)
> > at java.lang.Exception.<init>(Exception.java:42)
> > at
> >
> electroneconomy.businessdataobject.MessagingNotSupportedException.<ini
> > t>(MessagingNotSupportedException.java:47)
> > at
> >
> electroneconomy.openvan.commerceflow.converter.XMLConverter.toXML(XMLC
> > onverter.java:505)
> > at
> >
> electroneconomy.actions.openvan.common.SendMessageA.action(SendMessage
> > A.java:180)
> > at
> > electroneconomy.openvan.actions.Action.execute(Action.java:146)
> > at
> >
> electroneconomy.openvan.actions.ActionRepository.executeAction(ActionR
> > epository.java:99)
> > at
> >
> electroneconomy.openvan.processes.Process.executeLocalAction(Process.j
> > ava:402)
> > at
> >
> electroneconomy.processes.openvan.MsgWarehouseCaptP.process(MsgWarehou
> > seCaptP.java:49)
> > at
> > electroneconomy.openvan.processes.Process.execute(Process.java:494)
> >
>
> <<DOMtoXML.txt>>
>
>
> Krishna Vemuri
> Software Engineer
> Electron Economy, Inc.
> www.electroneconomy.com
> [EMAIL PROTECTED]
> 408.873.3270 x3155
> 408.873.3279
>
// $Log: DOMtoXML.java,v $
// Revision 1.1 2001/06/06 22:13:17 sahuero
// Resynched with common_projects 3.2 branch
//
// Revision 1.5 2001/04/03 02:00:02 jaya
// Changed all methods as static
//
package com.electroneconomy.common.util;
import org.w3c.dom.*;
import java.util.Date;
import java.text.SimpleDateFormat;
public class DOMtoXML {
/**
* This method currently supports XML DOM with elements, attributes,
* entity references, comments, text, and CDATA section.
*
* It does not handle document fragment node, document node, document type
* node, entity node, notation node, and processing instruction node.
*/
public static String getXML(Document doc)
throws DOMException
{
Element docElem;
docElem = doc.getDocumentElement();
return "<?xml version=\"1.0\" standalone=\"yes\" ?>" + getXML(docElem);
} //getXML
public static String getXML(Node node)
throws DOMException
{
short type, attrType;
int len, attrLen;
Node attrNode, valueNode;
NodeList childNodeList, attrNodeList;
String name, value;
NamedNodeMap nnmap;
StringBuffer xmlString, attrValueStr;
xmlString = new StringBuffer();
type = node.getNodeType();
//********** handle element node **********
if (type == Node.ELEMENT_NODE) {
//********** populate element name **********
name = node.getNodeName();
xmlString.append("<").append(name);
//********** populate element attributes **********
nnmap = node.getAttributes();
len = nnmap.getLength();
for (int i = 0; i < len; i++) {
attrNode = nnmap.item(i);
//********** get attribute value nodes **********
attrNodeList = attrNode.getChildNodes();
attrValueStr = new StringBuffer();
attrLen = attrNodeList.getLength();
System.out.println("@@@@@@ #### Lenght is : " + attrLen);
for (int j = 0; j < attrLen; j++) {
valueNode = attrNodeList.item(j);
System.out.println("@@@@@@ #### ValueNode is : " + valueNode);
attrType = valueNode.getNodeType();
if (attrType == Node.TEXT_NODE) {
attrValueStr.append(valueNode.getNodeValue());
}
else if (attrType == Node.ENTITY_REFERENCE_NODE) {
attrValueStr.append("&");
attrValueStr.append(valueNode.getNodeName());
attrValueStr.append(";");
}
else {
attrValueStr.append(valueNode.getNodeValue());
}
}
//********** populate attribute value **********
xmlString.append(" ");
xmlString.append(attrNode.getNodeName());
xmlString.append("=\"").append(attrValueStr).append("\"");
}
//xmlString.append(">");
//********** traverse through each child node **********
childNodeList = node.getChildNodes();
len = childNodeList.getLength();
if (len > 0) {
xmlString.append(">");
for (int i = 0; i < len; i++) {
node = childNodeList.item(i);
xmlString.append(getXML(node));
}
xmlString.append("</").append(name).append(">\n");
}
else {
xmlString.append("/>\n");
}
}
//********** handle comment node **********
else if (type == Node.COMMENT_NODE) {
xmlString.append("<!-- ");
xmlString.append(node.getNodeValue());
xmlString.append(" -->");
}
//********** handle text node **********
else if (type == Node.TEXT_NODE) {
xmlString.append(node.getNodeValue());
}
//********** handle entity reference node **********
else if (type == Node.ENTITY_REFERENCE_NODE) {
xmlString.append("&");
xmlString.append(node.getNodeName());
xmlString.append(";");
}
//********** handle CDATA section node **********
else if (type == Node.CDATA_SECTION_NODE) {
xmlString.append("<![CDATA[");
xmlString.append(node.getNodeValue());
xmlString.append("]]>");
}
//********** handle all other node **********
else {
//do nothing
}
return xmlString.toString();
} //getXML
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]