Hi xerces users,

Correcting this mail with  xml that is very similar to the one that gets
parsed.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE PaymentMessage SYSTEM "bkt.dtd">
<PaymentMessage>
<Header>
<ProcessLocCode><![CDATA[950]]></ProcessLocCode>
<Region><![CDATA[ASIA]]></Region>

<TxnTotalAmount><![CDATA[100]]></TxnTotalAmount>
<CustomerID><![CDATA[070940]]></CustomerID>
<BatchID><![CDATA[3062006RPIG]]></BatchID>
<BatchSeq>12345</BatchSeq>
</Header>
<TransacService name="Book Transfer">
<PaymentInfo>
<TxnUID><![CDATA[E1713DD98B8C484183908B4BEFD03606]]></TxnUID>
<TxnRefNumber><![CDATA[24BKT2111]]></TxnRefNumber>
<CCY><![CDATA[MYR]]></CCY>
<ValueDate><![CDATA[20121102]]></ValueDate>
<Amount><![CDATA[100]]></Amount>
<TxnType><![CDATA[BKT]]></TxnType>
</PaymentInfo>
<FromAcctType type="Debit">
<AcctNumber><![CDATA [70940019]]></AcctNumber>
</FromAcctType>
<OrderParty>
<Name><![CDATA[070940NEC SemiConductors]]></Name>
<Address>
<Address1><![CDATA[ADDRESS LINE1]]> </Address1>
</Address>
</OrderParty>
<ToAcctType type="Beneficiary">
<Name><![CDATA[BENEFICIARY NAME FOR MERCK LENGTH35]]> </Name>
<AcctNumber><![CDATA[007904018]]></AcctNumber>
<Phone>12345</Phone>
<Address>
<Address1><![CDATA[Telok Panglima Garang Ind. Est]]></Address1>
</Address>
</ToAcctType>

<PaymentDetail>
<Line1><![CDATA[PAYMENT DETAILS 1]]></Line1>
<Line2><![CDATA[PAYMENT DETAILS 2]]> </Line2>
</PaymentDetail>
<Invoices>
<InvoiceDetail>BDFRESFGG</InvoiceDetail>
</Invoices>
<FX>
<Rate><![CDATA[56.23000000]]></Rate>
<ContractNumber><![CDATA[FXCONTACRT6]]></ContractNumber>
</FX>
</TransacService>
</PaymentMessage>

In the beginning  stage the attribute 'type' for tag <ToAcctType> itself
gets missed.
It looks like <ToAcctType >  [Here the  attribute 'type' is missing].[See
the actual xml above for reference]

After we put in the codes to fix the issue , we faced another issue , this
time the value of attribute  getting missed.
Here the XML tag looks like

 <ToAcctType type="">[Here the value of the attribute 'type' is missing or
empty].[See the actual xml above for reference]

Awaiting for your valuable responses.

Thanks,
karthik





From:   karthikeyan...@polarisft.com
To:     hlit...@jtcsv.com, sandy...@ca.ibm.com,
            j-users@xerces.apache.org, j-...@xerces.apache.org
Cc:     rajkumar.ramachand...@outlook.com, karthikeyan...@polarisft.com
Date:   11/01/2012 06:46 PM
Subject:        Xerces clone node issue in  production environment (Multi
            threaded). Help needed ...




Hi Xerces users,

Greetings!.

We have an issue in the xerces parsers and specifically in cloning a
node.We browsed in apache's site and bugzilla to find if anyone had
reported any issues or bugs relevant to the one we are facing in our
production environment.

We were able to find info about few issue that were reported already and
that is more or less similar to the one we are facing now.

Let me brief out the environment wherein we are facing this issue.

OS: Sun Solaris 10
Server: Websphere 6
JDK: 1.4
Xerces version: Xerces_Version_1_2_0
Number of Daemon threads per JVM: 3

Scenario:

In our Production environment when 3 daemon threads run under a JVM.

When 3 similar type of XML messages gets parsed at same second
(concurrently) under a JVM, we notice some attribute gets missed.

Here is sample XML that gets parsed.

<?xml version="1.0"?>
<!DOCTYPE InTemplate SYSTEM "feed_dd.dtd" >
<InTemplate>
  <Header>
    <DataDictionary>
      <element XMLName="NumberOfTxn" CFCName="NO_TRANS"
CFCType="TYPE_STRING"/>
      <element XMLName="ProcessingLoc" CFCName="PR_LOC"
CFCType="TYPE_STRING"/>
      <element XMLName="ServiceType" CFCName="FCO_TYP"
CFCType="TYPE_STRING"/>
    </DataDictionary>
  </Header>
  <Body>
    <DataDictionary>
      <element XMLName="TxnUID" CFCName="TRAN_NO" CFCType="TYPE_STRING"/>
      <collection XMLName="TxnIdentification"
CFCType="TYPE_FIELDCOLLECTION">
        <element XMLName="Sequence" CFCName="BSI_SEQ"
CFCType="TYPE_STRING"/>
        <element XMLName="TxnType" CFCName="PYMT_TYP"
