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.

Similar Messages

  • Step by Step documents for Process Chain Error Handling with Screen Shots

    Hi
    Is anybody having Step By Step Documents for Process Chain Error Handling with Screen Shots ?. Please forward it to me to my e-mail [email protected] .  I will reward points to u immediately.
    bye
    Aamira Khan

    Hi,
    You can find lots of topic related to process chain issues in SDN.Please make a search in SDN.
    https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_library&query=process+chain&adv=true&sdn_author_name=&sdn_updated_on_comparator=ge&sdn_updated_on=&sortby=cm_rnd_rankvalue
    Regards.

  • General Inquiry Regarding Error Handling with System Exec.vi

    I have a sub vi that uses the System Exec.vi to send SMS messages when triggered. I am confused as to how the error handling works and why all of the errors seem to go to the "standard error" vs the "Error out". The reason I am interested is because I am trying to interrupt the error out of another script to execute a command if error=true.
    I have intentionally created an error to test this, however it does not seem that the signal is ever being sent to the error out, only to the standard error.
    Any help/explanation as to how this works would be greatly appreciated.

    The Facebook discussion board is just a pilot and that functionality is not available yet (as to my knowledge). You will have to use the actual forum thread to add attachments. You can click the arrow just to the right of thread topic in the Facebook thread and that will take you to the ni.com/forums thread. Or you can navigate here:
    http://forums.ni.com/t5/LabVIEW/General-Inquiry-Regarding-Error-Handling-with-System-Exec-vi/m-p/246...
    Having a look at your VI would help to clarify the error handling issue.
    Daniel K | NI Applications Engineer | Certified LabVIEW Developer

  • Error handling with example

    Hi,
    Can any one explain please
    1.Why we need to create XSD,
    2.What is the use of dehydration,
    3.Types in XML
    Please explain any error handling with example.

    Hi',
    1.Why we need to create XSD,
    This is used as the input/output for the webservice/BPEL
    2.What is the use of dehydration,
    This is used to save the state of the composite/BPEL/Mediator in the database
    3.Types in XML
    complex, simple
    Error handing in file
    http://yatanveersingh.blogspot.com/2011/09/fault-handling-in-file-adapter-for-csv.html
    -Yatan

  • Report and Alert don't executed in the error handler with a JMS proxy service

    Hi,
    I'm working with OSB 11.1.1.4.0 and I'm facing a problem with the error handler of my JMS proxy service.
    My error handler contains two main elements :
    - a Report action
    - an Alert with a JMS destination defined
    When the business service failed the message remain in the queue. It's the expected behavior.
    The problem is :
    - the report is missing
    - the alert is raised but missing in the JMS destination defined in the Alert setting.
    I've noticed if I add a Reply with Failure or Success, Report and Alert are successfully executed.
    Unfortunately the message don't remain in the JMS queue.
    What can I do in order to have my report/alert done and the JMS transaction rollback in order to keep the message in the queue ?
    I've already met this problem in the past with alsb v3 and my solution was to add Service Callout in the error handler in order to externalize these actions.
    This solution is not convenient and I hope another solution is possible.

    Inventorying workgroups can be difficult, especially when it comes to remote access and network security. Because workgroups are not centrally managed, some of the items discussed in this
    wiki article on preparing your workgroup environment may require you to visit each machine individually.
    For non-domain credentials, you do not use the <systemname>\<user> format, you simply enter the user name. Regarding how to enter the credentials, if you have an account that uses the same username and password on all machines and is an administrator
    on all of those machines, then you can enter that in the All computers credentials page of the wizard. You can also do this if they are different user names. However, if some machines have an account with the same user name, such as Administrator,
    but different passwords on each machine, you will need to use the Manually enter computer names discovery method, and then enter the information for each group or each machine.
    As you can tell, workgroup environments can quickly negate any benefit that the agentless inventory nature of MAP provides.
    Please remember to click "Mark as Answer" on the post that helps you, and to click
    "Unmark as Answer" if a marked post does not actually answer your question. Please
    VOTE as HELPFUL if the post helps you. This can be beneficial to other community members reading the thread.

  • Error handling with Sync RFC

    Hi @ all,
    I have following scenario: a BPM doing some stuff on DB and map this values to a RFC request (sync) to a SAP R/3 system. Within this RFC I define 2 exceptions.
    I did map the RFC exception in interface mapping to a fault message.
    In BPM I put my RFC call into a Block with an Exception "RfcError" and insert a Exceptionbranch - which should send a email.
    Put anyhow it doesn't work - every RFC exception ends as an error in SMBX_MONI...
    Anyone a idea how to solve it??
    Regards Matt

    Hi Bhavesh,
    thanks for your tip, I see an error within my block their. But I don't know what it means to me
    Während des Anwendungs-Mappings com/sap/xi/tf/_MM_ Rfc_Error_to_Mail_ wurde eine com.sap.aii.util Work item 000000120730: Object CL_SWF_XI_MSG_BROKER method SEND_SYNCHRON cannot be executed
    No exception defined for system errors
    Error handling for work item 000000120729
    Runtime handle of object type  could not be created
    Runtime handle of object type  could not be created
    No exception defined for system errors
    Regards
    Matt

  • Error handling with shell script

    Hi,
    I want to write a .sql file with lots of executable statements. These statements need to run on 100 of schemas per database.
    I want to have error handling mechanism in this file in such a way that whenever I get any ORA- error or SP error, it should stop executing there.
    Please help me.
    Thanks.

    872305 wrote:
    Hi,
    I want to write a .sql file with lots of executable statements. These statements need to run on 100 of schemas per database.
    I want to have error handling mechanism in this file in such a way that whenever I get any ORA- error or SP error, it should stop executing there.
    Please help me.
    Thanks.
    10:47:51 SQL> help whenever sqlerror
    WHENEVER SQLERROR
    Performs the specified action (exits SQL*Plus by default) if a
    SQL command or PL/SQL block generates an error.
    WHENEVER SQLERROR {EXIT [SUCCESS|FAILURE|WARNING|n|variable|:BindVariable]
                        [COMMIT|ROLLBACK] | CONTINUE [COMMIT|ROLLBACK|NONE]}
    10:48:07 SQL>

  • ALE Error Handling with Workflow

    Hi All,
    I have some issues with using workflows with idocs:
    In our process codes , the business object , start event for error handling and success event has been configured.
    Now if the workflow_result is 0 then success event is triggered and if workflow_result = 99999 then start event is triggered.
    I have two qquestons:
    1. How are these events triggered as I did not find any code in the F.M> to triggerethem.
    2. What is the purpose of End event.
    Apart from this , is there any area where workflows can be used with IDOCS.
    Thanks and Regards
    Aman

    Hi,
    In case I am creating a custom F.M. to process idoc data then I can use the F>M> to create the event.
    However In case the standard F.M. is being used and workflow_result is set to 9999 in it and I have consigured the start event to it,in that case I will not be able to use thie F.M> to trigger the workflow.
    Thanks and Regards
    Aman

  • Error handling with SUBMIT

    Hello Experts!
    Is it possible to handle errors generated in a program called with SUBMIT ?
    for example I am calling a program REPORT00
    SUBMIT REPORT00
            WITH  PARAM_1 = 'X'
                AND RETURN.
    And say there are some validations in REPORT00 that throws an error.
    I see that when it throws an error, the screen on REPORT00 is displayed, which would not be prefered!
    Is there a way to handle this?
    Awaiting your valuable responses....
    Thanks in advance

    REPORT00 need to write the messages to File and download it later or need to write to spool... I guess its not possible to handle with submit statement...

  • Error Handling with OCCI

    Hi,
    is there any function available in OCCI to register user defined function with error handler, "just like RougeWave setErrorHandler"
    Thanks

    OCCI uses C++ exceptions (OCCI class SQLException) mechanism for errors. Can you please explain the error handler approach and its advantages?
    Thanks,
    Shankar

  • Error handling with selecting new lines

    Hi All,
    Please help me on this.
    Step 1 : Enter transaction MD07.
                   Material : 312507
                  MRP Area : w8prod
                   PLant : w8
    Step 2 : Double click on  "PurRqs".
    Step 3 : Click on -> Purchase order button.
    While recording i will follow this procedure,if i again execute the same scripts it will double click on same "PurRqs".
    But what i needed is that it has to click on next line.ie.,new "PurRqs".
    How will i solve this Error handling?
    Regards,
    Sam

    Hi kiran,
    Thanks for the reply.
    Now you can able to execute step 2.
    Double click on PurRqs(0013201371) and try to execute.
    My question is if i try to record with this PurRqs(0013201371) then if i again execute it has to take new PurRqs(0013201372).
    How to handle this parametrization.
    Script name : Z_MM_PACKAGING_27_TS
    Facing problem in this command : SAPGUI ( SAPGUI_9_1 ).
    So please help me on this.
    Regards,
    Sam

  • Error Handling with JPA

    I'm working on a JPA/TopLink Essentials/ADF faces application. It's going well except that I don't have a clue how to get on top of the error handling. JPA doesn't seem to have any. I would assume that there must be a Toplink extension[b] to find out what errors/codes etc are being produced. ADF faces does a ok job of showing them on screen but the handling should be more user friendly for errors like invalid foreign key, unique key violation etc.
    Since there is no return and no exceptions declared on JPA functions like persist(), I assume that there must be some sort of listener that I can register to handle the errors myself. If ADF Faces can get the errors then so can I, but how??
    Any help would be appreciated
    Mark

    The "errors" raised by the persistence provider for the types of "errors" you mentioned are all runtime exceptions of the PersistenceException variety. See the javadoc for this class and also look at its subclasses: http://java.sun.com/javaee/5/docs/api/javax/persistence/PersistenceException.html
    Since PersistenceException is an unchecked runtime exception, its up to you to catch it at whatever point you decide to handle these types of problems in your application (i.e. in the service layer which would communicate the problem to your view layer to display something user friendly). Make sense?

  • Error handling with cmdlnlauncher.bat

    Hi,
    I'm trying to figure out how to incorportate error handling when calling CmdLnLauncher.bat in a .bat file. I checked for 'errorlevel' after a business rule failure and it's 0, which says it was successful. Has anyone added error handling to the CmdLnlauncher batch process?
    Thanks,
    Vicki

    user5519435 wrote:
    Hi,
    I'm trying to figure out how to incorportate error handling when calling CmdLnLauncher.bat in a .bat file. I checked for 'errorlevel' after a business rule failure and it's 0, which says it was successful. Has anyone added error handling to the CmdLnlauncher batch process?
    Thanks,
    VickiI have the same requirements and now checking whether we can check the error codes returned.

  • Please brief Describes about error handling with example

    dear
    please describe about error handling and exception handling

    Darryl Burke wrote:
    This is the third thread you have started here, without bothering to reply to responses on the two earlier threads. Not the best way to continue to get help on a forum, that.Not to mention the fact that it's a horribly broad and vague question that is better answered by a combination of books, tutorials, and google searches.

  • 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.

Maybe you are looking for