XML Parsing attributes with encoded ampersand causes wrong order

Hi all,
I am writing in the forum first (because it could be that i am doing something wrong.... but i think it is a bug. Nonetheless, i thought i'd write my problem up here first.
I am using Java 6, and this has been reproduced on both windows and linux.
java version "1.6.0_03"
Problem:
read XML file into org.w3c.dom.Document.
XML File has some attributes which contain ampersand. These are escaped as (i think) is prescribed by the rule of XML. For example:
<?xml version="1.0" encoding="UTF-8"?>
     <lang>
          <text dna="8233" ro="chisturi de plex coroid (&gt;=1.5 mm)" it="Cisti del plesso corioideo(&gt;=1.5mm)" tr="Koro&#305;d pleksus kisti (&gt;=1.5 mm)" pt_br="Cisto do plexo cor&oacute;ide (&gt;=1,5 mm)" de="Choroidplexus Zyste (&gt;=1,5 mm)" el="&Kappa;&#973;&sigma;&tau;&epsilon;&iota;&sigmaf; &chi;&omicron;&rho;&omicron;&epsilon;&iota;&delta;&omicron;&#973;&sigmaf; &pi;&lambda;&#941;&gamma;&mu;&alpha;&tau;&omicron;&sigmaf; (&gt;= 1.5 mm)" zh_cn="&#33033;&#32476;&#33180;&#22218;&#32959;&#65288;&gt;= 1.5 mm&#65289;" pt="Quisto do plexo coroideu (&gt;=1,5 mm)" bg="&#1050;&#1080;&#1089;&#1090;&#1072; &#1085;&#1072; &#1093;&#1086;&#1088;&#1080;&#1086;&#1080;&#1076;&#1085;&#1080;&#1103; &#1087;&#1083;&#1077;&#1082;&#1089;&#1091;&#1089; (&gt;= 1.5 mm)" fr="Kystes du plexus choroide (&gt;= 1,5 mm)" en="Choroid plexus cysts (&gt;=1.5 mm)" ru="&#1082;&#1080;&#1089;&#1090;&#1099; &#1089;&#1086;&#1089;&#1091;&#1076;&#1080;&#1089;&#1090;&#1099;&#1093; &#1089;&#1087;&#1083;&#1077;&#1090;&#1077;&#1085;&#1080;&#1081; (&gt;=1.5 mm)" es="Quiste del plexo coroideo (&gt;=1.5 mm)" ja="&#33032;&#32097;&#33180;&#22178;&#32990;&#65288;&gt;=1.5mm&#65289;" nl="Plexus choroidus cyste (&gt;= 1,5 mm)" />
</lang>As you might understand, we need to have the fixed text '>' for later processing. (not the greater than symbol '>' but the escaped version of it).
Therefore, I escape the ampersand (encode?) and leave the rest of the text as is. And so my > becomes >
All ok?
Symptom:
in fetching attributes, for example by the getAttribute("en") type call, the wrong attribute values are fetched.
Not only that, if i only read to Document instance, and write back to file, the attributes are shown mixed up.
eg:
dna: 8233, ro=chisturi de plex coroid (>=1.5 mm), en=&#1082;&#1080;&#1089;&#1090;&#1099; &#1089;&#1086;&#1089;&#1091;&#1076;&#1080;&#1089;&#1090;&#1099;&#1093; &#1089;&#1087;&#1083;&#1077;&#1090;&#1077;&#1085;&#1080;&#1081; (>=1, de=Choroidplexus Zyste (>=1,5 mm)Here you can see that 'en' is shown holding what looks like greek, ... (what is ru as a country-code anyway?) where it should have obviously had the english text that originally was associated with the attribute 'en'
This seems very strange and unexpected to me. I would have thought that in escaping (encoding) the ampersand, i have fulfilled all requirements of me, and that should be that.
There is also no error that seems to occur.... we simply get the wrong order when fetching attributes.
Am I doing something wrong? Or is this a bug that should be submitted?
Kind Regards, and thanks to all responders/readers.
Sean
p.s. previously I had not been escaping the ampersand. This meant that I lost my ampersand in fetching attributes, AND the attribute order was ALSO WRONG!
In fact, the wrong order was what led me to read about how to correctly encode ampersand at all. I had been hoping that correctly encoding would fix the order problem, but it didn't.
Edited by: svaens on Mar 31, 2008 6:21 AM

Hi kdgregory ,
Firstly, sorry if there has been a misunderstanding on my part. If i did not reply to the question you raised, I appologise.
In this 'reply' I hope not to risk further misunderstanding, and have simply given the most basic example which will cause the problem I am talking about, as well as short instructions on what XML to remove to make the problem disappear.
Secondly, as this page seems to be displayed in ISO 8859-1, this is the reason the xml I have posted looks garbled. The xml is UTF-8. I have provided a link to the example xml file for the sample below
[example xml file UTF-8|http://sean.freeshell.org/java/less2.xml]
As for your most recent questions:
Is it specified as an entity? To my knowledge (so far as my understanding of what an entity is) , yes, I am including entities in my xml. In my below example, the entities are the code for the greater than symbol. I am under the understanding that this is allowed in XML ??
Is it an actual literal character (0xA0)? No, I am specifying 'greater than' entity (code?) in order to include the actual symbol in the end result. I am encoding it in form 'ampersand', 'g character', 't character', 'colon' in order for it to work, according to information I have read on various web pages. A quick google search will show you where I got such information from, example website: https://studio.tellme.com/general/xmlprimer.html
Here is my sample program. It is longer than the one you kindly provided only because it prints out all attributes of the element it looks for. To use it, only change the name of the file it loads.
I have given the xml code seperately so it can be easily copied and saved to file.
Results you can expect from running this small test example?
1. a mixed up list of attributes where attribute node name no longer matches its assigned attribute values (not for all attributes, but some).
2. removing the attribute bg from the 'text' element will reduce most of these symptoms, but not all. Removing another attribute from the element will most likely make the end result look normal again.
3. No exception is thrown by the presence of non xml characters.
IMPORTANT!!! I have only just (unfortunately) noticed what this page does to my unicode characters... all the the international characters get turned into funny codes when previewed and viewed on this page.
Whereas the only codes I am explicitly including in this XML is the greater than symbol. The rest were international characters.
Perhaps that is the problem?
Perhaps there is an international characters problem?
I am quite sure that these characters are all UTF-8 because when I open up this xml file in firefox, It displays correctly, and in checking the character encoding, firefox reports UTF-8.
In order to provide an un-garbled xml file, I will provide it at this link:
link to xml file: [http://sean.freeshell.org/java/less2.xml]
Again, sorry for any hassle and/or delay with my reply, or poor reply. I did not mean to waste anyones time.
It will be appreciated however if an answer can be found for this problem. Chiefly,
1. Is this a bug?
2. Is the XML correct? (if not, then all those websites i've been reading are giving false information? )
Kindest Regards,
Sean
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
public class Example
    public static void main(String[] argv)
          try
               FileInputStream fis = new FileInputStream("/home/sean/Desktop/chris/less2.xml");
             Document doc = DocumentBuilderFactory.newInstance()
             .newDocumentBuilder()
             .parse(new InputSource(fis));
               Element root = doc.getDocumentElement();
               NodeList textnodes = root.getElementsByTagName("text");
               int len = textnodes.getLength();
               int index = 0;
               int attindex = 0;
               int attrlen = 0;
               NamedNodeMap attrs = null;
               while (index<len)
                    Element te = (Element)textnodes.item(index);
                    attrs = te.getAttributes();
                    attrlen = attrs.getLength();
                    attindex = 0;
                    Node node = null;
                    while (attindex<attrlen)
                         node = attrs.item(attindex);          
                         System.out.println("attr: "+node.getNodeName()+ " is shown holding value: " + node.getNodeValue());
                         attindex++;                         
                    index++;
                    System.out.println("-------------");
             fis.close();
          catch(Exception e)
               System.out.println("we've had an exception, type "+ e);
}  [example xml file|http://sean.freeshell.org/java/less2.xml]
FOR THE XML, Please see link above, as it is UTF-8, and this page is not. Edited by: svaens on Apr 7, 2008 7:03 AM
Edited by: svaens on Apr 7, 2008 7:23 AM
Edited by: svaens on Apr 7, 2008 7:37 AM
Edited by: svaens on Apr 7, 2008 7:41 AM

Similar Messages

  • XML Parsing - problem with a value of an element if starting with space

    Hi Experts,
    I need your valuable guidence to get out of a problem in parsing an XML file.
    An XML file is read into xstring variable and it is processed to be split into the corresponding itab.
    Please find the code below
    types: begin of ty-itab,
                field(4096),
              end of ty-itab.
    Data:
    g_ixml                       TYPE REF TO if_ixml,
    g_ixmldocument               TYPE REF TO if_ixml_document,
    g_ixmlstreamfactory          TYPE REF TO if_ixml_stream_factory,
    g_ixmlstream                 TYPE REF TO if_ixml_istream,
    g_ixmlparser              TYPE REF TO if_ixml_parser,
    g_ixmlnodemainlist        TYPE REF TO if_ixml_node_list,
    g_ixmlnodelistmainelement TYPE REF TO if_ixml_node_list,
    g_sxmldata                TYPE string,
    g_ixmlnode                TYPE REF TO if_ixml_node.
      DATA: wa_xmltab TYPE xstring,
                itab type table of ty-itab.
    OPEN DATASET l_file IN BINARY MODE FOR INPUT MESSAGE v_msg.
    READ DATASET l_file INTO wa_xmltab.
    PERFORM f_create_xmltable USING wa_xmltab
                                  CHANGING v_msg.
    IF NOT v_msg IS INITIAL.
          msg = v_msg.
          EXIT.
        ELSE.
          itab[] = it_xmldata[].
        ENDIF.
    CLOSE DATASET l_file.
    Subroutine to convert xstring to char type ITAB.
    FORM f_create_xmltable USING  value(pi_inputxmlstring) TYPE xstring
                           CHANGING v_msg.
    *-- create the main factory
      g_ixml = cl_ixml=>create( ).
    *-- create the initial document
      g_ixmldocument = g_ixml->create_document( ).
    *-- create the stream factory
      g_ixmlstreamfactory = g_ixml->create_stream_factory( ).
    *create input stream
      g_ixmlstream = g_ixmlstreamfactory->create_istream_xstring( string =
    pi_inputxmlstring ).
    *-- create the parser
      g_ixmlparser = g_ixml->create_parser( stream_factory =
    g_ixmlstreamfactory
                                      istream        = g_ixmlstream
                                      document       = g_ixmldocument ).
    *-- parse the stream
      IF g_ixmlparser->parse( ) NE 0.
    *if parser cannot be created then give error exit
        IF g_ixmlparser->num_errors( ) NE 0.
          EXIT.
        ENDIF.
      ENDIF.
    *-- we don't need the stream any more, so let's close it...
      CALL METHOD g_ixmlstream->close( ).
      CLEAR g_ixmlstream.
    *get the number of main nodes of the XML document
      g_ixmlnodemainlist = g_ixmldocument->get_children( ).
    *set number of elemtns
      g_inummainelements = 0.
      g_imainelementsctr = 0.
      g_inummainelements = g_ixmlnodemainlist->get_length( ).
      g_ifirstlevelctr = 0.
    *loop through the document till all have nodes have been covered.
      WHILE g_ifirstlevelctr LT g_inummainelements.
    *get the first node
        g_ixmlnode = g_ixmlnodemainlist->get_item( g_ifirstlevelctr ).
    *check the type of node
        g_isnodeelement = g_ixmlnode->get_type( ).
    *if node is not of type Element then continue
    *because we have got to read only text from element nodes.
        IF g_isnodeelement NE c_nodeelement.
          g_ifirstlevelctr = g_ifirstlevelctr + 1.
          CONTINUE.
        ENDIF.
    *get nodes of the element just found.
        g_ixmlnodelistmainelement = g_ixmlnode->get_children( ).
    *get number of children of main element
        g_inumchildelements = g_ixmlnodelistmainelement->get_length( ).
    *loop trhough the number of children
        WHILE g_imainelementsctr LT g_inumchildelements.
          g_ixmlnodemainelement = g_ixmlnodelistmainelement->get_item(
        g_imainelementsctr ).
    *get type of node
          g_isnodeelement = g_ixmlnodemainelement->get_type( ).
          IF g_isnodeelement NE c_nodeelement.
            g_imainelementsctr = g_imainelementsctr + 1.
            CONTINUE.
          ENDIF.
    *get name of the node.
          g_selementvalue = g_ixmlnodemainelement->get_name( ).
    *get children of node
          g_childnodelist = g_ixmlnodemainelement->get_children( ).
          g_inumchildren =  g_childnodelist->get_length( ).
          g_ichildelementcounter = 0.
    *while there are number of children of node.loop through
          WHILE g_ichildelementcounter LT g_inumchildren.
    *get the child node
            g_childnode = g_childnodelist->get_item(
    g_ichildelementcounter ).
    *check the type of node
            g_isnodeelement = g_childnode->get_type( ).
    *if node is not of element type continue
            IF g_isnodeelement NE c_nodeelement.
              g_ichildelementcounter = g_ichildelementcounter + 1.
              CONTINUE.
            ENDIF.
    *otherwise get element name
            g_selementname = g_childnode->get_name( ).
    *get value stored in this node.
            g_selementvalue = g_childnode->get_value( ).
            g_numelem = g_inumchildren - 1.
            IF g_ichildelementcounter EQ g_numelem.
              CONCATENATE: g_slinedata g_selementvalue
                      INTO g_slinedata.
            ELSE.
    *      store the value of noide in delimiter ~ line
    *      Check for Invalid characters in file
                IF g_selementvalue CA '&'.
                  REPLACE ALL OCCURRENCES OF '&amp;' IN g_selementvalue WITH
                endif.
    *if value contains delimiter then error
                IF g_selementvalue CA '~'.             
                  V_MSG = text-003.
                  EXIT.
                ELSE.
                  CONCATENATE: g_slinedata g_selementvalue '~'  .
                  INTO g_slinedata.
                ENDIF.
            ENDIF.
    *continue
            g_ichildelementcounter = g_ichildelementcounter + 1.
          ENDWHILE.
          g_ichildelementcounter = 0.
    *increment the main element counter by one to go to the next node
          g_imainelementsctr = g_imainelementsctr  + 1.
    *move the current delimiter line creted to internal table to be given
    *back to the calling program
          MOVE g_slinedata TO wa_xmldata-data.
          APPEND wa_xmldata TO it_xmldata.
          MOVE '' TO g_slinedata.
          MOVE '' TO wa_xmldata-data.
        ENDWHILE.
    *increment counter to move to hte next node.
        g_ifirstlevelctr = g_ifirstlevelctr + 1.
        g_imainelementsctr = 0.
      ENDWHILE.
    ENDFORM.                    "f_create_xmltable
    XML structure
    <?xml version="1.0" encoding="utf-8"?>
    <ABCInbound xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\XYZSchema\ABCInbound.xsd">
    <HH>
    <RecordType>HH</RecordType>
    <Source>ABC</Source>
    <Destination>XYZ</Destination>
    <TimeStamp>20050909220546</TimeStamp>
    </HH>
    <BH>
    <RecordType>BH</RecordType>
    <DocType>AB</DocType>
    <Reference>2205516125</Reference>
    <DocumentDate>20080909</DocumentDate>
    <PostingDate></PostingDate>
    <CompanyCode>ABC</CompanyCode>
    <Currency>INR</Currency>
    <ExchangeRate>1.0000</ExchangeRate>
    <Park></Park>
    <ItemNumber>2</ItemNumber>
    </BH>
    <BL>
    <RecordType>BL</RecordType>
    <Reference>2205516125</Reference>
    <RefLineItem>1</RefLineItem>
    <AcctType>K</AcctType>
    <DrCrIndicator>H</DrCrIndicator>
    <Account>01000003</Account>
    <Amount>364.00</Amount>
    <VendorName-1>TOM &amp; JERRY IS MY</VendorName-1>
    <VendorName-2> NAME TO BE PAID</VendorName-2>
    <VendorName-3>1987566Z</VendorName-3>
    <VendorName-4>22</VendorName-4>
    <Street>UCX STREET</Street>
    <City>ROAD 4</City>
    <PostalCode>515004</PostalCode>
    <Country>IND</Country>
    <ContactPerson></ContactPerson>
    <AlternatePayeeCode></AlternatePayeeCode>
    <AlternatePayeeName-1></AlternatePayeeName-1>
    <AlternatePayeeName-2></AlternatePayeeName-2>
    <AlternatePayeeName-3></AlternatePayeeName-3>
    <PaymentTerms></PaymentTerms>
    <BaselineDate></BaselineDate>
    <PaymentMethods></PaymentMethods>
    <Allocation></Allocation>
    <LineItemText>item text</LineItemText>
    <TaxCode></TaxCode>
    <TaxAmount>0.00</TaxAmount>
    <WHTaxCode></WHTaxCode>
    <WHTaxbase>0.00</WHTaxbase>
    <Fund></Fund>
    <FundCenter></FundCenter>
    <CostCenter></CostCenter>
    <InternalOrder></InternalOrder>
    <TaxAutomatically></TaxAutomatically>
    <SpecialGLIndicator></SpecialGLIndicator>
    </BL>
    <TT>
    <RecordType>TT</RecordType>
    <TotalRecords>1</TotalRecords>
    <TotalValue>222</TotalValue>
    </TT>
    </ABCInbound>
    when the above xml file is read and populated into ITAB, for element vendorname-2 which has a space in first position , that space is ignored.
    This is being used for a FB01 posting and vendor is paid based on Name1+Name2 printed on cheque and due to the space ignoring problem, the vendor name is displayed wrongly thus causing problems.
    I appreciate if someone could guide me thru and help me in solving this problem.
    How to preserve the leading or trailing space.
    g_selementvalue = g_childnode->get_value( ).
    when i check g_selementvalue, space is ignored.
    i will be greateful if someone could guide me through.
    Regards,
    Simha
    Edited by: Simha on Dec 11, 2008 10:49 AM

    0.02: A C C E P T: Request="NEXT"
    0.06: Fetch session state from database
    0.08: ...Check session ... owner
    0.08: ...Metadata: Fetch Page, Computation, Process, and Branch
    0.08: Session: Fetch session header information
    0.08: ...Metadata: Fetch page attributes for application ..., page 330
    0.08: ...Validate item page affinity.
    0.08: ...Validate hidden_protected items.
    0.08: ...Check authorization security schemes
    0.08: Session State: Save form items and p_arg_values
    0.08: ...Session State: Save "P330_PROJECT" - saving same value: ""
    0.09: ...Session State: Saved Item "P330_SHUTTLE" New Value=""
    0.09: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
    0.09: Branch point: BEFORE_COMPUTATION
    0.09: Computation point: AFTER_SUBMIT
    0.09: Tabs: Perform Branching for Tab Requests
    0.09: Branch point: BEFORE_VALIDATION
    0.09: ...Evaluating Branch: BEFORE_VALIDATION type: "REDIRECT_URL" button: 12904321314585385 branch: (Unconditional)
    0.09: Perform validations:
    0.09: ...Item Not Null Validation: P330_SHUTTLE
    0.09: ...Validation did NOT pass
    This is from debugging, what does the point "0.09: ...Session State: Saved Item "P330_SHUTTLE" New Value="" "
    mean ? I think it means, that the Shuttle somehow sets itself to null ?! but i dont understand why...
    There is no computation or anything that deletes the shuttle, the page is quite small, there is not much more than the shuttle and the validations and computations to give default value and transforming the shuttle items into a collection to continue working with the IDs.
    I dont check whats the problem
    Edited by: user12154443 on 21.07.2010 09:47

  • XML parser working with MediaWiki API

    I have a little helper for a MediaWiki server. It intended to work the following way:
    Client side [GWT] &#8592;rpc&#8594; Server side [GWT] — JWBF &#8592;http&#8594; MediaWiki API+
    GWT - Google Web Toolkit 2.0.4
    JWBF - Java Wiki Bot Framework 1.3.2
    MediaWiki 1.16 XML
    JDK1.6.0_21
    GWT sends and receive utf-8 data between client and server well. But the second half fails to work with its own xml traffic.
    JWBF gets the xml file via HTTP (log4j logging):
    [DefaultClientConnection  ] Receiving response: HTTP/1.1 200 OK
    [headers                  ] << HTTP/1.1 200 OK
    [headers                  ] << Date: Thu, 09 Sep 2010 17:36:34 GMT
    [headers                  ] << Server: Apache/2.2.4 (Win32) mod_ssl/2.2.4 OpenSSL/0.9.8e PHP/5.2.4
    [headers                  ] << X-Powered-By: PHP/5.2.4
    [headers                  ] << Cache-Control: private
    [headers                  ] << Vary: Accept-Encoding
    [headers                  ] << Content-Length: 1177
    [headers                  ] << Keep-Alive: timeout=5, max=95
    [headers                  ] << Connection: Keep-Alive
    [headers                  ] << Content-Type: text/xml; charset=utf-8
    [DefaultRequestDirector   ] Connection can be kept alive for 5000 ms
    [wire                     ] << "<?xml version="1.0"?><api><query><pages><page pageid="103" ns="0" title="Bronenosets Potyomkin"><revisions><rev revid="503" parentid="502" user="Anton" timestamp="2010-09-09T09:26:34Z" comment="Undo revision 502" xml:space="preserve">[\n]"
    [wire                     ] << "The Battleship Potemkin ([0xd0][0x91][0xd1][0x80][0xd0][0xbe][0xd0][0xbd][0xd0][0xb5][0xd0][0xbd][0xd0][0xbe][0xd1][0x81][0xd0][0xb5][0xd1][0x86] [0xc2][0xab][0xd0][0x9f][0xd0][0xbe][0xd1][0x82][0xd1][0x91][0xd0][0xbc][0xd0][0xba][0xd0][0xb8][0xd0][0xbd][0xc2][0xbb]) is a film.[\n]"
    [wire                     ] << "[\n]"
    [wire                     ] << "The Odessa Steps sequence editing.</rev></revisions></page></pages></query><query-continue><revisions rvstartid="502" /></query-continue></api>"
    [SingleClientConnManager  ] Releasing connection org.apache.http.impl.conn.SingleClientConnManager$ConnAdapter@dfb098And Java XML parser fails to understand this xml and returns the string as it was ISO-8859-1. After the xml bases a class with SAXBuilder, name in brackets, the one within "rev" element, becomes:
    БроненоÑ&#65533;ец «Потёмкин»while it should be
    &#1041;&#1088;&#1086;&#1085;&#1077;&#1085;&#1086;&#1089;&#1077;&#1094; «&#1055;&#1086;&#1090;&#1105;&#1084;&#1082;&#1080;&#1085;»The whole system (Apache, MediaWiki plus JWBF, GWT, client HTML) is set to utf-8, but Java parser (default settings) still does not agree.
    Dear specialists, where could be the error?

    The problem's been found thanks to DrClap ( [XML converted to string - encoding lost?|http://forums.sun.com/thread.jspa?threadID=610257] ).
    JWBF read the HTTP stream using system's default encoding:
           +Line 216 in jwbf-1.3.2-262\src\net\sourceforge\jwbf\core\actions\HttpActionClient.java+
    BufferedReader br = new BufferedReader(new InputStreamReader(res.getEntity().getContent()));From here the whole chain got the wrongly encoded string, including XML parser.
    So, the solution is to define the encoding explicitly:
    BufferedReader br = new BufferedReader(new InputStreamReader(res.getEntity().getContent(), "UTF-8"));Thank to the community.

  • Xml Parse throws SaxParseException.Encoding is UTF-8 insteadof ISO-8859-1 ?

    Hi All,
    I'm having some korean characters in my xml. when i tried to parse the xml i'm getting SaxParseException .
    <?xml version="1.0" encoding="UTF-8"?> --- Throwing Exception
    <?xml version="1.0" encoding="ISO-8859-1"?> --- No Exception, successfully parsed
    I'm not sure why UTF-8 is failing and ISO is passing. But I'm always getting xml with UTF-8 format? Can anyone know the reason?
    I also like to know the differences between UTF-8 and ISO, i don't find any good article/document for this.
    Thanks,
    J.Kathir

    When SAX throws an exception when the encoding is set to UTF-8, then the XML contains something that is not a valid UTF-8 code (i.e. your source file is not encoded using UTF-8). Also: whenever you ask about an exception you should definitely post the entire exception, including message and stack trace.
    If it doesn't throw an exception when it is set to ISO-8859-1, then it does not mean that this is the correct choice. ISO-8859-1 is defined from 0 up to 255, so any byte stream is correct in that encoding ('though not necessarily meaninful).
    You absolutely have to find out which encoding the file really is, before you can parse it. If it should contain Korean characters then it is definitely not ISO-8859-1 (or any other encoding from the ISO-8859 family), as those only support latin, cyrillic and similar scripts.

  • 10g Upgrade - XML Parser errors with certain escape codes (&#x0338)

    NLS_CHARACTERSET = WE8ISO8859P15
    NLS_NCHAR_CHARACTERSET = AL16UTF16
    Since our 10.2.0.3.0 upgrade (from 9.2.0.1.0) our xml fails with the following message:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00217: invalid character 824 (U+0338)
    Error at line 4
    We are using escape codes in our xml that have worked fine on 9i. Example xml:
    <PRINT_LAYOUT_FOOTER>&#x0338;&#x0338;&#x0338;&#x0338;This map was created with Promap</PRINT_LAYOUT_FOOTER>
    I am completely flummoxed - Any ideas?

    You've switched from a Java Based Parser to a 'C' based parser, which is much, much faster. However one of the requirements of the 'C' implementation is that all characters in the database character set. I'm guessing that if you switch to AL32UTF8 for the database character set the problem will go away. BTW 9.2.0.1.0 was desupported for XML related features when 9.2.0.3.0 was released.

  • XML parser clashes with WL 5.1

    Hello,
    I see that this question has been asked before but I've seen no answer so
    far. We have code that requires an XML parser. We currently us
    jaxp/xerces/xalan. The version we use is more recent than the one
    included in WL5.1.9. Because of this, we are getting NoClassDefFound
    exceptions when deploying our apps. Or sometimes we get "No such method"
    exceptions. Is there a way, short of getting the sources to all our
    packages and changing the package name, to have more recent XMP parser
    coexist with those of WL?
    If not, what are the versions of the third-party jars bundled with WL
    5.1.9? Is that information documented somewhere? We may also try to
    back-port our code so it confirms to whatever version is included in WL.
    Thanks,
    L
    Laurent Duperval <mailto:[email protected]>
    La situation se cornélise à vue d'oeil!
    -Alambic Talon

    I have seen and dealt with this before.
    I had three versions of Xerces in my classpath. I find that I have to put
    the newest jar file in the front of the classpath. I had Xalan.jar and
    Xerces.jar followed by XML4J followed at the end by weblogicaux.jar and my
    application worked well. You can also make use of the WEB-INF/lib directory
    of your application though I didn't get down to that details and solved my
    methodNotFound problem by modifing the main Classpath.
    Hope that helps.
    IH
    "Laurent Duperval" <[email protected]> wrote in message
    news:3b1e30b6$[email protected]..
    Hello,
    I see that this question has been asked before but I've seen no answer so
    far. We have code that requires an XML parser. We currently us
    jaxp/xerces/xalan. The version we use is more recent than the one
    included in WL5.1.9. Because of this, we are getting NoClassDefFound
    exceptions when deploying our apps. Or sometimes we get "No such method"
    exceptions. Is there a way, short of getting the sources to all our
    packages and changing the package name, to have more recent XMP parser
    coexist with those of WL?
    If not, what are the versions of the third-party jars bundled with WL
    5.1.9? Is that information documented somewhere? We may also try to
    back-port our code so it confirms to whatever version is included in WL.
    Thanks,
    L
    Laurent Duperval <mailto:[email protected]>
    La situation se cornélise à vue d'oeil!
    -Alambic Talon

  • XML parsing problems with Oracle XML parser for PL/SQL

    I am using the Oracle XML parser for PL/SQL to transform XML into HTML usign XSL. The parser gives me sporadic errors trying to parse various XML documents. For the same XML source, the XMLPARSER will parse without errors one day and the next day will give me errors such as "invalid char in text", "Expected ';'.", or even Java null pointer exceptions.
    I have verified that the XML sources are well formed, so I am pretty certain that the problems I am having are bugs in the XMLPARSER.
    Is there going to be a XML parser for PL/SQL version 2 that will fix these bugs? If so, when??? If not, is there anything else I could do to fix these problems?
    Thanks!

    You can use the latest version.

  • OES Client causes XML Parser Issue with Spring 3 Framework WAR

    Dear All,
    OES Client has been installed in the linux OS and configured JAVA SM in it. Have executed the sample webpage in the tomcat server which contains the 'PepResponse' of getting the authorization value (TRUE / FALSE) and it works fine.
    Code snippet:-
    PepResponse result = PepRequestFactoryImpl.getPepRequestFactory().newPepRequest(user, action, resourceString, null).decide();
    out.println("Result: "+ result.allowed());
    It returns the proper value if I mention the oes-client.jar classpath reference in the tomcat classpath settings, but at the same time the existing spring framework WAR file is not deployed in the tomcat. The same WAR file is deploying properly if I remove the classpath reference of oes-client.jar from the tomcat configuration.
    The issue causes because of xmlparser2.jar(oracle.xdk11.1.1.1) in the oes client.
    Have tried all the alternate approaches and failed to execute both the code together.
    Note:- One of the approach, I have tried to copy xcersImpl.jar and xml-apis.jar in the WEB-INF/lib within the war file and also executed oes authorization sample web page simultaneously with referred oes-client.jar classpath reference. The WAR file is started deploy properly and OES Authorization sample webpage has thrown 'Null Pointer Exception'.
    Anyone, please suggest how to resolve the JAR conflict issue between the OES Client and Spring Framework WAR.

    Hi, I got registered to this bea forms, can you help on where to go for posting new blog.
    Weblogic Consultant

  • WebService response object in XML - parsing attributes

    Hi- new to Flex and I'm trying to parse out the attributes of the response object. I can get the entire object and see that its working, but I cant get just a single attribute. It pulls weather info for world cities. For example, I just want the location name and temperature.
    Any advice on this? Thanks!
    <?xml version="1.0"?>
    <!-- fds\rpc\RPCResultFaultMXML.mxml -->
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                    xmlns:s="library://ns.adobe.com/flex/spark">
        <mx:Script>
            <![CDATA[
                import mx.rpc.soap.SOAPFault;        
                import mx.rpc.events.ResultEvent;
                import mx.rpc.events.FaultEvent;
                import mx.controls.Alert;
                import mx.utils.ObjectUtil;
                public function showErrorDialog(event:FaultEvent):void {
                    // Handle operation fault.
                    Alert.show(event.fault.faultString, "Error");
                public function defaultFault(event:FaultEvent):void {
                    // Handle service fault.
                    if (event.fault is SOAPFault) {
                        var fault:SOAPFault=event.fault as SOAPFault;
                        var faultElement:XML=fault.element;
                        // You could use E4X to traverse the raw fault element returned in the SOAP envelope.
                    Alert.show(event.fault.faultString, "Error");              
                public function log(event:ResultEvent):void {
                    // Handle result.
                    trace(event.result);
                    //trace(ObjectUtil.toString(event.result));
                    //var len:int;
                    //len = event.result.length;
                    //trace(len);
                    //trace(event.result);
                    //trace(event.result.GetWeatherResponse.Location);
                    //var myXML:XML = new XML(event.result);
                    //trace(myXML.attribute("Location"));
            ]]>
        </mx:Script>
        <mx:WebService id="WeatherService" wsdl="http://www.webservicex.com/globalweather.asmx?wsdl"
                       fault="defaultFault(event)">
            <mx:operation name="GetWeather"
                          fault="showErrorDialog(event)"
                          result="log(event)"
                          resultFormat="xml">
                <mx:request>
                    <CityName>{myCity.text}</CityName>
                    <CountryName>{myCountry.text}</CountryName>
                </mx:request>
            </mx:operation>
        </mx:WebService>
        <mx:TextInput id="myCity" text="Madrid"/>
        <mx:TextInput id="myCountry" text="Spain"/>
        <!-- Call the web service operation with a Button click. -->
        <mx:Button width="60" label="Get Weather"
                  click="WeatherService.GetWeather.send();"/>
        <!-- Display the Weather -->
        <mx:Label text="Weather:"/>
        <mx:TextArea text="{WeatherService.GetWeather.lastResult}" height="200"/>
    </mx:Application>

    The WSDL says GetWeatherResponse is a string, and it appears to be a string of XML, so set <mx:operation resultFormat="object"> as this will unwrap the SOAP response value and leave a string typed value intact. You can then create a new ActionScript 3.0 E4X-based XML instance from the unwrapped string:
        var myXML:XML = new XML(event.result.toString());
    You can then travese the XML document using E4X syntax, a simple example is included below:
        trace(myXML..Location);
        trace(myXML..Temperature);

  • XML Parsing issue with same tag names at multiple levels.

    My XML has the same tag name , ID at different levels in the XML.
    <InventorySearch>
    <*ID*>ID1</*ID*>
    <interactionDate>2012-09-01T10:30:00Z</interactionDate>
    <DescribedBy>
    <value>Cycle Count extract</value>
    <Characteristic>
    <*ID*>ID2</*ID*>
    </Characteristic>
    </DescribedBy>
    <type>Cycle Count</type>
    <InventorySearchComprisedOf>
    <*ID*>ID3</*ID*>
    <quantity>
    <amount>1</amount>
    <units>EACH</units>
    </quantity>
    <itemDateComplete>2012-09-07T10:30:00Z</itemDateComplete>
    <itemStatus>Open</itemStatus>
    </InventorySearchComprisedOf>
    </InventorySearch>
    When I use the Extract function with XML Sequence, I am getting all the ID values concatenated.
    select extract(value(d),'//ID/text()').getstringval() as id1,
    extract(value(e),'//ID/text()'). getstringval() as id2
    from xxnbn_cc_response_xml_stg x,
    table(xmlsequence(extract(x.xml_column,'/InventorySearch'))) d,
    table(XMLSEQUENCE(extract(D.column_value,'//InventorySearchComprisedOf')))(+) E;
    Return values :
    ID1 - ID1ID2ID3
    ID2 - ID3
    Is this the right way to parse this type of XML?

    The answer would depend upon your version of Oracle
    select * from v$version
    and the desired result set you want to see.
    If you are 10.2 or later, than XMLTable would be easier to write, but I won't go that way until we know more about what you want to see.

  • Xml parsing issue with the existsnode function

    Hi Friends,
    I have a question as like below
    We have the contacts and alternate contacts request as like below.
    <TXLife>
    <UserAuthRequest>
    <UserLoginName>hqtest24</UserLoginName>
    <UserDate>2012-07-11</UserDate>
    <UserTime>12:42:55</UserTime>
    </UserAuthRequest>
    <TXLifeRequest>
    <TransRefGUID>0c95642d-663a-455f-bd92-aca678538986</TransRefGUID>
    <TransType tc="1204">OLI_TRANS_TRNPARTY</TransType>
    <TransExeDate>2012-07-11</TransExeDate>
    <TransExeTime>12:42:55</TransExeTime>
    <InquiryLevel tc="3">OLI_INQUIRY_OBJRELOBJ</InquiryLevel>
    <InquiryView>
    <InquiryViewCode>INTERMEDIARYUPDATE-CHBM-1204A</InquiryViewCode>
    </InquiryView>
    <OLifE>
    <SourceInfo>
    <SourceInfoName>CHBM Admin Tool</SourceInfoName>
    </SourceInfo>
    <Party id="Intermediary1">
    <PartyTypeCode tc="2">OLI_PT_ORG</PartyTypeCode>
    <PartySysKey SystemCode="CHBM">111259</PartySysKey>
    <FullName>Example Law Firm test</FullName>
    <Organization>
    <DBA>Example Law Firm test</DBA>
    </Organization>
    <Address>
    <AddressTypeCode tc="2">OLI_ADTYPE_BUS</AddressTypeCode>
    <Line1>20 Yellow Brick Rd</Line1>
    <Line2>Suite 23</Line2>
    <Line3>line 3</Line3>
    <City>wonderland34</City>
    <AddressState>NY</AddressState>
    <Zip>229292</Zip>
    <AddressCountry>US</AddressCountry>
    </Address>
    <Phone>
    <PhoneTypeCode tc="2">OLI_PHONETYPE_BUS</PhoneTypeCode>
    <DialNumber></DialNumber>
    </Phone>
    <Phone>
    <PhoneTypeCode tc="19">OLI_PHONETYPE_FAX</PhoneTypeCode>
    <DialNumber></DialNumber>
    </Phone>
    <Attachment id="Attachment1">
    <DateCreated>2012-07-11</DateCreated>
    <UserCode>hqtest24</UserCode>
    <AttachmentBasicType tc="1">Text</AttachmentBasicType>
    <AttachmentSource>ATTORNEY</AttachmentSource>
    <Description>INTERMEDIARY TYPE UPDATED</Description>
    <AttachmentData>Attorney</AttachmentData>
    <AttachmentType tc="1009800001">Transaction Log</AttachmentType>
    <AttachmentLocation tc="1">Inline</AttachmentLocation>
    <OLifEExtension VendorCode="0098" ExtensionCode="Attachment">
    <AttachmentExtension>
    <CreationTime>12:42:55</CreationTime>
    <Sequence>1</Sequence>
    </AttachmentExtension>
    </OLifEExtension>
    </Attachment>
    <Attachment id="Attachment2">
    <DateCreated>2012-07-11</DateCreated>
    <UserCode>hqtest24</UserCode>
    <AttachmentBasicType tc="1">Text</AttachmentBasicType>
    <AttachmentSource>James</AttachmentSource>
    <Description>ALTERNATE CONTACT FIRST NAME UPDATED</Description>
    <AttachmentType tc="1009800001">Transaction Log</AttachmentType>
    <AttachmentLocation tc="1">Inline</AttachmentLocation>
    <OLifEExtension VendorCode="0098" ExtensionCode="Attachment">
    <AttachmentExtension>
    <CreationTime>12:42:55</CreationTime>
    <Sequence>2</Sequence>
    </AttachmentExtension>
    </OLifEExtension>
    </Attachment>
    <Attachment id="Attachment3">
    <DateCreated>2012-07-11</DateCreated>
    <UserCode>hqtest24</UserCode>
    <AttachmentBasicType tc="1">Text</AttachmentBasicType>
    <AttachmentSource>Mathew</AttachmentSource>
    <Description>ALTERNATE CONTACT LAST NAME UPDATED</Description>
    <AttachmentType tc="1009800001">Transaction Log</AttachmentType>
    <AttachmentLocation tc="1">Inline</AttachmentLocation>
    <OLifEExtension VendorCode="0098" ExtensionCode="Attachment">
    <AttachmentExtension>
    <CreationTime>12:42:55</CreationTime>
    <Sequence>3</Sequence>
    </AttachmentExtension>
    </OLifEExtension>
    </Attachment>
    <EMailAddress>
    <EMailType tc="1">Business</EMailType>
    <AddrLine></AddrLine>
    </EMailAddress>
    <URL>
    <URLAddr>www.example.com</URLAddr>
    <URLType tc="1">Home Page</URLType>
    </URL>
    </Party>
    <Activity id="Activity1" HoldingID="Intermediary1">
    <UserCode>hqtest24</UserCode>
    <LastUpdate>2012-07-11</LastUpdate>
    <ActivityCode>CHBM10004</ActivityCode>
    <OLifEExtension VendorCode="0098" ExtensionCode="Activity">
    <ActivityExtension>
    <SubActivityCode>CHBM20002</SubActivityCode>
    <LastUpdateTime>12:42:55</LastUpdateTime>
    </ActivityExtension>
    </OLifEExtension>
    </Activity>
    <Party id="Contact1">
    <PartyTypeCode tc="1">OLI_PT_PERSON</PartyTypeCode>
    <PartySysKey>555223</PartySysKey>
    <Person>
    <FirstName>Jack</FirstName>
    <LastName>Scarecrow23</LastName>
    </Person>
    <Phone>
    <PhoneTypeCode tc="2">OLI_PHONETYPE_BUS</PhoneTypeCode>
    <DialNumber>2223993993</DialNumber>
    </Phone>
    <Phone>
    <PhoneTypeCode tc="19">OLI_PHONETYPE_FAX</PhoneTypeCode>
    <DialNumber>2223392020</DialNumber>
    </Phone>
    <EMailAddress>
    <EMailType tc="1">Business</EMailType>
    <AddrLine>[email protected]</AddrLine>
    </EMailAddress>
    </Party>
    <Relation id="Relation1" OriginatingObjectID="Intermediary1" RelatedObjectID="Contact1">
    <RelationRoleCode tc="150">Authorized Person</RelationRoleCode>
    </Relation>
    <Relation id="Relation1" OriginatingObjectID="Intermediary1">
    <RelationRoleCode tc="104">Intermediary</RelationRoleCode>
    <RelationDescription tc="42">Attorney</RelationDescription>
    </Relation>
    <Party id="Contact2">
    <PartyTypeCode tc="1">OLI_PT_PERSON</PartyTypeCode>
    <PartySysKey>556915</PartySysKey>
    <Person>
    <FirstName/>
    <LastName/>
    </Person>
    <Phone>
    <PhoneTypeCode tc="2">OLI_PHONETYPE_BUS</PhoneTypeCode>
    <DialNumber>2343434</DialNumber>
    </Phone>
    <Phone>
    <PhoneTypeCode tc="19">OLI_PHONETYPE_FAX</PhoneTypeCode>
    <DialNumber>45345345</DialNumber>
    </Phone>
    <EMailAddress>
    <EMailType tc="1">Business</EMailType>
    <AddrLine>[email protected]</AddrLine>
    </EMailAddress>
    </Party>
    <Relation id="Relation4" OriginatingObjectID="Intermediary1" RelatedObjectID="Contact2">
    <OriginatingObjectType tc="6">Party</OriginatingObjectType>
    <RelatedObjectType tc="6">Party</RelatedObjectType>
    <RelationRoleCode tc="150">Authorized Person</RelationRoleCode>
    <InterestPercent>-1.0</InterestPercent>
    <Sequence>2</Sequence>
    </Relation>
    </OLifE>
    </TXLifeRequest>
    </TXLife>
    From the above request we have to parse the alternate contact details.
    In the procedure we are using as like below
    FOR b IN (
    SELECT t.vAltCntcity vAltCntcity,
    t.Partysyskey Partysyskey,
    t.vAltCntZip vAltCntZip,
    t.vAltCntGovtID vAltCntGovtID,
    t.vAltCntTelno vAltCntTelno,
    t.vAltCntemailaddr vAltCntemailaddr,
    t.vAltCntstats vAltCntstats,
    t.vAltCntAdd1 vAltCntAdd1,
    t.vAltCntAdd2 vAltCntAdd2,
    t.vAltCntAdd3 vAltCntAdd3,
    t.AltCntstate AltCntstate,
    t.AltCntcntry AltCntcntry,
    t.vAltCntBRTH_DT vAltCntBRTH_DT,
    t.vAltCntGender vAltCntGender,
    t.vAltCntFaxno vAltCntFaxno,
    t.vAltCnturladdr vAltCnturladdr,
    t.AltCntorgFST_NM AltCntorgFST_NM,
    t.AltCntorgLST_NM AltCntorgLST_NM,
    t.AltCntorgMID_NM AltCntorgMID_NM,
    t.AltCntorgPFX_NM AltCntorgPFX_NM,
    t.AltCntorgSUFX_NM AltCntorgSUFX_NM,
    t.AltCntpartytypecode AltCntpartytypecode,
    t.vAltCntdatarep vAltCntdatarep,
    t1.vAltCntInterestPercent vAltCntInterestPercent,
    t1.ROID ROID
    FROM (
    SELECT xData doc FROM dual ) temp_table,
    XMLTable ( '/TXLife/TXLifeRequest/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]' passing doc
    COLUMNS OOID varchar2(50) path '@OriginatingObjectID'
    , ROID varchar2(50) path '@RelatedObjectID'
    , vAltCntInterestpercent varchar2(100) path 'InterestPercent'
    )t1,
    XMLTable('/Party[@id=$roid]' passing vAltcnt, t1.roid as "roid"
    COLUMNS
    vAltCntcity VARCHAR2(20) path 'City',
    Partysyskey VARCHAR2(100) path 'PartySysKey',
    vAltCntZip VARCHAR2(20) path 'Address/Zip',
    vAltCntGovtID VARCHAR2(20) path 'GovtID',
    vAltCntTelno VARCHAR2(20) path 'Phone[PhoneTypeCode/@tc=2]/DialNumber',
    vAltCntemailaddr VARCHAR2(200) path 'EMailAddress/AddrLine',
    vAltCntstats varchar2(20) path 'Client/ClientStatus/@tc',
    vAltCntAdd1 varchar2(1000) path 'Address/Line1',
    vAltCntAdd2 varchar2(1000) path 'Address/Line2',
    vAltCntAdd3 varchar2(1000) path 'Address/Line3',
    AltCntstate varchar2(100) path 'Address/AddressState',
    AltCntcntry varchar2(100) path 'Address/AddressCountry',
    vAltCntBRTH_DT date path 'Person/BirthDate',
    vAltCntGender char(1) path 'Person/Gender/@tc',
    vAltCntFaxno varchar2(100) path 'Phone[PhoneTypeCode/@tc=19]/DialNumber',
    vAltCnturladdr varchar2(100) path 'URL/URLAddr',
    AltCntorgFST_NM varchar2(100) path 'Person/FirstName',
    AltCntorgLST_NM varchar2(100) path 'Person/LastName',
    AltCntorgMID_NM varchar2(100) path 'Person/MiddleName',
    AltCntorgPFX_NM varchar2(100) path 'Person/Prefix',
    AltCntorgSUFX_NM varchar2(100) path 'Person/Suffix',
    AltCntpartytypecode varchar2(10) path 'PartyTypeCode/@tc',
    vAltCntdatarep varchar2(100) path '@DataRep'
    ) t
    LOOP
    BEGIN
    SELECT extractvalue(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/Person/FirstName')
    INTO vAltCntFirstnamechk
    FROM TABLE (XMLSEQUENCE (EXTRACT (xData,'/TXLife/TXLifeRequest/OLifE'))) t
    WHERE existsnode(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/Person/FirstName') =1;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    vAltCntFirstnamechkflag:='Y';
    END;
    BEGIN
    SELECT extractvalue(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/Person/LastName')
    INTO vAltCntLastNamechk
    FROM TABLE (XMLSEQUENCE (EXTRACT (xData,'/TXLife/TXLifeRequest/OLifE'))) t
    WHERE existsnode(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/Person/LastName') =1;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    vAltCntLastNamechkflag:='Y';
    END;
    END LOOP;
    Here while parsing the data for contact2(with the request provided) by using the above procedure its going to exception.
    If the value is not there between the firstname then it should not go to the exception.
    If the firstname tag is not there it should go to the exception.
    But in the above procedure for the altcntfirstname and altcntlastname selectstatements its going to the exception part when there is no value for firstname(<FirstName></FirstName>).
    Is there any way to resolve this issue?
    Regards,
    Jyothirmai

    Hi Odie,
    In the request more than one alternate contact used to come(that means contact1 is primary contact,contact2 is alternate contact1,contact3 is alternate contact2 etc).
    We are retrieving the RelatedObjectID and named as ROID in the for loop.
    That means in the for loop we are getting the RelatedObjectID,if that RelatedObjectID is equal to party id then that firstname we are checking by using the below select statement.
    suppose when we used as like below in the loop the same RelatedObjectID(contact2) is repeating every time.
    FOR b IN (
    SELECT t.vAltCntcity vAltCntcity,
    t.Partysyskey Partysyskey,
    t.vAltCntZip vAltCntZip,
    t.vAltCntGovtID vAltCntGovtID,
    t.vAltCntTelno vAltCntTelno,
    t.vAltCntemailaddr vAltCntemailaddr,
    t.vAltCntstats vAltCntstats,
    t.vAltCntAdd1 vAltCntAdd1,
    t.vAltCntAdd2 vAltCntAdd2,
    t.vAltCntAdd3 vAltCntAdd3,
    t.AltCntstate AltCntstate,
    t.AltCntcntry AltCntcntry,
    t.vAltCntBRTH_DT vAltCntBRTH_DT,
    t.vAltCntGender vAltCntGender,
    t.vAltCntFaxno vAltCntFaxno,
    t.vAltCnturladdr vAltCnturladdr,
    t.AltCntorgFST_NM AltCntorgFST_NM,
    t.AltCntorgLST_NM AltCntorgLST_NM,
    t.AltCntorgMID_NM AltCntorgMID_NM,
    t.AltCntorgPFX_NM AltCntorgPFX_NM,
    t.AltCntorgSUFX_NM AltCntorgSUFX_NM,
    t.AltCntpartytypecode AltCntpartytypecode,
    t.vAltCntdatarep vAltCntdatarep,
    t1.vAltCntInterestPercent vAltCntInterestPercent,
    t1.ROID ROID
    FROM (
    SELECT xData doc FROM dual ) temp_table,
    XMLTable ( '/TXLife/TXLifeRequest/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]' passing doc
    COLUMNS OOID varchar2(50) path '@OriginatingObjectID'
    , ROID varchar2(50) path '@RelatedObjectID'
    , vAltCntInterestpercent varchar2(100) path 'InterestPercent'
    )t1,
    XMLTable('/Party[@id=$roid]' passing vAltcnt, t1.roid as "roid"
    COLUMNS
    vAltCntcity VARCHAR2(20) path 'City',
    Partysyskey VARCHAR2(100) path 'PartySysKey',
    vAltCntZip VARCHAR2(20) path 'Address/Zip',
    vAltCntGovtID VARCHAR2(20) path 'GovtID',
    vAltCntTelno VARCHAR2(20) path 'Phone[PhoneTypeCode/@tc=2]/DialNumber',
    vAltCntemailaddr VARCHAR2(200) path 'EMailAddress/AddrLine',
    vAltCntstats varchar2(20) path 'Client/ClientStatus/@tc',
    vAltCntAdd1 varchar2(1000) path 'Address/Line1',
    vAltCntAdd2 varchar2(1000) path 'Address/Line2',
    vAltCntAdd3 varchar2(1000) path 'Address/Line3',
    AltCntstate varchar2(100) path 'Address/AddressState',
    AltCntcntry varchar2(100) path 'Address/AddressCountry',
    vAltCntBRTH_DT date path 'Person/BirthDate',
    vAltCntGender char(1) path 'Person/Gender/@tc',
    vAltCntFaxno varchar2(100) path 'Phone[PhoneTypeCode/@tc=19]/DialNumber',
    vAltCnturladdr varchar2(100) path 'URL/URLAddr',
    AltCntorgFST_NM varchar2(100) path 'Person/FirstName',
    AltCntorgLST_NM varchar2(100) path 'Person/LastName',
    AltCntorgMID_NM varchar2(100) path 'Person/MiddleName',
    AltCntorgPFX_NM varchar2(100) path 'Person/Prefix',
    AltCntorgSUFX_NM varchar2(100) path 'Person/Suffix',
    AltCntpartytypecode varchar2(10) path 'PartyTypeCode/@tc',
    vAltCntdatarep varchar2(100) path '@DataRep'
    ) t
    LOOP
    BEGIN
    SELECT extractvalue(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/@RelatedObjectID][PartyTypeCode/@tc=1]/Person/FirstName')
    INTO vAltCntFirstnamechk
    FROM TABLE (XMLSEQUENCE (EXTRACT (xData,'/TXLife/TXLifeRequest/OLifE'))) t
    WHERE existsnode(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/@RelatedObjectID][PartyTypeCode/@tc=1]/Person/FirstName') =1;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    vAltCntFirstnamechkflag:='Y';
    END;
    end loop;
    For this above code its not going to the exception.we are using this select statement to check whether that node existed or not.
    If that node exists and value is not there, that time we are updating the table with the null value by using the vAltCntFirstnamechkflag value as like below in our procedure.
    IF b.AltCntorgFST_NM IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' FST_NM ='''||b.AltCntorgFST_NM||''''||',';
    ELSIF vAltCntFirstnamechkflag='N' AND vAltCntFirstnamechk IS NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' FST_NM ='''||NULL||''''||',';
    END IF;
    Please find the below procedure what we are using could you please let me know is there any possibility to resolve this issue(if the tag like <firstname></firstname> that
    time also it should not go to the exception).
    CREATE OR REPLACE PROCEDURE CHBM_QA1.PR_CUSTOMERUPDATE(PIN_XML_DATA IN CLOB,po_vResponse OUT clob )
    IS
    xData XMLTYPE:=NULL;
    vActivityCode VARCHAR2(100):=NULL;
    vSubActivityCode VARCHAR2(100):=NULL;
    ncode NUMBER(2):=NULL;
    nErrcode NUMBER(10):=0;
    vInfodesc VARCHAR2(1000):=NULL;
    vStatusinfo VARCHAR2(1000):=NULL;
    vStatus VARCHAR2(100):=NULL;
    vOrgid VARCHAR2(100):=NULL;
    vcity VARCHAR2(100):=NULL;
    vAltCntcity VARCHAR2(20):=NULL;
    vorgcity VARCHAR2(100):=NULL;
    vAddressState VARCHAR2(100):=NULL;
    vZip VARCHAR2(100):=NULL;
    vAltCntZip VARCHAR2(100):=NULL;
    vorgZip VARCHAR2(100):=NULL;
    vGovtID VARCHAR2(100):=NULL;
    vAltCntGovtID VARCHAR2(100):=NULL;
    vorgGovtID VARCHAR2(100):=NULL;
    vFullname VARCHAR2(200):=NULL;
    norgid NUMBER:=0;
    vTelno VARCHAR2(100):=Null;
    vAltCntTelno VARCHAR2(100):=Null;
    vOrgTelno VARCHAR2(100):=null;
    nOrgcnt NUMBER:=0;
    vemailaddr VARCHAR2(200):=null;
    vAltCntemailaddr VARCHAR2(200):=null;
    vorgemailaddr VARCHAR2(200):=null;
    vFISC_YEAR_END_DT VARCHAR2(100);
    vFiscalYearEndMoDaychkflag CHAR(1):='N';
    vFiscalYearEndMoDaychk VARCHAR2(100):=NULL;
    vGovtIDchkflag CHAR(1):='N';
    vGovtIDchk VARCHAR2(100):=NULL;
    vEMailAddresschkflag CHAR(1):='N';
    vEMailAddresschk VARCHAR2(1000):=NULL;
    vDialNumberchkflag CHAR(1):='N';
    vAltCntDialNumberchkflag CHAR(1):='N';
    vDialNumberchk VARCHAR2(100):=NULL;
    vAltCntDialNumberchk VARCHAR2(100):=NULL;
    vFaxnochkflag CHAR(1):='N';
    vAltCntFaxnochkflag CHAR(1):='N';
    vFaxnochk VARCHAR2(100):=NULL;
    vAltCntFaxnochk VARCHAR2(100):=NULL;
    vEMailAddressPchkflag CHAR(1):=NULL;
    vAltCntEMailAddressPchkflag CHAR(1):=NULL;
    vEMailAddressPchk VARCHAR2(200):=NULL;
    vAltCntEMailAddressPchk VARCHAR2(200):=NULL;
    vLastNamechkflag CHAR(1):='N';
    vAltCntLastNamechkflag CHAR(1):='N';
    vFirstNamechkflag CHAR(1):='N';
    vAltCntFirstNamechkflag CHAR(1):='N';
    vTaxidPchkflag CHAR(1):='N';
    vAltCntTaxidPchkflag CHAR(1):='N';
    vBusinessDescchkflag CHAR(1):='N';
    vBusinessDescchk VARCHAR2(2000):=NUll;
    vTaxidPchk VARCHAR2(200):=NULL;
    vAltCntTaxidPchk VARCHAR2(200):=NULL;
    vLastNamechk VARCHAR2(2000):=NULL;
    vAltCntLastNamechk VARCHAR2(2000):=NULL;
    vFirstNamechk VARCHAR2(2000):=NULL;
    vAltCntFirstnamechk VARCHAR2(2000):=NULL;
    vattdate VARCHAR2(50):=NULL;
    dattdate DATE;
    vAdd3Pchkflag CHAR(1):='N';
    vAltCntAdd3Pchkflag CHAR(1):='N';
    vOrgAdd3chkflag CHAR(1):='N';
    vOrgAdd2chkflag CHAR(1):='N';
    vAdd2Pchkflag CHAR(1):='N';
    vAltCntAdd2Pchkflag CHAR(1):='N';
    vOrgAdd3chk VARCHAR2(2000):=NULL;
    vOrgAdd2chk VARCHAR2(2000):=NULL;
    vAdd2Pchk VARCHAR2(2000):=NULL;
    vAltCntAdd2Pchk VARCHAR2(2000):=NULL;
    vAdd3Pchk VARCHAR2(2000):=NULL;
    vAltCntAdd3Pchk VARCHAR2(2000):=NULL;
    nADDR_ID NUMBER:=0;
    cntry VARCHAR2(100):=NULL;
    AltCntcntry VARCHAR2(100):=NULL;
    orgcntry VARCHAR2(100):=NULL;
    vAdd1 VARCHAR2(1000):=NULL;
    vAdd2 VARCHAR2(1000):=NULL;
    vAdd3 VARCHAR2(1000):=NULL;
    vAltCntAdd1 VARCHAR2(1000):=NULL;
    vAltCntAdd2 VARCHAR2(1000):=NULL;
    vAltCntAdd3 VARCHAR2(1000):=NULL;
    vorgAdd1 VARCHAR2(1000):=NULL;
    vorgAdd2 VARCHAR2(1000):=NULL;
    vorgAdd3 VARCHAR2(1000):=NULL;
    state VARCHAR2(100):=NULL;
    AltCntstate VARCHAR2(100):=NULL;
    nptycnt NUMBER:=0;
    orgstate VARCHAR2(100):=NULL;
    vstats VARCHAR2(100):=NULL;
    vAltCntstats VARCHAR2(100):=NULL;
    norgvalue NUMBER:=0;
    nPtyrolCon NUMBER:=0;
    npsnid NUMBER:=0;
    npsn NUMBER:=0;
    dFISC_YEAR_END_DT date:=NULL;
    Gender char(1):=NULL;
    vAltCntGender char(1):=NULL;
    vBRTH_DT VARCHAR2(100):=NULL;
    vAltCntBRTH_DT VARCHAR2(100):=NULL;
    BusinessDesc VARCHAR2(200):=NULL;
    dBRTH_DT date:=NULL;
    dAltCntBRTH_DT date:=NULL;
    prmycnt VARCHAR2(100):=NULL;
    vpsnstats VARCHAR2(100):=NULL;
    vAltCntpsnstats VARCHAR2(100):=NULL;
    vPartySysKey VARCHAR2(100):=NULL;
    vFaxno VARCHAR2(100):=NULL;
    vAltCntFaxno VARCHAR2(100):=NULL;
    vorgFaxno VARCHAR2(100):=NULL;
    nRlplptyid CHBM_PARTY_RELATIONSHIP.ROLE_PLAYR_PRTY_ID%TYPE:=NULL;
    vurladdr VARCHAR2(100):=NULL;
    vAltCnturladdr VARCHAR2(100):=NULL;
    FST_NM VARCHAR2(100):=NULL;
    orgFST_NM VARCHAR2(100):=NULL;
    AltCntorgFST_NM VARCHAR2(100):=NULL;
    LST_NM VARCHAR2(100):=NULL;
    orgLST_NM VARCHAR2(100):=NULL;
    AltCntorgLST_NM VARCHAR2(100):=NULL;
    MID_NM VARCHAR2(100):=NULL;
    orgMID_NM VARCHAR2(100):=NULL;
    AltCntorgMID_NM VARCHAR2(100):=NULL;
    PFX_NM VARCHAR2(100):=NULL;
    orgPFX_NM VARCHAR2(100):=NULL;
    AltCntorgPFX_NM VARCHAR2(100):=NULL;
    SUFX_NM VARCHAR2(100):=NULL;
    orgSUFX_NM VARCHAR2(100):=NULL;
    AltCntorgSUFX_NM VARCHAR2(100):=NULL;
    naddcnt NUMBER:=0;
    nAltaddcnt NUMBER:=0;
    norgseq NUMBER:=NULL;
    nADDR_IDseq NUMBER:=NULL;
    npsnidseq NUMBER:=NULL;
    nAltCntpsnidseq NUMBER:=NULL;
    vTransrefguid VARCHAR2(1000):=NULL;
    nRecfound NUMBER:=0;
    partytypecode varchar2(100):=null;
    AltCntpartytypecode varchar2(100):=null;
    RelationRoleCode VARCHAR2(100):=NULL;
    cUpdateflag CHAR(1):='N';
    vupdatequery CLOB:=null;
    plancode varchar2(100):=null;
    usercreated VARCHAR2(200):=null;
    openeddate VARCHAR2(100);
    openedtime varchar2(100);
    vopeneddate VARCHAR2(100);
    dopeneddate date;
    naddrcnt NUMBER:=0;
    ncnt1 number:=0;
    ncnt2 number:=0;
    ncnt3 number:=0;
    ncnt4 number:=0;
    ncnt5 number:=0;
    ncnt6 number:=0;
    nDelCnt1 number:=0;
    nDelCnt2 number:=0;
    nDelCnt3 number:=0;
    nAltcnt4 number:=0;
    nAltcnt5 number:=0;
    nAltcnt6 number:=0;
    nRelcnt NUMBER:=0;
    nAltRelcnt NUMBER:=0;
    ncnt7 NUMBER:=0;
    nprscnt NUMBER:=0;
    nAltprscnt NUMBER:=0;
    nPlncnt NUMBER:=0;
    npsncnt NUMBER:=0;
    vaddupdatequery VARCHAR2(4000);
    caddUpdateflag CHAR(1):='N';
    vaddrupdatequery VARCHAR2(4000);
    vAltCntaddrupdatequery VARCHAR2(4000);
    caddrUpdateflag CHAR(1):='N';
    cAltCntaddrUpdateflag CHAR(1):='N';
    vpsnupdatequery VARCHAR2(4000);
    vAltCntpsnupdatequery VARCHAR2(4000);
    cpsnUpdateflag CHAR(1):='N';
    cAltCntpsnUpdateflag CHAR(1):='N';
    vCntInterestPercent VARCHAR2(200);
    vAltCntInterestPercent VARCHAR2(200);
    vCntdatarep varchar2(100);
    vAltCntdatarep varchar2(100);
    vAltcnt XMLTYPE:=NULL;
    eParsererror EXCEPTION;
    PRAGMA EXCEPTION_INIT(eParsererror,-31011);
    eUniqueexception EXCEPTION;
    PRAGMA EXCEPTION_INIT(eUniqueexception,-00001);
    eplanexception EXCEPTION;
    PRAGMA EXCEPTION_INIT(eplanexception,-02291);
    eEventexception EXCEPTION;
    PRAGMA EXCEPTION_INIT(eEventexception,-01400);
    BEGIN
    BEGIN
    xData := XMLTYPE.createxml(PIN_XML_DATA);
    END;
    BEGIN
    SELECT extractvalue(value(t),'/TXLifeRequest/TransRefGUID')
    INTO vTransrefguid
    FROM TABLE (XMLSEQUENCE (EXTRACT (xData,'/TXLife/TXLifeRequest'))) t
    WHERE existsnode(value(t),'/TXLifeRequest/TransRefGUID')=1
    AND extractvalue(value(t),'/TXLifeRequest/TransRefGUID') IS NOT NULL;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    ncode:=5;
    nErrcode:=200;
    vStatus:='FAILURE';
    vStatusinfo:='General Data Error';
    Raise_application_error(-20201,'Transrefguid does not exist');
    END;
    BEGIN
    SELECT t.vActivityCode,
    t.vSubActivityCode
    INTO vActivityCode,
    vSubActivityCode
    FROM (
    SELECT xData doc
    FROM dual
    ) temp_table,
    XMLTable ( '/TXLife/TXLifeRequest/OLifE' passing doc
    COLUMNS
    vActivityCode VARCHAR2(20) path 'Activity/ActivityCode',
    vSubActivityCode VARCHAR2(20) path 'Activity/OLifEExtension/ActivityExtension/SubActivityCode'
    ) t;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    ncode:=5;
    nErrcode:=200;
    vStatus:='FAILURE';
    vStatusinfo:='RESULTINFO_DATA ';
    Raise_application_error(-20201,'General Data Error');
    END;
    IF vActivityCode='CHBM10003' AND vSubActivityCode='CHBM20002' THEN
    FOR b IN (
    SELECT t.vAltCntcity vAltCntcity,
    t.Partysyskey Partysyskey,
    t.vAltCntZip vAltCntZip,
    t.vAltCntGovtID vAltCntGovtID,
    t.vAltCntTelno vAltCntTelno,
    t.vAltCntemailaddr vAltCntemailaddr,
    t.vAltCntstats vAltCntstats,
    t.vAltCntAdd1 vAltCntAdd1,
    t.vAltCntAdd2 vAltCntAdd2,
    t.vAltCntAdd3 vAltCntAdd3,
    t.AltCntstate AltCntstate,
    t.AltCntcntry AltCntcntry,
    t.vAltCntBRTH_DT vAltCntBRTH_DT,
    t.vAltCntGender vAltCntGender,
    t.vAltCntFaxno vAltCntFaxno,
    t.vAltCnturladdr vAltCnturladdr,
    t.AltCntorgFST_NM AltCntorgFST_NM,
    t.AltCntorgLST_NM AltCntorgLST_NM,
    t.AltCntorgMID_NM AltCntorgMID_NM,
    t.AltCntorgPFX_NM AltCntorgPFX_NM,
    t.AltCntorgSUFX_NM AltCntorgSUFX_NM,
    t.AltCntpartytypecode AltCntpartytypecode,
    t.vAltCntdatarep vAltCntdatarep,
    t1.vAltCntInterestPercent vAltCntInterestPercent,
    t1.ROID ROID
    FROM (
    SELECT xData doc FROM dual ) temp_table,
    XMLTable ( '/TXLife/TXLifeRequest/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]' passing doc
    COLUMNS OOID varchar2(50) path '@OriginatingObjectID'
    , ROID varchar2(50) path '@RelatedObjectID'
    , vAltCntInterestpercent varchar2(100) path 'InterestPercent'
    )t1,
    XMLTable('/Party[@id=$roid]' passing vAltcnt, t1.roid as "roid"
    COLUMNS
    vAltCntcity VARCHAR2(20) path 'City',
    Partysyskey VARCHAR2(100) path 'PartySysKey',
    vAltCntZip VARCHAR2(20) path 'Address/Zip',
    vAltCntGovtID VARCHAR2(20) path 'GovtID',
    vAltCntTelno VARCHAR2(20) path 'Phone[PhoneTypeCode/@tc=2]/DialNumber',
    vAltCntemailaddr VARCHAR2(200) path 'EMailAddress/AddrLine',
    vAltCntstats varchar2(20) path 'Client/ClientStatus/@tc',
    vAltCntAdd1 varchar2(1000) path 'Address/Line1',
    vAltCntAdd2 varchar2(1000) path 'Address/Line2',
    vAltCntAdd3 varchar2(1000) path 'Address/Line3',
    AltCntstate varchar2(100) path 'Address/AddressState',
    AltCntcntry varchar2(100) path 'Address/AddressCountry',
    vAltCntBRTH_DT date path 'Person/BirthDate',
    vAltCntGender char(1) path 'Person/Gender/@tc',
    vAltCntFaxno varchar2(100) path 'Phone[PhoneTypeCode/@tc=19]/DialNumber',
    vAltCnturladdr varchar2(100) path 'URL/URLAddr',
    AltCntorgFST_NM varchar2(100) path 'Person/FirstName',
    AltCntorgLST_NM varchar2(100) path 'Person/LastName',
    AltCntorgMID_NM varchar2(100) path 'Person/MiddleName',
    AltCntorgPFX_NM varchar2(100) path 'Person/Prefix',
    AltCntorgSUFX_NM varchar2(100) path 'Person/Suffix',
    AltCntpartytypecode varchar2(10) path 'PartyTypeCode/@tc',
    vAltCntdatarep varchar2(100) path '@DataRep'
    ) t
    LOOP
    IF b.vAltCntBRTH_DT IS NOT NULL THEN
    dAltCntBRTH_DT:=to_date(b.vAltCntBRTH_DT,'yyyy-mm-dd');
    END IF;
    IF b.vAltCntdatarep != 'Removed' OR b.vAltCntdatarep IS NULL THEN
    BEGIN
    --------------Starting of CHBM_PERSON Table---------
    IF b.vAltCntstats IS NOT NULL THEN
    BEGIN
    SELECT code_val_cd
    INTO vAltCntpsnstats
    FROM chbm_code_reference
    WHERE tbl_nm='CHBM_PERSON'
    AND col_nm='STAT_CD'
    AND acord_cd =b.vAltCntstats;
    EXCEPTION
    WHEN OTHERS THEN
    ncode :=5;
    nErrcode :=2001;
    vStatus :='FAILURE';
    vStatusinfo :='RESULTINFO_DATA ';
    vInfodesc :='Person status details are not available in code reference';
    Raise_application_error(-20201,'Person status details are not available in code reference');
    END;
    END IF;
    BEGIN
    SELECT extractvalue(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/Phone[PhoneTypeCode/@tc=2]/DialNumber')
    INTO vAltCntDialNumberchk
    FROM TABLE (XMLSEQUENCE (EXTRACT (xData,'/TXLife/TXLifeRequest/OLifE'))) t
    WHERE existsnode(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/Phone[PhoneTypeCode/@tc=2]/DialNumber') =1;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    vAltCntDialNumberchkflag:='Y';
    END;
    BEGIN
    SELECT extractvalue(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/Phone[PhoneTypeCode/@tc=19]/DialNumber')
    INTO vAltCntFaxnochk
    FROM TABLE (XMLSEQUENCE (EXTRACT (xData,'/TXLife/TXLifeRequest/OLifE'))) t
    WHERE existsnode(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/Phone[PhoneTypeCode/@tc=19]/DialNumber') =1;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    vAltCntFaxnochkflag:='Y';
    END;
    BEGIN
    SELECT extractvalue(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/Person/FirstName')
    INTO vAltCntFirstnamechk
    FROM TABLE (XMLSEQUENCE (EXTRACT (xData,'/TXLife/TXLifeRequest/OLifE'))) t
    WHERE existsnode(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/Person/FirstName') =1;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    vAltCntFirstnamechkflag:='Y';
    END;
    BEGIN
    SELECT extractvalue(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/Person/LastName')
    INTO vAltCntLastNamechk
    FROM TABLE (XMLSEQUENCE (EXTRACT (xData,'/TXLife/TXLifeRequest/OLifE'))) t
    WHERE existsnode(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/Person/LastName') =1;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    vAltCntLastNamechkflag:='Y';
    END;
    BEGIN
    SELECT extractvalue(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/EMailAddress/AddrLine')
    INTO vAltCntEMailAddressPchk
    FROM TABLE (XMLSEQUENCE (EXTRACT (xData,'/TXLife/TXLifeRequest/OLifE'))) t
    WHERE existsnode(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/EMailAddress/AddrLine') =1;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    vAltCntEMailAddressPchkflag:='Y';
    END;
    BEGIN
    SELECT extractvalue(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/GovtID')
    INTO vAltCntTaxidPchk
    FROM TABLE (XMLSEQUENCE (EXTRACT (xData,'/TXLife/TXLifeRequest/OLifE'))) t
    WHERE existsnode(value(t),'/OLifE/Party[@id=/OLifE/Relation[RelationRoleCode/@tc=150][Sequence=2]/b.ROID][PartyTypeCode/@tc=1]/GovtID') =1;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    vAltCntTaxidPchkflag:='Y';
    END;
    IF b.Partysyskey IS NOT NULL THEN
    nAltCntpsnidseq:=b.Partysyskey;
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||'UPDATE CHBM_PERSON SET';
    IF dAltCntBRTH_DT IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' brth_dt ='''||dAltCntBRTH_DT||''''||',';
    END IF;
    IF b.vAltCntGender IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' GEND_CD ='''||b.vAltCntGender||''''||',';
    END IF;
    IF b.vAltCntGovtID IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' TAX_ID ='''||b.vAltCntGovtID||''''||',';
    ELSIF vAltCntTaxidPchkflag='N' AND vAltCntTaxidPchk IS NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' TAX_ID ='''||NULL||''''||',';
    END IF;
    IF b.vAltCntTelno IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' TEL_NO ='''||b.vAltCntTelno||''''||',';
    ELSIF vAltCntDialNumberchkflag='N' AND vAltCntDialNumberchk IS NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' TEL_NO ='''||NULL||''''||',';
    END IF;
    IF b.vAltCntemailaddr IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' EMAIL_ADR ='''||b.vAltCntemailaddr||''''||',';
    ELSIF vAltCntEMailAddressPchkflag='N' AND vAltCntEMailAddressPchk IS NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' EMAIL_ADR ='''||NULL||''''||',';
    END IF;
    IF b.vAltCntFaxno IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' FAX_NO ='''||b.vAltCntFaxno||''''||',';
    ELSIF vAltCntFaxnochkflag='N' AND vAltCntFaxnochk IS NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' FAX_NO ='''||NULL||''''||',';
    END IF;
    IF vAltCntpsnstats IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' STAT_CD ='''||vAltCntpsnstats||''''||',';
    END IF;
    IF b.AltCntorgLST_NM IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' LST_NM ='''||b.AltCntorgLST_NM||''''||',';
    ELSIF vAltCntLastNamechkflag='N' AND vAltCntLastNamechk IS NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' LST_NM ='''||NULL||''''||',';
    END IF;
    IF b.AltCntorgFST_NM IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' FST_NM ='''||b.AltCntorgFST_NM||''''||',';
    ELSIF vAltCntFirstnamechkflag='N' AND vAltCntFirstnamechk IS NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' FST_NM ='''||NULL||''''||',';
    END IF;
    IF b.AltCntorgMID_NM IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' MID_NM ='''||b.AltCntorgMID_NM||''''||',';
    END IF;
    IF b.AltCntorgPFX_NM IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' PFX_NM ='''||b.AltCntorgPFX_NM||''''||',';
    END IF;
    IF b.AltCntorgSUFX_NM IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' SUFX_NM ='''||b.AltCntorgSUFX_NM||''''||',';
    END IF;
    IF b.vAltCnturladdr IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' WEB_SITE_ID ='''||b.vAltCnturladdr||''''||',';
    END IF;
    IF dopeneddate IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' LST_UPDT_DT ='''||dopeneddate||''''||',';
    END IF;
    IF usercreated IS NOT NULL THEN
    cAltCntpsnUpdateflag:='Y';
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' LST_UPDT_BY_USER_ID ='''||usercreated||''''||',';
    END IF;
    vAltCntpsnupdatequery := SUBSTR(vAltCntpsnupdatequery,1,instr(vAltCntpsnupdatequery,',',-1,1)-1);
    vAltCntpsnupdatequery:=vAltCntpsnupdatequery||' WHERE psn_id='''||nAltCntpsnidseq||'''';
    IF cAltCntpsnUpdateflag='Y' THEN
    EXECUTE IMMEDIATE vAltCntpsnupdatequery;
    vAltCntpsnupdatequery := NULL;
    nAltcnt4:=Sql%rowcount;
    END IF;
    END IF;
    END LOOP;
    END IF;
    END;
    Regards,
    Jyothirmai

  • XML parser for C++ - encoding problem

    when I trying parse xml data
    XMLParser xP;
    xP.xmlinit((oratext*)"ISO-8859-5");
    err = xP.xmlparseBuffer((oratext*)buff, len, (oratext*)"ISO-8859-5", (ub4)0);
    I got the error 217 defined as
    #define XMLERR_END_QUOTE 217 /* No ending quote was seen */
    ORACLE_HOME and ORA_NLS variables set correctly.
    What the problem?

    Please specify the XDK version and send the sample test case.

  • Replacing harcoded XML element attributes with variables

    Is there any way for Xpath expressions in JAVA to refer to variables (for an attribute) instead of harcoded strings (like 'abc' and 'xyz' below)
    So below ... 'abc' , 'xyz' could be varaibles.....
    String getServerInstance="/Accounts/Account[@code='abc']/TestingProgram[@code='abc']/Modes/Mode[@code='xyz']/*";
    Thanks a lot

    I have a class now that resolves variables:
    public class Resolve_Xpath_Vars implements XPathVariableResolver
         public Object resolveVariable(QName var)
    try {          
              if (var.equals(new QName("pqr")))
                        return new String("pqr");
              else if (var.equals(new QName("abcde")))
                        return new String("abcde");
    else
    return null;
    catch (Exception ex)
              ex.printStackTrace();
              throw new RuntimeException();     
    NOWWWWW
    how do i configure my XPATH expression to call this class to reolve my varaible....
    XPATH EXPRESSION IS:
    "this.Account" is the variable that the class should resolve.....to "pqr"
    String getAccnt="/Accounts/Account[@code="+"'"+*this.Account*+"'"+"]/*";      
    Once resolved to "pqr" then i can make the following call:
    NodeList nodeList =(NodeList) xPath.evaluate(getAccnt, inputSource, XPathConstants.NODESET );
    any help is appreciated.............

  • XI XML Parser: tag content with "'", single apostrophe: invalid character

    Hi all,
    we import XML-documents with the file adapter in a sender channel. everything works well.
    But if one of the XML-tag contents contains a single apostrophe ( ' ), then the XML parser stops with an error "An invalid character was found inside an entity reference. ". The message can not be processed. If I test the message content in the mapping -> no error.
    When the single apostrophe is dereferenced by an additional single apostrophe the XML-File can be processed.
    Question: does anybody know how this can be handled because it is not very nice of SAP XI to send single apostrophes in outgoing messages but cannot handle it in incoming messages from other systems? special adapter settings?
    Thank you very much
    regards
    Hans

    check bhavesh reply
    Suppress Special Character
    also check
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/9420 [original link is broken] [original link is broken] [original link is broken]
    Implementing a Java Mapping in SAP PI to remove Escape Sequences from a file

  • XML attribute 'with' reserved?

    While working on a XMPP implementation I'm noticing the attribute 'with' keeps throwing errors when trying to access it to set or get the data from it. Is that a reserved word or something? Sort of makes this difficult considering 'with' is used heavily in the spec..
    var xml:XML = <rootNode>
              <item with="test" without="rest">cool</item>
    </rootNode>;
    trace(xml.item.@without); // no problem
    //trace(xml.item.@with); // uncomment and you'll get error "Syntax error: expecting identifier before with."

    It can be how you access it when considering reserved words. Try trace(xml.item.attribute("with")); or trace(xml.item.@["with"]); 

Maybe you are looking for