CFCType="TYPE_STRING"/>
        <element XMLName="AcctNumber" CFCName="ACCT_NO"
CFCType="TYPE_STRING"/>
        <element XMLName="CCY" CFCName="ACCT_CCY_COD"
CFCType="TYPE_STRING"/>
      </collection>
      <element XMLName="ProcessingLocCode" CFCName="PROC_LOCA"
CFCType="TYPE_STRING"/>
      <element XMLName="Status" CFCName="STA" CFCType="TYPE_STRING"/>
      <element XMLName="AuthNumS015" CFCName="MEX_AUTH_NO"
CFCType="TYPE_STRING"/> ( line no 20)
      <element XMLName="AuthNumS502" CFCName="MEX_FOLIO_NO"
CFCType="TYPE_STRING"/>

      <element XMLName="Reference" CFCName="MT942_REF_NO"
CFCType="TYPE_STRING"/>
    </DataDictionary>
  </Body>
</InTemplate>

Intially, we faced something like the whole attribute in one of the child
nodes in XML itself gets missed .( like the one highlighted above in the
sample xml - the attribute CFCName="MEX_AUTH_NO" that got underlined gets
missed).The returned XML doc is with out the 'CFCName' attribute and it
looks  something like

                 <element XMLName="AuthNumS015" CFCType="TYPE_STRING"/> (line
no  20)



To fix this we placed the following code


        *       Parameters:
        *               iNode - source
        *               deep - If true, recursively clone the subtree under
the specified node; if false, clone only the node itself (and its
attributes, if it is an Element).
        *       return:
        *               copy of source ( xml document that was parsed)
        */
        private Node cloneNode(Node inNode, boolean deep){

                //      clone current input node
                Node outNode = inNode.cloneNode(deep);
                outNode = getRenderer().getOutDocument().importNode
(outNode,true);

                // put back attr.
                if ( inNode.getNodeType() == Node.ELEMENT_NODE &&
inNode.hasAttributes() ){

                        NamedNodeMap attrMap = inNode.getAttributes();
                        Attr attr = null;
                        Attr outAttr = null ;

                        for ( int i=0; i<attrMap.getLength(); i++ ){
                                attr = (Attr)attrMap.item(i);
                                // only append deleted attr.
                                if ((((Element)outNode).getAttributeNode
(attr.getName())) == null ){
                                        outAttr = getRenderer
().getOutDocument().createAttribute(attr.getName());
                                        outAttr.setValue( attr.getValue
() );
                                        ((Element)outNode).setAttributeNode
(outAttr);
                                }
                        }
                }
                return outNode;
        }

Even after that , we faced another issue ,but this time the value of the
attribute(CFCName) gets missed or it is empty like the one shown below and
not the whole attribute as we faced before.


The xml after the attribute value missed looks something like
<element XMLName="AuthNumS015" CFCName="" CFCType="TYPE_STRING"/> [Here u
can see the CFCName attribute value is empty (null)]


We are clueless about this and the most disheartening thing is that we are
not able to  reproduce this behavior consistently and this occurs probably
once in 5-6 months in our environment.We tried different ways with the
threads  in our IDE to reproduce but everything ended in vain.

The below issue reported in the following link is more or less similar to
the one we are facing, but we are not able to see the whole mailing thread
conversation from the site and hence seeking xerces users who reported this
already to sort this out for us.

Clone node issue

Bug getOwnerElement for cloned attributes

http://mail-archives.apache.org/mod_mbox/xerces-j-users/200102.mbox/%3c3a843476.8a614...@us.ibm.com%3e




[Bug 937] Changed - cloneNode empties Attribute nodes

http://mail-archives.apache.org/mod_mbox/xerces-j-dev/200103.mbox/%3c200103121958.laa00...@nagoya-a.betaversion.org%3E





We would like to know

1.Is this issue a valid one?
2.Is this issue got fixed ,if so, in which xerces version ?.
3.Why we are not able to reproduce it consistently and what had actually
gone wrong.

sorry for the detailed explanation about issue but we have no other go.
Your help in this regard is very much appreciated.I am ready to give more
info regarding this if needed


Thanks,
karthik,



This e-Mail may contain proprietary and confidential information and is
sent for the intended recipient(s) only.  If by an addressing or
transmission error this mail has been misdirected to you, you are requested
to delete this mail immediately. You are also hereby notified that any use,
any form of reproduction, dissemination, copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its
attachment other than by its intended recipient/s is strictly prohibited.

Visit us at http://www.polarisFT.com


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org





This e-Mail may contain proprietary and confidential information and is sent 
for the intended recipient(s) only.  If by an addressing or transmission error 
this mail has been misdirected to you, you are requested to delete this mail 
immediately. You are also hereby notified that any use, any form of 
reproduction, dissemination, copying, disclosure, modification, distribution 
and/or publication of this e-mail message, contents or its attachment other 
than by its intended recipient/s is strictly prohibited.

Visit us at http://www.polarisFT.com


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to