Problem in error handling in SAX Parser

My application takes xml message as input.
If a error was found while validating, an <Errors> <Error></Error></Errors> element is included in the orginal message and send back to the user.
While validation xml message I found an interesting problem.
Created a false entry for the root element attribute.
Traced method invocation.
First the call back error method is invoked,then the start element(stored the attributes inside the starElement to a instance variable).When i tried to print the attribute .As the error method got invoked first
if showed "null".
But when i created the same case with the child elements attributes
even though invoking of the methods happens in the same sequence
attributes got assigned and can print the attibutes values.
xml is schema vaidated .Is there any restriction that root element should not contain attributes.Can any one explain how the call back methods are invoked .
Regards
Dheeraj
// import statements here
public class OperationHandler extends DefaultHandler {
     private static Logger logger = Logger.getLogger(OperationHandler.class.getName());
     private Attributes attributes;
     private StringBuffer dataStore;
public OperationHandler() {
dataStore = new StringBuffer(100);
     * Receive notification of the end of an document.
     public void startDocument() {
          logger.debug("OperationHandler: startDocument");
     * Receive notification of the beginning of the element.
     public void startElement(String uri, String lName,
                                        String qName, Attributes attributes) {
          logger.debug("OperationHandler: startElement" + lName);
          dataStore.setLength(0);
     * Receive notification of the end of an element.
     public void endElement(String uri, String lName, String qName) {
          logger.debug("OperationHandler: endElement");
          // bussiness specific code
     * Receive notification of the end of an document.
     public void endDocument() {
          logger.debug("OperationHandler: endDocument");
     public void error(SAXParseException saxe) {
          logger.debug("OperationHandler : error");
          System.out.println("CurrentElement"+currentElement +" "+"Attributes" + attributes);
               if(attributes != null) {
                    for(int i=0; i < attributes.getLength(); i++) {
                         System.out.println(saxe.getColumnNumber());
                         System.out.println(saxe.getLineNumber());
                         System.out.println(saxe.getMessage());
     public void fatalError(SAXParseException saxe) throws SAXException {
          logger.debug("Fatal error while parsing message");
          logger.error("Error " + saxe.getMessage() );
     public void warning(SAXParseException saxe) throws SAXException {
          logger.warn("Warning " + saxe.getMessage() );
     * Receive notification of character data inside an element.
     public void characters(char[] charData,int start, int length) {
          String strData = new String(charData, start, length);
          if(strData != null) {
               strData.trim();
               dataStore.append(strData);
}

Hi Muruganand,
Is the data load failing while loading data or while activating?
if the data load is failing at activation, thers is nothing you can do except editing the records in PSA and then update them.
As far as i have seen, the data load to DSO fails in Activation and not while loading. this is the reason why the records are not collected in error stack
unlike if it is a cube, the data load fails while loading collecting the recods in error stack.
hope this helps,
Thanks and Regards,
Srinath.

Similar Messages

  • Encoding error using Oracle SAX Parser, please help

    Hi, All,
    I have problem while I am trying to parse an XML file using Oracle SAX Parser.
    The following is from the trace file:
    java.io.UTFDataFormatException: Invalid UTF8 encoding.
    java.io.UTFDataFormatException: Invalid UTF8 encoding.
    at java.lang.Throwable.&lt;init&gt;(Compiled Code)
    at java.lang.Exception.&lt;init&gt;(Compiled Code)
    at java.io.IOException.&lt;init&gt;(Compiled Code)
    at java.io.UTFDataFormatException.&lt;init&gt;(Compiled Code)
    at oracle.xml.parser.v2.XMLUTF8Reader.checkUTF8Byte(Compiled Code)
    at oracle.xml.parser.v2.XMLUTF8Reader.readUTF8Char(Compiled Code)
    at oracle.xml.parser.v2.XMLUTF8Reader.fillBuffer(Compiled Code)
    at oracle.xml.parser.v2.XMLByteReader.saveBuffer(Compiled Code)
    at oracle.xml.parser.v2.XMLReader.fillBuffer(Compiled Code)
    at oracle.xml.parser.v2.XMLReader.tryRead(Compiled Code)
    at oracle.xml.parser.v2.XMLReader.scanXMLDecl(Compiled Code)
    at oracle.xml.parser.v2.XMLReader.pushXMLReader(Compiled Code)
    at oracle.xml.parser.v2.XMLReader.pushXMLReader(Compiled Code)
    at oracle.xml.parser.v2.XMLParser.parse(Compiled Code)
    at data_loader.main(Compiled Code)
    The XML file is a pure ascii text file, with encoding set to UTF-8.
    I can parse the file correctly on NT, but I got problem when I ran the code on a SUN solaris 2.6 machine.
    The parser version is 9.0.2.
    Thanks in advance.
    Peter

    You are right, I modified the codes and got it to work on Oracle
    But when I did your suggestion:
    <cftransaction>
      <cfstoredproc ...>
      <cfquery>
        SELECT ...
      </cfquery>
    </cftransaction>
    I got the same error as before which is:
    Error Executing Database Query.
    [Macromedia][Oracle JDBC Driver]Unhandled sql type
    But this time it points to the CF callling the str proc using cfprocparam
    Here is how I call the str. proc:
         <CFTRANSACTION>   
              <cfstoredproc procedure="MyReport" datasource="#Trim(application.dsn)#" returncode="True">  
                  <cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" variable="ins_name" value="#Trim(session.instname)#">
                  <cfprocparam type="In" cfsqltype="CF_SQL_VARCHAR" variable="aca_year" value="#Trim(ayr)#"> <------- POINT TO THIS LINE
              </cfstoredproc>
         </CFTRANSACTION>

  • Powershell 4.0: Problem with error handling inside Eventhandlers - Powershell has stopped working

    Hallo!
    Please see the attached sample code. This code simply show a small WPF-Dialog.
    Test 1 (showing the problem)
    Simply run the program. You will see Powershell crashing "Powershell has stopped working".
    The cause of this is the devision by 0 inside the Eventhandler.
    We would normally expect, that the exception should be handled by the trap.
    Test 2 (showing normal operation)
    Simply remove the comment in line 28 ($i=1/0).
    This activates an exception outside the Eventhandler. Now the Trap will be executed normally.
    --> The exception can be handled by the Powershell Devloper.
    Can anybody help? Why does the Error management via Trap not work inside Eventhandlers?
    Thanks for some assistance and ideas!
    Regards
    Heike
    cls
    Set-StrictMode -Version 4.0
    $ErrorActionPreference = "stop"
    Add-Type -Assemblyname PresentationFramework
    # -- Eventhandler - will be fired during form load -----------------------------------------------------
    $FormLoaded = {
    Write-Host "EventHandler is running..."
    # Problem:
    # All exceptions will crash Powershell.
    # We would normally expect that the Global Trap will be executed!
    # This problem occurs inside of Eventhandlers only!
    # TEST 1 --> Create an Exception (Division by 0) --> Powershell crashes: "Powershell_ISE has stopped working"
    $i=1/0
    # -- End of Eventhandler----------------------------------------------------------------------------------
    # -- Start of Demo-Programm ------------------------------------
    Write-Host "Start Demo"
    # -- TEST 2 ---
    # Write-Host "Test 2: Testing Global Trap"
    # Create an Exception (Division by 0) --> Powershell does not crash --> Global Trap will be executed --> OK
    # $i=1/0
    # XAML-Code for WPF-Dialog
    [xml]$xaml = @"
    <Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Test - " Height="370" Width="657" ResizeMode="NoResize" WindowStyle="ThreeDBorderWindow" WindowStartupLocation="CenterScreen" ShowInTaskbar="False" >
    <Grid Margin="0,0,0,-4">
    <Label Name="CustomerName" Content="Hello World" HorizontalAlignment="Left" Margin="10,2,0,0" VerticalAlignment="Top" Width="596"/>
    </Grid>
    </Window>
    $Form1=[Windows.Markup.XamlReader]::Load((New-Object System.Xml.XmlNodeReader $xaml)) # Load form
    Write-Host "Register Event"
    $Form1.Add_Loaded($FormLoaded)
    Write-Host "Starting ShowDialog"
    $Form1.ShowDialog() > $null
    Write-Host "End of program"
    # Global Trap - all exceptions should be handled here
    trap{
    Write-host "Global Trap is running..."
    Write-host "End of trap - program will be stopped"

    It works fine if you don't try to execute the code while loading and if you use a better exception handling method.
    Add-Type -Assemblyname PresentationFramework
    [xml]$xaml=@'
    <Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Test - " Height="370" Width="657" ResizeMode="NoResize" WindowStyle="ThreeDBorderWindow" WindowStartupLocation="CenterScreen" ShowInTaskbar="False" >
    <Grid Margin="0,0,0,-4">
    <Label Name="CustomerName" Content="Hello World" HorizontalAlignment="Left" Margin="10,2,0,0" VerticalAlignment="Top" Width="596"/>
    </Grid>
    </Window>
    $Form1=[Windows.Markup.XamlReader]::Load((New-Object System.Xml.XmlNodeReader $xaml)) # Load form
    $Form1.Add_Loaded({
    Write-Host "EventHandler is running..."
    Try{
    $i=1/0
    Catch{
    Write-Host "$_"
    $Form1.ShowDialog()
    ¯\_(ツ)_/¯

  • An odd problem when error handling

    hi experts
    I encountered a very odd problem when trying to show up an error message... and hope someone can help me out.
    I defined a standard action in the view, and wrote some lines of code to check the input data in the predefined methodWDDOBEFOREACTIONwhich will call a method from component controller, and that method will call message_mananger->report_t100_message to show up an E type message if any error happened. But the problem is the program does not stop there but go into the action handler(ONACTIONACT_XXX).
    I think it should actually stop and show up the message rather than get into the action handler because of the action is standar...
    can anyone help?
    many tkx

    hi,
    i went through your code.....the code is fine but as you told that it goes to the exception handler after coming to the message part ...this is because you are using
    CALL METHOD LO_MESSAGE_MANAGER->REPORT_T100_MESSAGE
      EXPORTING
        MSGID                     =
        MSGNO                     =
        MSGTY                     =
       P1                        =
       P2                        =
       P3                        =
       P4                        =
       MSG_USER_DATA             =
       IS_PERMANENT              = ABAP_FALSE
       SCOPE_PERMANENT_MSG       = CO_MSG_SCOPE_CONTROLLER
       VIEW                      =
       SHOW_AS_POPUP             =
       CONTROLLER_PERMANENT_MSG  =
       MSG_INDEX                 =
       CANCEL_NAVIGATION         =
       ENABLE_MESSAGE_NAVIGATION =
      RECEIVING
        MESSAGE_ID                =
    this function will simply report that message but will not hold the control to the same screen..
    so use
    CALL METHOD LO_MESSAGE_MANAGER->REPORT_FATAL_ERROR_MESSAGE......
    and tell me whether it solved the problem or not....
    @ sarbjeet i think that Raise_T100_error is an obselete function...rite?
    thanks and regards,
    sahai.s

  • Meaningful error handling with Sax Parsers (Apache Xerces)

    Hello All,
    I am using the Apache Xerces Parser 2.6.2 to parse some XML documents with a W3C XML Schema document.
    My schema has a lot of rules enforced on the different elements and I was looking at some way to get userfriendly/meaningful prescriptive messages as output back to the user so that he/she can correct the errors in their XML files and have files conformant to the schema.
    If I give an invalid XML file (with errors introduced by myself) the parser throws a SAXParseException with a message like ,
    XML Document has Error: cvc-type.3.1.3: The value 'ANZc9901' of element 'uniqueid' is not valid. line number 6, column number 42
    My XSD file
    <xs:element name="uniqueid">
    <xs:simpleType>
    <xs:restriction base="xs:token">
    <xs:pattern value="\s*ANZ[0-9]{4}\s*"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    My XML File's uniqueID element
    <uniqueid>ANZc9901</uniqueid>
    As you can see, the error message isn't of much use. I was looking at a way to handle them generically, and give out a suggestive error message based on the type of the error. Any help in this regard would be highly appreciated

    well, it seems pretty obvious to me... Not sure how you are going to do a whole lot better.

  • Problem reading ' from XML uisng SAX Parser

    Hi All,
    I have a XML which contains the following element
    <DataText>This is simple ' Text</DataText>I have included & apos ; in the element called DataText.
    When parsing the element, am getting only the text that appears before & apos ;
    When Not including & apos ; am able to get the full text from this element.
    I observed that in the method characters(char buf[], int offset, int len)
    Thelen attribute shows the total length from start position to the position where & apos ; starts...
    How can i get the whole text which includes even " & apos ; "
    Thanks
    Note : while posting this request, & apos; is being formatted to ' . thats the reason included space between them

    HI,
    Was not doing much in the characters method, anyway here is the code
    public void characters(char buf[], int offset, int len) throws SAXException{
        elementText  = new String(buf, offset, len).trim();
    }The value for len is from the start position of the element value and the start position of the ' & apos; ' in the XML File...
    If i remove the ' & apos; ' in the element value , then the len is the full character length in between the element.
    Very confused why this is happening !!
    Did anyone face this problem ever before ?

  • Problem while Error Handling thru BAPI_PO_CREATE1

    Hi,
    currently im facing problem while generating error thru BAPI_PO_CREATE1
    im calling bapi two times thru loop iteration,
    as my data is faulty , so for 1st iteration im getting 3 error in it_return structure.
    now in 2nd iteration im getting (3+3)
    repeted error which is geenarated earlier(old 3 err) +(new 3 err).
    im refreshing all internal table,work areas and variables, still im getting same problem,
    please provide ur kind suggestion on this.
    refresh : <all it>
    clear  : <all wa>
    Loop at it into wa.
    refresh : it_return.
    CALL FUNCTION 'BAPI_PO_CREATE1'
    Tables = IT_RETURN
    endloop.
    Regards
    Vivek Khobragade

    hi,
    I found that Im getting duplicates error because of  passing
    BAPIMEPOITEM - PREQ_NO (Purchase Requisition Number)
    BAPIMEPOITEM - PREQ_ITEM (Item Number of Purchase Requisition)
    . if I dont pass these then I wont get duplicates error.
    but as functional told its mandatory to update it?
    please have eye on it?
    regards
    Vivek

  • SAX Parser Error in JDBC Adapter

    I am using a JDBC adapter to execute SQL statements during mapping runtime. However, it issues me an error regarding the SAX Parser when I have a '&' character in the SQL statement. I am not able to remove the & since it is in the database that I access and it will result to data inconsistency. I think that when the JDBC adapter of XI converts the SQL string to the XML format, it does not include the amp; string to the &, thus causing the SAX Parser to throw the error.
    Is there someway I can configure the JDBC adapter in such a way that it will replace the & with &amp;. Or is there a way to display how the JDBC adapter converts the SQL statement to its the XML representation of it?
    Thanks a lot.

    Hi,
    For this kind of situation use some unique character combination  like "#@!" for replacing "&" then parse the document and the restore the "&" later .
    For this convert the input stream into Strring and then replace the occurences of "&".
    regards.

  • Error handling for RGB values

    Hi
    I am having problems doing error handling for RGB values. I have a Java applet with 3 JTextFields whose values are parsed as int variables and stored as ints. If a value is entered that is not a value between 0 and 255 is entered, the appropriate field/s should be set to an empty string.
    The problem I am having is that I am using try/catch block to try to parse as an int but then it breaks out of execution completely.
    I hope this makes sense and that someone can help.
    Thanks!

    this is because your code is probably inside one giant try catch block, what you need to do is have small ones in places where you do the parsing.
    post code and i can show you how to modify it

  • CF8 Webservice error handling

    As my title tells you, I have a problem regarding error
    handling in webservices.
    I've set up an application.cfc where I've implemented
    generalised error handling.
    Whenever a coldfusion error occurs, this is the place the
    error would be caught and properly handled.
    I.E.: Don't give the whole stacktrace and the raw coldfusion
    error message.
    The problem is that, in the case of a SOAP request, the whole
    onError method seems to be discarded.
    It won't invoke this method. I've tested this using a
    <cflog in the onError method.
    Sometimes even, when the schema is incorrect it generates an
    AXIS exception.
    But there's no real way in coldfusion to catch or even handle
    this exception.
    Does anyone else know about a way to do this in coldfusion?
    How can I catch those exceptions on my server and properly
    handle them before returning the SOAP fault envelope?

    We are implementing synchronus web services(proxy to web services) to sync master data with the external systems
    In the above scenario it will be better to intimate the error details to the source system, i.e. option 2.....this will ensure that the source system application (developers/ monitors) are aware that something has gone wrong while processing data in the target.
    Option 2. Send the the fault message(system error) to the source let the source system fail the message by not handling
    the error, so that you get the alert with the stsndard alert configuration
    Ultimately it is the business requirement which needs to be followed.....how does the business want to handle it....is the error required at the source
    Regards,
    Abhishek.

  • I've a problem with errors message in the sax parser

    Hello,
    I'm quite new to Java.
    I'm trying to create a SAX parser for my XML file, with a XML schema.
    When my pars run a XML file, the following mistakes go out:
    1)org.sax.SAXParseException:s4s-elt-must-match: the content of 'restriction' must match (annotation?,.....)
    2)org.sax.SAXParseException: src-ct.0.1:Complex Type Definition Rappresentation Error for type..... Element 'sequence' is invalid,misplaced or occurs to often
    but I don't understand where I must go in the schema to correct.
    Many thanks!

    Hi,
    Perhaps it would help if you post your XML file.

  • Sax parser problem

    hi,
    i am assuming the problem is with sax parser but i cant be sure. I am parsing a xml file (about 1.4MB) with some data in it. the parser i have created reads the xml file correctly for the most part but when at some point the
    "public void characters(char buf[], int offset, int len) throws SAXException"
    function stops working correctly....i.e it doesnt fully read read the data between the "<start>" and "</start>" element. say it reads about 100 id's correctly---for 101 ID it does this. This is just an example. Since, the problem might be with how :
    "public void characters(char buf[], int offset, int len) throws SAXException"
    function is reading the data i was wondering if anybody else had encountered this problem or please let me know if i need to change something in the code: here's a part of the code :
    Bascially i have created three classes to enter data into three mysql tables and as i parse the data i fill up the columns by matching the column header with the tagName.
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.sql.*;
    import java.io.*;
    import java.util.ArrayList;
    import java.lang.Object;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    import java.util.*;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    public class Echo03 extends DefaultHandler
    StringBuffer textBuffer;
    int issuedValue, prodValue;
    OrdHeader header = new OrdHeader();
    OrdDetail detail = new OrdDetail();
    Member memInfo = new Member();
    //new addition to store the dynamic value of the products
    TestOrdheader prod = new TestOrdheader();
    int counter;
    String tag, newTag;
    SetValue setVal = new SetValue();
    String test;
    public static void main(String argv[])
    if (argv.length != 1) {
    System.err.println("Usage: cmd filename");
    System.exit(1);
    // Use an instance of ourselves as the SAX event handler
    DefaultHandler handler = new Echo03();
    // Use the default (non-validating) parser
    SAXParserFactory factory = SAXParserFactory.newInstance();
    try {
    // Set up output stream
    out = new OutputStreamWriter(System.out, "UTF8");
    // Parse the input
    SAXParser saxParser = factory.newSAXParser();
    saxParser.parse( new File(argv[0]), handler);
    } catch (Throwable t) {
    t.printStackTrace();
    System.exit(0);
    static private Writer out;
    private String indentString = " "; // Amount to indent
    private int indentLevel = 0;
    //===========================================================
    // SAX DocumentHandler methods
    //===========================================================
    public void startDocument()
    throws SAXException
    nl();
    nl();
    emit("START DOCUMENT");
    nl();
    emit("<?xml version='1.0' encoding='UTF-8'?>");
    header.assign();
    public void endDocument()
    throws SAXException
    nl(); emit("END DOCUMENT");
    try {
    nl();
    out.flush();
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    public void startElement(String namespaceURI,
    String lName, // local name
    String qName, // qualified name
    Attributes attrs)
    throws SAXException
    indentLevel++;
    nl(); //emit("ELEMENT: ");
    String eName = lName; // element name
    if ("".equals(eName)) eName = qName; // namespaceAware = false
    if (qName.equals("Billing")){
    issuedValue = 1;
    }else if (qName.equals("Shipping")){
    issuedValue = 2;
    }else if (qName.equals("ShippingTotal")){
    issuedValue = 3;
    //check to see if "Product" is the name of the element thats coming next
    if (qName.equals("Product")){
    if (issuedValue != 3){
    prodValue = 1;
    prod.addCounter();
    }else{
    prodValue = 0;
    tag = eName;
    if (attrs != null) {
    for (int i = 0; i < attrs.getLength(); i++) {
    String aName = attrs.getLocalName(i); // Attr name
    if ("".equals(aName)) aName = attrs.getQName(i);
    nl();
    emit(" ATTR: ");
    emit(aName);
    emit("\t\"");
    emit(attrs.getValue(i));
    emit("\"");
    if (attrs.getLength() > 0) nl();
    public void endElement(String namespaceURI,
    String sName, // simple name
    String qName // qualified name
    throws SAXException
    nl();
    String eName = sName; // element name
    if ("".equals(eName)){
    eName = qName; // not namespaceAware
    if ("Order".equals(eName)){          
    //enter into database
         databaseEnter();
    textBuffer = null;
    indentLevel--;
    public void characters(char buf[], int offset, int len)
    throws SAXException
    nl();
    try {
    String s = new String(buf, offset, len);
    if (!s.trim().equals("")){
    settag(tag, s);
    s = null;
    }catch (NullPointerException E){
    System.out.println("Null pointer Exception:"+E);
    //===========================================================
    // Utility Methods ...
    //===========================================================
    // Wrap I/O exceptions in SAX exceptions, to
    // suit handler signature requirements
    private void emit(String s)
    throws SAXException
    try {
    out.write(s);
    out.flush();
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    // Start a new line
    // and indent the next line appropriately
    private void nl()
    throws SAXException
    String lineEnd = System.getProperty("line.separator");
    try {
    out.write(lineEnd);
    for (int i=0; i < indentLevel; i++) out.write(indentString);
    } catch (IOException e) {
    throw new SAXException("I/O error", e);
    ===================================================================
    ///User defined methods
    ===================================================================
    private String strsplit(String splitstr){
    String delimiter = new String("=");
    String[] value = splitstr.split(delimiter);
    value[1] = value[1].replace(':', ' ');
    return value[1];
    public void settag(String tag, String s){         
    String pp_transid = null, pp_respmsg = null,pp_authid = null, pp_avs = null, pp_avszip = null;
    if ((tag.equals("OrderDate")) || (tag.equals("OrderProcessingInfo"))){
    if (tag.equals("OrderDate")){
    StringTokenizer st = new StringTokenizer(s);
    String orddate = st.nextToken();
    String ordtime = st.nextToken();
    header.put("ordDate", orddate);
    header.put("ordTime", ordtime);
    }else if (tag.equals("OrderProcessingInfo")){
    StringTokenizer st1 = new StringTokenizer(s);
    int tokenCount = 1;
    while (tokenCount <= st1.countTokens()){
    switch(tokenCount){
    case 1:
    String extra = st1.nextToken();
    break;
    case 2:
    String Opp_transid = st1.nextToken();
    pp_transid = strsplit(Opp_transid);
    break;
    case 3:
    String Opp_respmsg = st1.nextToken();
    pp_respmsg = strsplit(Opp_respmsg);
    break;
    case 4:
    String Opp_authid = st1.nextToken();
    pp_authid = strsplit(Opp_authid);
    break;
    case 5:
    String Opp_avs = st1.nextToken();
    pp_avs = strsplit(Opp_avs);
    break;
    case 6:
    String Opp_avszip = st1.nextToken();
    pp_avszip = strsplit(Opp_avszip);
    break;
    tokenCount++;
    header.put("pp_transid", pp_transid);
    header.put("pp_respmsg", pp_respmsg);
    header.put("pp_authid", pp_authid);
    header.put("pp_avs", pp_avs);
    header.put("pp_avszip", pp_avszip);
    }else{
    newTag = new String(setVal.set_name(tag, issuedValue));
    header.put(newTag, s);
    //detail.put(newTag, s);
    prod.put(newTag, s);
    memInfo.put(newTag,s);
    //Check to see-- if we should add this product to the database or not
    boolean check = prod.checkValid(newTag, prodValue);
    if (check){
    prod.addValues(s);
    setVal.clearMod();
    ==================================================================
    Here's the error that i get:
    java.util.NoSuchElementException
    at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:691)
    at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
    at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:281)
    at Echo03.main(Echo03.java:47)

    I haven't gone through your code but I also had a similar error....and the exception in my was because of an "&" instead of the entity reference & in one of the element values. I use a non-validating parser but if you use a validating one then this might not be the reason for your exception.

  • SAX Parser XML Validation Problems

    Hi,
    I’m having problems getting an xml document to validate within Weblogic 8.1. I am trying to parse a document that references both a dtd and xsd. Both the schema and dtd reference need to be substituted so they use local paths. I specify the schema the parser should use and have created an entityResolver to change the dtd reference.
    When this runs as a standalone app from eclipse the file parses and validates without a problem. When deployed to the app server the process seems to be unable read the contents of the dtd. Its not that it cannot find the file (no FileNotFoundException is thrown but this can be created if I delete the dtd) rather it seems to find no declared elements.
    Initial thought was that the code didn’t have access to read the dtd from its location on disk, to check I moved the dtd to within the deployed war and reference as a resource. The problem still persists.
    Code Snippet:
    boolean isValid = false;
    try {
         // Create and configure factory
    SAXParserFactory factory = SAXParserFactoryImpl.newInstance();
    factory.setValidating(true);
    factory.setNamespaceAware(true);
    // To be notified of validation errors in the XML document,
    // add a custom error handler to the document builder
    PIMSFeedFileValidationHandler handler
    = new PIMSFeedFileValidationHandler();
         // Create and Configure Parser
    SAXParser parser = factory.newSAXParser();
    parser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
    parser.setProperty(NAMESPACE_PROPERTY_KEY, getSchemaFilePath());
         // Set reader with entityResolver for dtd
    XMLReader xmlReader = parser.getXMLReader();
    xmlReader.setEntityResolver(new SAXEntityResolver(this.dtdPath));
    // convert file to URL, as it is a remote file
    URL url = super.getFile().toURL();
    // Open an input stream and parse
    InputStream is = url.openStream();
    xmlReader.setErrorHandler(handler);
    xmlReader.parse(new InputSource(is));
    is.close();
    // get the result of parsing the document by checking the
    // errorhandler's isValid property
    isValid = handler.isValid();
    if (!isValid) {
    LOGGER.warn(handler.getMessage());
    LOGGER.debug("XML file is valid XML? " + isValid);
    } catch (ParserConfigurationException e) {
    LOGGER.error("Error parsing file", e);
    } catch (SAXException e) {
    LOGGER.error("Error parsing file", e);
    } catch (IOException e) {
    throw new FeedException(e);
    return isValid;
    See stack trace below for a little more info.
    2005-01-28 10:24:09,217 [DEBUG] [file] - Attempting validation of file 'cw501205.wa1.xml' with schema at 'C:/pims-feeds/hansard/schema/hansard-v1-9.xsd'
    2005-01-28 10:24:09,217 [DEBUG] [file] - Entity Resolver is using DTD path file:C:/Vignette/runtime_services/8.1/install/common/nodemanager/
    VgnVCMServer/stage/pims-hansard/pims-hansard.war/WEB-INF/classes/com/morse/pims/cms/feed/sax/ISO-Entities.dtd
    2005-01-28 10:24:09,227 [DEBUG] [file] - Creating InputSource at: file:C:/Vignette/runtime_services/8.1/install/common/nodemanager/VgnVCMServer/stage/pims-hansard/pims-hansard.war/WEB-INF/classes/com/morse/pims/cms/feed/sax/ISO-Entities.dtd
    2005-01-28 10:24:09,718 [WARN ] [file] - org.xml.sax.SAXParseException: Element type "Hansard" must be declared.
    org.xml.sax.SAXParseException: Element type "Session" must be declared.
    org.xml.sax.SAXParseException: Element type "DailyRecord" must be declared.
    org.xml.sax.SAXParseException: Element type "Volume" must be declared.
    org.xml.sax.SAXParseException: Element type "Written" must be declared.
    org.xml.sax.SAXParseException: Element type "WrittenHeading" must be declared.
    org.xml.sax.SAXParseException: Element type "Introduction" must be declared.
    … continues for all the elements in the doc
    2005-01-28 10:24:10,519 [DEBUG] [file] - XML file is valid XML? false
    2005-01-28 10:24:10,519 [WARN ] [file] - Daily Part file 'cw501205.wa1.xml' was not valid XML and was not processed.
    Has anybody seen this behavior before with weblogic and if so how have you resolved the issue.
    Thanks in Advance
    Adam

    Hi David,
    I have checked the ejb-jar.xml file and there is no duplicate values in it and the other things is that the same application is been deployed on OAS 10G and websphere and its working fine. In the forum someone has replied to a similar problem that there is bug in Weblogic 10.3 and its CR no 376292. I am not sure about it, does anyone any information about it.
    Thanks and Regards
    Deepak Dani

  • Error processing request in sax parser  No 'action' attribute found in XML

    Hi All,
            I am doing a FILE to JDBC Scenario.  I just want to send a data from file to Sql Db table. For this I have written a stored procedure to insert the row in a table.
    This is the message mapping for FILE to JDBC ….
    Sender                                                                   Receiver
    *FILESENDER_MT  1..1    FILESENDER_DT     * SPRECEIVER_MT    1..1
        .NO                    1..1    xsd:string                    * Statement           1..1   string
        .Name                1..1    xsd:string                      *user_PROC       1..1                                                                               
    action            1..1required
                                                                                *No                                                                               
    isInput        1..1  string
                                                                                    type           1..1  string
                                                                                *Name
                                                                                    isInput        1..1  string
                                                                                    type           1..1  string 
    Mapped Values....
    Statement is mapped with <b>FILESENDER_MT</b>
    action attribute is mapped with "<b>EXECUTE</b>" Constant
    No is mapped with <b>NO</b>
    Name is mapped with <b>Name</b>
    for both isInput is mapped with <b>TRUE</b>
    for both type is mapped with <b>CHAR</b>
    Here is the my stored procedure.....
    CREATE PROCEDURE [dbo].[user_PROC]
    @NO char(10),  @Name char(10)  AS
    insert into FILE2JDBC values('a','ab')
    GO
    when i run this stored procedure in Sql directly it was executed successfully....
    I have checked In SXMB_MONI status is showing green...
    xml messages from SXMB_MONI ....
    this is the message from payloads of Inbound Message
    <PRE> <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:FILESENDER_MT xmlns:ns0="http://www.prospectadelhi.com/DELHI_FILE2JDBC">
      <NO>111</NO>
      <NAME>murthy</NAME>
      </ns0:FILESENDER_MT></PRE>
    this is the message from payloads of Request Message Mapping
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:SPRECEIVER_MT xmlns:ns0="http://www.prospectadelhi.com/DELHI_FILE2JDBC">
    - <Statement>
    - <user_PROC>
      <action>EXECUTE</action>
    - <NO>
      <isInput>TRUE</isInput>
      <type>CHAR</type>
      </NO>
    - <Name>
      <isInput>TRUE</isInput>
      <type>CHAR</type>
      </Name>
      </user_PROC>
      </Statement>
      </ns0:SPRECEIVER_MT>
    this is the error showing in runtime workbench>component monitoring->communication channel monitoring-->Receiver Communication Channel....
    <b>Error while parsing or executing XML-SQL document: Error processing request in sax parser: No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)</b>
    Can any body tell me whether the problem is in Mapping or in Data Type Structure..
    Please resolve this issue....
    Thanks in Advance,
    Murthy.

    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:SPRECEIVER_MT xmlns:ns0="http://www.prospectadelhi.com/DELHI_FILE2JDBC">
    - <Statement>
    <b>- <user_PROC>
    <action>EXECUTE</action></b>
    - <NO>
    <isInput>TRUE</isInput>
    <type>CHAR</type>
    </NO>
    - <Name>
    <isInput>TRUE</isInput>
    <type>CHAR</type>
    </Name>
    </user_PROC>
    </Statement>
    </ns0:SPRECEIVER_MT>
    The Action should be a Attribute of Element user_Proc as,
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:SPRECEIVER_MT xmlns:ns0="http://www.prospectadelhi.com/DELHI_FILE2JDBC">
    - <Statement>
    <b>- <user_PROC action="Execute"></b>- <NO>
    <isInput>TRUE</isInput>
    <type>CHAR</type>
    </NO>
    - <Name>
    <isInput>TRUE</isInput>
    <type>CHAR</type>
    </Name>
    </user_PROC>
    </Statement>
    </ns0:SPRECEIVER_MT>
    Likewise isInput and Type should be Attributes and not Elements .
    Regards
    Bhavesh

  • JDBC receiver adapter - Error processing request in sax parser

    Hello,
    I want to INSERT idoc data via JDBC adapter into a MS SQL database. After digging through SAP Help, numerous blogs and forum discussions on SDN and even posting an OSS message I still get the same error:
    'Error: TransformException error in xml processor class: Error processing request in sax parser: No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)'
    When testing my mapping in the Integration Repository the resulting XML message is:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Employee xmlns:ns0="http://prodrive.nl/xi/HRMasterdata/HRMD_A_2_d_bcommerp">
       <STATEMENT>
          <T_PD_Employees action="INSERT">
             <access>
                <KeyTag>00088888</KeyTag>
                <PerNo>00088888</PerNo>
             </access>
          </T_PD_Employees>
       </STATEMENT>
    </ns0:Employee>
    The connection to the database is fine, Sender adapter with a SELECT * works perfect.
    Can anyone help me solve this problem? I'm lost.
    Best regards,
    Roelof Jan Bouwknegt

    Hi Bhavesh,
    I have tried out the change you suggested. Without success. Message I get back is
    - 2006-12-28 10:34:08 CET: Error: TransformException error in xml processor class: Error processing request in sax parser: No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)
    structure in testtool:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:Employee xmlns:ns0="http://prodrive.nl/xi/HRMasterdata/HRMD_A_2_d_bcommerp">
       <STATEMENT>
          <T_PD_Employees action="INSERT">
             <ACCESS>
                <KEYTAG>00088888</KEYTAG>
                <PERNO>00088888</PERNO>
             </ACCESS>
          </T_PD_Employees>
       </STATEMENT>
    </ns0:Employee>
    Somehow the SAX  parser doesn't like the result of my mapping. Maybe there is something wrong with the structure cardinality. Let me describe what I have built:
    XSD:
    WA_T_PD_Employees - Complex Type
    > STATEMENT - Element - Occurence = 1
    >> T_PD_Employees - Element - Occurence = 1
    >>> STATEMENT - Attribute - Occurence = optional
    >>> access - Element - Occurence = 1..Unbounded
    Best regards Roelof Jan and thanks for your quick response

Maybe you are looking for

  • Itunes wont load pages

    Hi, I have itunes 10.5 beta on my dell and when i load it, its fine, then i connect to the itunes store it wont load the pages. It doesnt even load the home store. It will connect b/c i see the music tv movies and other categories, when i click on an

  • Just purchased an upgrade trouble installing acrobat x pro

    cant install acrobat x pro  . saying check system requirements . I have enough space and I have windows xp

  • JSF doesn't set values for optionally rendered fields

    When I enter a value into an optionally rendered inputText, the resulting object property is never updated, but when I remove the "rendered=" code then the objects set property works every time. I am using the version of JSF that downloads with the l

  • Pages documents cannot be opened

    I can't open any of my documents. Was working perfectly fine 2 weeks ago. Tried shutting down iPad  several times as suggested but still not working.

  • MPN is not available

    Is it necessary to register iWork if it was purchased in the App Store? I see "Register Pages" in the Pages Menu. I have no Marketing Part Number - which is required for online registration.