Recommended way to abort parsing in SAXParser

Hi,
I'm having a usecase where I'm parsing an XML document using SAXParser. In this usecase I'm interested in just finding out the values of few nodes, and I want to stop/abort the SAXParser parser as soon as I have found those values.
One way I could do it was to throw the SAXException to make the parser abort at the point when I have found the node values I was looking for. Second way I tried was to call reset() method on the SAXParser instance. The SAXException approach is not a clean one and for the second one I'm not sure about its performance usefulness.
I'll appreiate if someone could share with me the recommended way to stop/abort the parsing in such a situation.
Regards

Throwing an Exception seems reasonable

Similar Messages

  • Recommended way to end a parse ?

    In cases where a XML stream is being read from a file, it is
    fairly simple to have the parse end when the end of the file has
    been detected. When parsers are used with other streams like
    those from a servlet request, it is not as clear when the stream
    ends - this leads to the parser waiting for more input from the
    stream when there is none..
    What is the recommended way of ending the parse of a document if
    the ending can be detected by the DocumentHandler ? One approach
    that I've used (somewhat unsuccesfully with the Oracle Parser) is
    to throw a specific type of exception from the endElement() call
    and checking for this exception in the method that initiated the
    parse.
    The Lark XML parser allow every doETag, doSTag etc method to
    return a boolean value indicating if the parse needs to be ended
    at that point - what is the SAX equivalent for this functionality
    null

    Well, unfortunately, it's kind of a mixed bag... Some of the items in there can be quite machine specific, others (say some of the network settings) can be more "generally useful".
    System Image Utility makes no effort to clean up this directory which, as you noted, can cause some issues with port mappings... but allows some other things to work transparently.

  • Is there a way to abort a processing thread

    Straight forward question... How do I handle timeouts for server-side script execution in a web server?
    Let's say I have a very simple server that only handles one request at a time... A request arrives for a webpage including a piece of some server-side script (that may contain an infinite loop). My server parses the request and starts executing the corresponding script in a new thread. Now, I could do join(timeout) on this thread and then call stop() if the script is still executing... the problem is that stop() is depricated and thus it feels like the wrong approach. But what are my alternatives?

    >
    Re: Is there a way to abort a processing threadNo, there isn't.
    Straight forward question... How do I handle timeouts for server-side script execution in a web server?From the client end or on the server? If it's on the server see the first reply
    Let's say I have a very simple server that only handles one request at a time... A request arrives for a webpage including a piece of some server-side script (that may contain an infinite loop).In general, this is a very very bad thing. You never want to expose functionality to a client that could put you into an infinite loop or kill your system somehow.
    For more information, google for "SQL injection", see what that is and why it's very very evil
    My server parses the request and starts executing the corresponding script in a new thread. Now, I could do join(timeout) on this thread and then call stop() if the script is still executing... the problem is that stop() is depricated and thus it feels like the wrong approach. But what are my alternatives?Stop() is not only deprecated, but it's not implemented / non-functional (at least on my machine).
    The best alternative is not to run anything that you aren't confident at compile time will return in finite time.
    Another alternative that I do not recommend is that there is a debug API... I forget the name - something used in IDEs to get the state of threads + mem, etc. Honestly, I don't think that even that will allow you terminate a thread, but you might want to look into it.

  • Oracle.xml.parser.v2.SAXParser error

    I'm reposting this error that I recently received one more time before removing the XML transforms from my Java projects and doing them in .NET.
    Code that was working fine suddenly getting a transform error using JDeveloper.
    Get the following:
    javax.servlet.ServletException: javax.xml.transform.TransformerConfigurationException: XML-22000: (Fatal Error) Error while parsing XSL file (weblogic.xml.jaxp.RegistryXMLReader cannot be cast to oracle.xml.parser.v2.SAXParser).
         at weblogic.servlet.jsp.PageContextImpl.handlePageException(PageContextImpl.java:417)
    Seems that
    <!--
    <%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <h1>Project Weekly Hours Worked</h1>
    <table>
    <c:import url="HoursWorked.xml" var="xmlHoursWorked" charEncoding="windows-1252"/>
    <c:import url="./HoursWorked3.xsl" var="xslt" charEncoding="windows-1252"/>
    <x:transform xml="${xmlHoursWorked}" xslt="${xslt}" />
    </table>
    -->
    will not transform XML to HTML via XSL in JSP anymore.
    If I run the XSL i get the HTML results I expected in an HTML test page.
    So I know the XML and XSL is sound.
    XSL and DOM parsing in Java/Oracle was a major pain in the ass in the first place and now this.
    Well I've spent hours going through Oralce/Java documentation on XML, DOM and XSL transforms.
    All that time spent and still so unstable. I don't think I was ever able to really get what I wanted
    which was to transform my XML document to HTML, update via JSP and have the XML document
    be updated and ready to view in a summary page. The XML document changes were never really
    available unless I closed the app and restarted. So all in all a failure of capabilities compared to my
    use of XML in .NET.
    So........
    Me thinks it will be a good idea to take out the transforms and have my JSP use a script to invoke a
    method in a class that extracts it from a message. Just have PL/SQL interface with XML and do the
    transform or serialize thing there.
    I don't want to give up on XML but I'm tired of trying to jam a square peg into a round hole
    with Java and JDeveloper.
    Brian

    We don't support file references ("cv1_0.dtd"). Only url type references
    are supported, of the form:
    @ <!DOCTYPE cv1 SYSTEM "http://www.oracle.com/public/cv1_0.dtd>
    Note that the url should be accessible to the world without the need to authenticate.
    you could put your dtd in the "public" area in your iFS system.
    Thanks,
    Sirisha
    null

  • What is the recommended way to launch a web-start enabled Java application?

    Hello,
    I have a simple web-start enabled Java application, which I can launch from a brower by entering :
    https://xx.xx.x.xxx/MyApp/launch.html
    This method would show me a page. I then had to click on a link to run my application.
    I noticed that I could also launch my program by entering :
    https://xx.xx.x.xxx/MyApp/launch.jnlp
    This method would run my application right away.
    I wonder if there is a recommended way to launch/run a web-start enabled Java application?
    Thank you,
    Akino

    user8708553 wrote:
    ..to directly launch my application and bypass the HTML page, why is there a need to
    display the HTML page and make the user do a click?There are a number of advantages to using the web page. Including..
    <li> An explanation to the end-user of what the application does (a 'sales pitch').
    <li> Provision of screen shots of the app. (more 'sales pitch').
    <li> A description of what security environment it requires, and why.
    <li> Access to using the deployJava.js* to ensure the end-user actually has Java installed & has a suitable minimum version of Java, before they ever get access to the launch button/link.
    * http://download.oracle.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#deployingApplications

  • What is the recommended way to migrate a RH8 project to another PC?

    I am hoping to get advice on the recommended way to migrate a RH8 project to another PC – the project has been upgraded from earlier version of RH and other users and appears to be carrying a lot of baggage (strange and exotic files). I looked for an “export” function but failed to see any guidance on this in the forums. Hope you can help.

    Zip the folder on PC1. Copy the zip to PC2. Unzip it.
    Any tidying up has to be done manually. See Reports > Unused Files.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • What is the recommended way to upgrade system ruby and python binaries and their libraries?

    I'd like to upgrade my system ruby to 1.9.2 instead of old 1.8.7. Also was wondering what's the recommended way of upgrading any scripting languages installed on system?

    Hi Sogaard,
    see below:
    How does SAP recommend to integrate Webi-report in the SAP Portal? Is it through an URL iview, the iview templates (thumbnail, folder and alert) or through the Master Iview?
    The sample iViews are just samples for a particular case. The iView template allows you to use any application on the BusinessObjects system - including the viewing of content. What you are looking for is the creation process for WebI. So you have 2 options: you can use the KM integration and you can build a java application that offers the workflow you looking for and integrate it with the iView template
    Depending on what method should be used, I'd like to know which settings to be focused on. For instance, if the Master Iview is to be used, should opendocument be used instead of reports? And what other customizations will have to be done in order to integrate a Webi-report instead of a Crystal-Report?
    OpenDocument is for viewing reports. The Installation Guide outlines the integration of the iView template and the KM part.
    What is the intended use for the BOBJ repositoy manager? Would that be the way to integrate the Info-view?
    This is the integration into the KM repository which provides a richer functionality then just an iView.
    Ingo

  • What is the recommended way for persisting JMS messages?

    What is the recommended way for persisting JMS messages?. As per the IMQ admin documentation , using the default built-in persistence type which is through unix flat files is much efficient and faster, compared to the database persistence .
    Tried setting up the jdbc stuff for database persistence on iAS 6.5 . I am getting the following
    error .
    [24/Apr/2002:16:09:20 PDT] [B1060]: Loading persistent data...
    [24/Apr/2002:16:09:21 PDT] Using plugged in persistent store: database connection
    url=jdbc:oracle:thin:@dbatool.mygazoo.com:1521:qa1 brokerid=ias01
    [24/Apr/2002:16:09:23 PDT] [B1039]: Broker "jmqbroker" ready.
    [24/Apr/2002:16:11:56 PDT] ERROR [B4012]: Failed to persist interest
    SystemManager%3ASystemManagerEngine%2BiMQ+Destination%0AgetName%28%29%3A%09%09SM_Response%0AClass%3A%09%09%09com.sun.messaging.Topic%0AgetVERSION%28%29%3A%09%092.0%0AisReadonly%28%29%3A%09%09false%0AgetProperties%28%29%3A%09%7BJMQDestinationName%3DSM_Response%2C+JMQDestinationDescription%3DA+Description+for+the+Destination+Object%7D:
    java.sql.SQLException: ORA-01401: inserted value too large for column
    [24/Apr/2002:16:11:56 PDT] WARNING [B2009]: Creation of consumer SM_Response to destination 1
    failed:com.sun.messaging.jmq.jmsserver.util.BrokerException: Failed to persist interest
    SystemManager%3ASystemManagerEngine%2BiMQ+Destination%0AgetName%28%29%3A%09%09SM_Response%0AClass%3A%09%09%09com.sun.messaging.Topic%0AgetVERSION%28%29%3A%09%092.0%0AisReadonly%28%29%3A%09%09false%0AgetProperties%28%29%3A%09%7BJMQDestinationName%3DSM_Response%2C+JMQDestinationDescription%3DA+Description+for+the+Destination+Object%7D:
    java.sql.SQLException: ORA-01401: inserted value too large for column
    Any thoughts?

    From the output, you are using imq 2.0. In that release
    the key used to persist a durable subscriber in the database
    table has a limit of 100 characters. The output shows that
    your value is:
    SystemManager%3ASystemManagerEngine%2BiMQ+Destination%0AgetName%28%29%3A%09%09SM_Res
    ponse%0AClass%3A%09%09%09com.sun.messaging.Topic%0AgetVERSION%28%29%3A%09%092.0%0Ais
    Readonly%28%29%3A%09%09false%0AgetProperties%28%29%3A%09%7BJMQDestinationName%3DSM_R
    esponse%2C+JMQDestinationDescription%3DA+Description+for+the+Destination+Object%7D:
    which is much longer than 100 characters.
    You might want to shorten the string you use for the
    durable name.
    And yes, the default file-based persistence store is
    more efficient when compared to the plugged-in persistence
    through a database.

  • What is the recommended way to truncate tables in ODI?

    I want to create a separate step to truncate the result tables, before the start of the actual job. What is the recommended way of doing this?
    I am currently putting the truncate statements in the ODI procedure, but that has a lot of typing. Is there a odi command in the toolbox that I can use?
    Thanks.

    Ok,
    If the table will be loaded by interfaces, you have the "Truncate" option at the IKM's, just change it to "Yes".
    If you need to Truncate but they won't be loaded by Interfaces a possible way is:
    - requirements: it will be necessary to have some common "string" at tables names.
    1) create a procedure
    2) create an step
    3) at source tab put:
    Select table_name from user_tables where table_name in '%THE_STRING%'
    4) at target tab put:
    Truncate table #table_name
    If you don't have a common "string" you, instead, can create a table with all table names that you need to truncate and change the select command at 3).
    Does it help you?
    Message was edited by:
    Cezar_Santos

  • What is the recommended way of connecting to repository out of WebDAV, RMI, JNDI and JCA connector ?

    What is the recommended way of connecting to repository out of WebDAV, RMI, JNDI, and JCA connector possibilities provided by CQ 5.5?

    Hi dp_adusumalli,
    I recognized your list of ~8 questions you posted at around the same time, as I received that same list in our customer implementation from Arif A., from the India team, visiting San Jose. :-)
    I provided him feedback for most of the questions, so please check back with Arif for that info.
    For this particular question, can you provide specifics for the types of interactions you are interested in?
    Understanding the kinds of things you need to achieve will help determine which of the CQ/CRX interfaces is best suited for the task(s).
    I've collated a few points on this subject on this page:
    Manipulating the Adobe WEM/CQ JCR
    Regards,
    Paul

  • Recommended way to secure my TCP/IP Communication

    This may be basic, sorry, but I never had to worry about this.
    What is the recommended way to secure my TCP/IP communication?
    I will have a simple server listening on a TCP socket and servicing client requests. Unfortunately, the server must run at a site only accessible to the client via the internet. The client is a .NET (C#) application. Typically, I'd connect the 2 easily with standard sockets and be done. In this case, I must protect the information being transfered.
    What would you use? SSL? I am not too familiar on how to do this on the .NET end.

    A common way to secure communications over TCP is SSL, yes. If your question is "How do use SSL in my .NET client?" then perhaps you should seek a more appropriate forum.

  • Recommended way of getting entity manager from pojo class

    Hi,
    In our application we have the need or retrieving entity manager from 'pojo' classes.
    More specifically we have singleton classes which act as 'data' repositories and are accessed from both servlets and ejb.
    I'm aware that the repositories classes might be problematic, but in the current stage we can't perform significant change in application structure so I am looking for a 'fast' solution as possible.
    The best way will be to lookup entityt manager in JNDI, but as I undestand this feature is not avaialabe in weblogic.
    I understand that the preffered way for getting entity manager in such situation is by using @PersistenceUnit annotion on the calling location and lookup entityManager by that name in the pojo. This is however problematic for us since since we access the repositories from variouse locations (many different classes).
    Possible additional solutions we thought of:
    - creating an 'entity manager factory' locator ejb. This is an ejb with no transaction attribute, which has one method getEntityManagerFactory. It injects entityManagerFactory and returns it. This is the fastest soltion to implement. Is this a valid one?
    - using application managed entity manager in such situations. We have a problem doing so now because the creation seems to fail for variouse reasons.
    What is the recommended way?
    Thanks.

    To obtain an EntityManager instance, first must obtain an EntityManagerFactory instance by injecting it into the application component by means of the javax.persistence.PersistenceUnit annotation:
    @PersistenceUnit
    EntityManagerFactory emf;
    Then, obtain an EntityManager from the EntityManagerFactory instance:
    EntityManager em = emf.createEntityManager();
    http://download.oracle.com/javaee/5/tutorial/doc/bnbqw.html
    Edited by: dvohra16 on Apr 14, 2011 5:06 PM

  • Recommended way to start db on oracle10g asm in cluster

    We have a oracle 10g asm instance running on Solaris 10 cluster. During maintenance activity, we shutdown the database using cluster but startup of the database is carried out by DBA & not thru cluster. We then start the cluster service of the database after the manual startup. Is this fine & we can continue this practise or the recommended way is to start db thru cluster?

    you can enable the database to startup automatically and test it by adding the asm database in the Oracle Clusterware.
    http://docs.oracle.com/cd/B19306_01/rac.102/b14197/srvctladmin.htm
    srvctl enable asm -n node_name [-i asm_inst_name]

  • Recommended way for Oracle SDO_GEOMETRY

    I'm going to be using coldfusion<>oracle spatial db to retrieve location data. Oracle does this with an SDO_GEOMETRY data type which holds location data, in my case somewhere in there will be point data which will have a longitude and latitude.
    since i intend to plug this all into a datagrid and do crud type stuff i was wondering what the recommended way is for coldfusion to define and use this type for crud type sql statements
    Thx.

    Why don't you start by taking an AWR report from those two hours so you can see what is the bottleneck for your system ?

  • Recommended way to send an email?

    Hi,
    I'm using EJB3, ADF Faces
    I need to send an email. Is there a standard/recommended way of doing so using the container/framework, or should I just use Java Mail/Commons Mail and do it myself?
    R

    Before you start using JavaMail or Commons Mail, check the J2EE documentation on how to get the Mail session from the J2EE container.
    --olaf                                                                                                                                                                                                                                                                                               

Maybe you are looking for