Can i use SAX,DOM or JDOM within JAX-RPC ?

Dear all,
Im trying to create a web service , with methods that recive Element parameters (which i changed to strings) , and then parsing my xml node and returning objects. Im facing this error while creating the web service files: "java.loang.StackTraceElement does not have a public accessible empty constructor" .... This error appears with using one of the XML parsers ... an example of one method:
public QuizInfo readXmlFile(int id, String clientId, String distId) throws RemoteException,org.jdom.JDOMException, Exception
      QuizInfo QuizObj = new QuizInfo();
       SAXBuilder builder = new SAXBuilder();
       Document doc = builder.build(new File( "c:quiz.xml"));
       Element firstNode = doc.getRootElement();
.....can I use any xml parser within a method that i will use in my JAX-RPC web service ? and if , can anyone show me how ?
thanx in advance

Dear all ..... I found it !!!
first of all , make sure that all the names of your methods used in your web service begins with a small letter !! thats one ... another thing is that i made another class that only calls the methods of the original class with the implementation , example of what im saying , remember the readXmlFile in the original class ... ok .. make another class, lets say its called CallServiceClass , with a method that calls the readXmlFile method in the originalService
public QuizInfo readXmlFile(int id, String clientId, String distId) throws Exception{
          return originalService.readXmlFile( id,  clientId,  distId);
     }and then create the web service from the new class CallServiceClass !
note that i threw an Exception , not a JDomException ... also note that for some IDEs , it will require that the method is a static method.

Similar Messages

  • Have purchased Adobe CC today. How many more apps I can use apart from photoshop, illustrator and indesign. Can I use all the listed apps within the membership fees charged per month? Or I will be charged extra?

    Have purchased Adobe CC today. How many more apps I can use apart from photoshop, illustrator and indesign. Can I use all the listed apps within the membership fees charged per month? Or I will be charged extra?

    Cloud Plans https://creative.adobe.com/plans
    -and subscription terms http://www.adobe.com/misc/subscription_terms.html
    -what is in the entire Cloud http://www.adobe.com/creativecloud/catalog/desktop.html

  • Can I Use  SAX  and DOM in same application?

    Hi,
    Here is my requirement. I am using Apache's SAX parser for my appliaction. The below xml is the sample xml i am processing.How can I know the parent of element 'C' using sax? Is there any way i can differentiate the element under <B> and under <A>? Or do i need to use DOM, when you encouter <C> and find out it's parent.?
    If any one had this situation,Please respond with some code examples.
    <A>
    <B>
    <C>aa</C>
    </B>
    <C>bb</C>
    </A>
    Thanx

    When using SAX, your application is notified about nodes as the parser encounters them, sequentially. There is no concept of a parent/child relationship for elements. When using SAX, you must develop this logic yourself.
    When using DOM, the contents of the XML file are read into a tree structure. If you have a reference to the node object that represents "C", you can get a reference to its parent by calling getParentNode().
    Hope this helps.
    Greg
    >
    Hi,
    Here is my requirement. I am using Apache's SAX parser
    for my appliaction. The below xml is the sample xml i
    am processing.How can I know the parent of element 'C'
    using sax? Is there any way i can differentiate the
    element under <B> and under <A>? Or do i need to
    use DOM, when you encouter <C> and find out it's
    parent.?
    If any one had this situation,Please respond with
    some code examples.
    <A>
    <B>
    <C>aa</C>
    </B>
    <C>bb</C>
    </A>
    Thanx

  • Guide Lines to Use SAX,DOM using javax.xml. * files only, I

    Hi Respected Recievers,
    My Name is Surya, i am working as a Java
    Programmer.
    I need JAR files to run SAX and DOM properly.
    I don't want to Use xerces.jar or jaxp.jar files, i will use only javax.xml.* files only.
    Could provide some examples on those topics like reading,modifying,the files using SAX and DOM.
    Thanks&Regards
    Surya

    Add rt.jar to Classpath.
    DOM Tutorial
    http://java.sun.com/webservices/docs/1.0/tutorial/doc/JAXPDOM3.html
    SAX tutorial
    http://java.sun.com/j2ee/1.4/docs/tutorial-update2/doc/JAXPSAX.html

  • How can I use SAX to Read XML in JSP?

    I created a class which extend DefaultHandler of SAX. I can use java to call this class and read XML data without any problems. But I can't call this class through JSP. Looks it didn't active startElement() when I called from JSP. Do you have any ideas on this case?
    ======================This is java call and works==============
    import java.io.*;
    import java.util.*;
    import ReadXmlSax;
    public class ReadElement
         public static void main(String argv[])
              ReadXmlSax r = new ReadXmlSax();
              Enumeration e = r.getAttribute("dre.xml","server","name");
              try{
                   while (e.hasMoreElements()) {
                   System.out.println((String)e.nextElement());}
              }catch(Throwable t){
                   t.printStackTrace();
    ======================================================================
    ========================This is jsp call but doesn't work=============
    <%@ page import = "java.util.*" %>
    <%@ page import = "java.io.*" %>
    <%@ page import = "ReadXmlSax" %>
    <html>
    <head><title>SAX Reader</title></head>
    <body>
    <%
    ReadXmlSax r = new ReadXmlSax();
    Enumeration e = r.getAttribute("dre.xml","server","name");
    while (e.hasMoreElements()) {
    out.println(e.nextElement());
    out.println("<br>");
    %>
    </body>
    </html>
    ======================================================================

    maybe you just simply can't reach dre.xml from your web server!

  • How can I use the up & down arrows within a split screen email?

    When I'm reading a split screen email (in Yahoo), I have to use the scroll bar to go up and down WITHIN the email. I would like to set it up so that I can use the arrow keys to scroll up and down the email content. Thanks.

    Click once in the split-side where you want to use the scroll arrows, to make the "focus" there.

  • XML validation using XDK DOM/SAX Parser

    Hello,
    I am trying to validate xml against xsd using SAX/DOM parser, both the files are stored as CLOB column in the database. I have the requirement to report all the validation errors and based on some helpful advice/code from the earlier posts in this forum, I have used the following code to validate and report the errors.
    The code works fine but for large files it never goes beyond a certain number of errors i.e. getNumMessages() (XMLParseException) never returns value greater than 100 and thus limits the output of the validation errors. Any pointers to suggest change in code or an alternative will be extremely helpful.
    Datebase Version : Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED as package <package name>;
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import java.sql.SQLException;
    import oracle.sql.CLOB;
    import oracle.xml.parser.schema.*;
    import oracle.xml.parser.v2.*;
    import org.w3c.dom.*;
    public class XMLSchemaVal
    public static String validate(CLOB xmlDoc, CLOB xsdDoc)
    throws Exception
    //Build Schema Object
    XSDBuilder builder = new XSDBuilder();
    Reader xsdInUnicodeFormat = xsdDoc.getCharacterStream();
    XMLSchema schemadoc = (XMLSchema)builder.build(xsdInUnicodeFormat, null);
    //Build XML Object
    Reader xmlInUnicodeFormat = xmlDoc.getCharacterStream();
    // Genereate the SAX
    SAXParser saxparser_doc = new SAXParser();
    // Set Schema Object for Validation
    saxparser_doc.setXMLSchema(schemadoc);
    saxparser_doc.setValidationMode(XMLParser.SCHEMA_VALIDATION);
    saxparser_doc.setPreserveWhitespace (true);
    String returnValue;
    try {
    saxparser_doc.parse (xmlInUnicodeFormat);
    returnValue = "The input XML parsed without errors.\n";
    catch (XMLParseException se) {
    returnValue = "Parser Exception: ";
    for (int i=0 ; i < se.getNumMessages(); i++)
    returnValue += "<LN: " + se.getLineNumber(i) + ">: " + se.getMessage(i);
    //returnValue = "Parser Exception: " + se.getNumMessages();
    catch (Exception e) {
    returnValue = "NonParserException: " + e.getMessage();
    return returnValue;
    Function to call the above utility from PL/SQL
    CREATE OR REPLACE FUNCTION F_XMLSCHEMAVALIDATION (P_XML IN clob ,P_XSD IN clob) RETURN VARCHAR2 IS
    LANGUAGE JAVA NAME XMLSchemaVal.validate(oracle.sql.CLOB,oracle.sql.CLOB) return java.lang.String';
    Thanks.

    I have the same question. I have an external DTD. I wish to parse an xml file using XMLParser.xmlparse. If I first call XMLParser.xmlparseDTD and then call xmlparse with the XML_FLAG_VALIDATE will the xml automatically be validated against the previously parsed DTD? There is no DOCTYPE declaration in the xml file.
    The demo code on OTN for Java is great but has no relation to the code you would use in C++ (no set functions in C++).

  • XML Validation using XDK SAX/DOM Parser

    Hello,
    I am trying to validate xml against xsd using SAX/DOM parser, both the files are stored as CLOB column in the database. I have the requirement to report all the validation errors and based on some helpful advice/code from the earlier posts in this forum, I have used the following code to validate and report the errors.
    The code works fine but for large files it never goes beyond a certain number of errors i.e. getNumMessages() (XMLParseException) never returns value greater than 100 and thus limits the output of the validation errors. Any pointers to suggest change in code or an alternative will be extremely helpful.
    Datebase Version : Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED <> as package <package name>;
    import java.net.*;
    import java.io.*;
    import java.util.*;
    import java.sql.SQLException;
    import oracle.sql.CLOB;
    import oracle.xml.parser.schema.*;
    import oracle.xml.parser.v2.*;
    import org.w3c.dom.*;
    public class XMLSchemaVal
    public static String validate(CLOB xmlDoc, CLOB xsdDoc)
    throws Exception
    //Build Schema Object
    XSDBuilder builder = new XSDBuilder();
    Reader xsdInUnicodeFormat = xsdDoc.getCharacterStream();
    XMLSchema schemadoc = (XMLSchema)builder.build(xsdInUnicodeFormat, null);
    //Build XML Object
    Reader xmlInUnicodeFormat = xmlDoc.getCharacterStream();
    // Genereate the SAX
    SAXParser saxparser_doc = new SAXParser();
    // Set Schema Object for Validation
    saxparser_doc.setXMLSchema(schemadoc);
    saxparser_doc.setValidationMode(XMLParser.SCHEMA_VALIDATION);
    saxparser_doc.setPreserveWhitespace (true);
    String returnValue;
    try {
    saxparser_doc.parse (xmlInUnicodeFormat);
    returnValue = "The input XML parsed without errors.\n";
    catch (XMLParseException se) {
    returnValue = "Parser Exception: ";
    for (int i=0 ; i < se.getNumMessages(); i++)
    returnValue += "<LN: " + se.getLineNumber(i) + ">: " + se.getMessage(i);
    //returnValue = "Parser Exception: " + se.getNumMessages();
    catch (Exception e) {
    returnValue = "NonParserException: " + e.getMessage();
    return returnValue;
    Function to call the above utility from PL/SQL
    CREATE OR REPLACE FUNCTION F_XMLSCHEMAVALIDATION (P_XML IN clob ,P_XSD IN clob) RETURN VARCHAR2 IS
    LANGUAGE JAVA NAME XMLSchemaVal.validate(oracle.sql.CLOB,oracle.sql.CLOB) return java.lang.String';
    Thanks.

    Got the answer !!!
    NetBeans it self support generation of dtd file based on XML file.
    Open XML file and right click on the code block. Select option to generate dtd file.
    This is the drtd file it has generated..
    <?xml version='1.0' encoding='UTF-8'?>
    <!--- Put your DTDDoc comment here. -->
    <!ELEMENT book (person)*>
    <!--- Put your DTDDoc comment here. -->
    <!ELEMENT person (age|last|first)*>
    <!--- Put your DTDDoc comment here. -->
    <!ELEMENT first (#PCDATA)>
    <!--- Put your DTDDoc comment here. -->
    <!ELEMENT last (#PCDATA)>
    <!--- Put your DTDDoc comment here. -->
    <!ELEMENT age (#PCDATA)>

  • Can we use FILE IO in File Adapter ? If not, Why?

    Hello,
    I want to clarrify one important issue of FIle Adapter.
    Can we use FILE I/O in case of File  Adapter to process the files.
    PLease explain me with a reason and a sample example.
    Thanks,
    Soorya.

    I think you can handle File IO in Java Mapping by using
    public void execute(InputStream in, OutputStream out)
    // Here You can desired the output from source XML structure by using SAX/DOM parser to Target XML file.

  • Can I use multiple iPhoto libraries with Aperture?

    I've been using iPhoto to manage my photos (successfully) for many years.  I have multiple themed iPhoto libraries with many thousands of photos in them (ten years' worth of digital plus another fifty years scanned).  I am thinking of downloading Aperture and giving it a try (thanks to an App Store gift card).
    Can I use Aperture to edit photos within these iPhoto libraries?  Do the libraries become "common" to both applications, or does duplication occur?  I have limited hard drive space and don't want to create large duplicate files on my iMac.
    Thanks.

    luba petrusha wrote:
    I have some 50-100 libraries (haven't counted recently) which occupy most of my hard drive.  I find it easiest to manage my photos with themed libraries (annual, trip, subject).
    You could make each of your "themed Libraries" a Folder in Aperture, with all your current Projects and Albums intact.  In this way, you could search across all of your Image at once (e.g.: a Smart Album showing all Images in which you've identified a Face as "Mom"; or filter for the keyword "Sunset").  In general, the more Images in a Library, the more useful that Library is.  I strongly recommend one Library for each photographer (or group of photographers working as a business).  Aperture has no trouble handling enormous Libraries (officially, it supports up to 1,000,000 Images, iirc).
    A more advanced Library organization would replace each "themed" Folder+Projects with Albums.  There is no reason to limit your "themes" to the Images in just the Projects contained in a Folder.
    My general recommendation has always been to put all your Projects in one Folder (with sub-Folders as needed); and to put all your Albums in another top-level Folder.  In this way you build two structures: a _storage_ structure, in which you put all your Projects, where each Project = one shoot, and an _access_ structure, where you have Albums organized by Folders into whatever groupings you need.
    The newest version of Aperture (3.3.1) leans in this direction.  For the first time there is a default division between Project storage and Album storage (one the Library tab of the Inspector, there are now two built-in top-level containers, one for Projects and one for Albums).
    A separate issue is where on your system your Library and your Originals are stored.  Aperture allows you to move your Originals to storage on external drives or other non-system drives.  The limitation of the storage available on the system drive is something that all active photographers encounter at some point.  (In Aperture-speak, you would convert Image's Originals from Managed to Referenced using "File➞Relocate Originals".  This isn't something I'd look into right away, but rather after you become familiar with the Aperture interface.

  • How can i use the project code instead of project xml?

    hello
    i use the sessionbean+toplink structure,after i finish the o-r mapping by using the mapping work bench,i generate the project xml file,then in the "session.xml" file,i refer to the project xml,then i can use it from sessionbean.
    i hear that if i use the project code instead of project xml file,it will be more performant,is that true?
    otherwise,how can i use the project code instead of project xml file?i mean, in "session.xml", i can use the "<project-xml>" tag to refer to the project xml file,then in my session bean,i get the server session by read the "session.xml" file.but if i use the project code,how can i refer it from the "session.xml"?the examples that come with the toplink installation only tell me how can i use the project xml file within the session bean,it don't give me any clue about using the project code in the sesion bean,who can give me a step-by-step instruction and code snippet?
    thank you very much?

    There is a slight performance gain during session load at startup but there is no difference at runtime. The choice of which to use is dependent upon you build process. Whether it is easier to submit a new version of the class into the comile build process vs an XML file. In most cases it is just a preference of the development team.
    When you use the project-class you'll need to generate the source code and compile it into your system. Typically it is packaged with the persistent classes. You may need to configure your environment so that the class-loaders have access to these classes (same for the XML case).
    When using the project-class you simply replace the project-xml entry like this:
    <project-class>oracle.toplink.demos.employee.relational.EmployeeProject</project-class>
    The DTD for the session.xml file is found at <TOPLINK_HOME>\core\sessions_4_5.dtd. It is also in the documentation at:
    http://otn.oracle.com/docs/products/ias/doc_library/90200doc_otn/toplink.903/b10064/a-sessio.htm#634246
    Doug Clarke
    Product Manager
    Oracle9iAS TopLink

  • XML: SAX vs. DOM vs. jDom etc.

    Is there any reason to use SAX or DOM? I mean is jdom always the best choice? Some information?

    http://java.sun.com/webservices/docs/1.0/tutorial/doc/JAXPDOM2.html#67733

  • How can i use connection pool within the sqlj?

    hello
    i am a beginner to sqlj,i find all of the sample code from the oracle DON'T use connectionpool,they only write the database url to "connection.properties" file,but i think in the production environment we should use the connectionpool to optimise the querying,i usually use the weblogic connection pool.
    how can i use the connection pool within the sqlj?
    thank you very much!

    Im not sure if I understand. :)
    English is not my best language...
    Looking up the connection again? Do you mean I have to create new DataSource object and bind it again to ServletContext?

  • I currently have 1,177 photos on my iphone (4s) but it takes up 4.9 GB of space. Why is it so large? I do not use photostream - this is simply within my "Camera Roll". Other than deleting the photos, can someone tell me another solution?

    I currently have 1,177 photos on my iphone (4s) but it takes up 4.9 GB of space. Why is it so large? I do not use photostream - this is simply within my "Camera Roll". Other than deleting the photos, can someone tell me another solution?
    My friend has over 2,000 photos on her iphone and it only used 1.7 GB of space and I know I had at one point over 3,000 photos on my phone and still had space left for more.
    Any tips are greatly appreciated!
    Thanks,
    Melissa.

    When you open your camera app, does it say "HDR on" at the top?
    HDR photos are better quality but take up much more space.
    Also, go to Settings>photos and camera.  Scroll down to "keep normal photo".  Is it on?  This feature saves a normal copy and an HDR copy of every photo you take.
    I bet your friend has this feature turned off along with the HDR as well.

  • How can we get  tag of XML file using SAX

    Hi ,
    I'm parsing one SAX parser , I'have almost done this parsing. i have faced problem for one case, i'e how can we get tag from XML file using SAX parser?
    XML file is
    <DFProperties>
    <AccessType>
    <Get/>
    </AccessType> <Description>
    gdhhd
    </Description>
    <DFFormat>
    <chr/>
    </DFFormat>
    <Scope>
    <Permanent/>
    </Scope>
    <DFTitle>gsgd</DFTitle>
    <DFType>
    <MIME>text/plain</MIME>
    </DFType>
    </DFProperties>
    I want out like GET and Permanent... means this one tag which is present inside of another tag.
    Handler class like
    public void startElement(String namespaceURI, String localName,
                   String qName, Attributes atts) throws SAXException {
    if(_ACCESSTYPE.equals(localName)){
                   accessTypeElement=ACCESSTYPE;
    public void characters(char[] ch, int start, int length)
                   throws SAXException {
    if (_ACCESSTYPE.equals(_accessTypeElement)) {
                   String strValue = new String(ch, start, length);
                   System.out.println("Accestype-----------------------------> " + strValue);
                   //System.out.println(" " + strValue);
    public void endElement(String namespaceURI, String localName, String qName)
                   throws SAXException {
    if (_ACCESSTYPE.equals(localName)) {
                   _accessTypeElement = "";
    . please any body help me

    Hi ,
    I have one problem,Please help me.
    1. How can I'll identify where exactly my Node is ended,means how how can we find corresponding nodename? in partcular place
    <Node> .............starttag1
    <NodeName>Test</NodeName>
    <Node>................starttag2
    <nodeName>test1</NodeName>
    </Node>..................endtag2
    <Node>.....................starttag3
    <NodeName><NodeName>
    <Node> .........................starttag4
    <NodeName>test4</NodeName>
    </Node>.......enddtag4
    </Node>...........end tag3
    </Node>............endtag1
    my code is below
    private final String _NODENAME = "NodeName";
    private final String _NODE = "Node";
    private String _nodeElement = "";
         private String _NodeNameElement = "";
    public void startElement(String namespaceURI, String localName,
                   String qName, Attributes atts) throws SAXException {
    if (_NODENAME.equals(localName)) {
                   NodeNameElement = NODENAME;
    if(_NODE.equals(localName)){
         System.out.println("start");
         if (_NODENAME.equals(localName)) {
                   NodeNameElement = NODENAME;
    public void characters(char[] ch, int start, int length)
                   throws SAXException {
    if (_NODENAME.equals(_NodeNameElement)) {
                   String strValue = new String(ch, start, length);
                   String sttt=strValue;
                   System.out.println("NODENAME: ************* " + strValue);
    if(_NODE.equals(_nodeElement)){
                   if (_NODENAME.equals(_NodeNameElement)) {
                        String strValue = new String(ch, start, length);
                        String sttt=strValue;
                        System.out.println("nodevalue********** " + strValue);
    public void endElement(String namespaceURI, String localName, String qName)
                   throws SAXException {
    if (_NODENAME.equals(localName)) {
                   _NodeNameElement = "";
    if(_NODE.equals(localName)){
                   System.out.println("NODENAME: %%%%%%%%%");
    please help me. How can I figure node ending for particular nodename

Maybe you are looking for

  • Having Problem With Inspire 5.1 5300 rear speaker...

    After using my inspire 5.1 5300 for few year... right now im having problem with my rear speaker... just one channel was unable to start... Anyone know about repairing for speaker ? I Have try to switch to other channel it seem that just that rear sp

  • Firefox not firing the IOErrorEvent

    Firefox not firing the IOErrorEvent when load fails due to unavailability of internet connection in URLLoader. I am loading data in my application based on user actions. If the user is disconnected and he makes a request for data load, the IOErrorEve

  • Compressor is not supported on dual quadcore MacPro (12gb RAM/ATI4870)

    MacPro dual-quadcore with 12gb RAM and ATI radeon 4870 (512MB RAM): - Installed MacOS X Server 10.6 successfully - Installed Final Cut Server 1.5 successfully - Launched Compressor and got this error: "This system does not meet the following min. req

  • On_Insert goes into loop

    Hi, I have a requirement that 2 records should not contain the same value in one of the fields. The form actually has an on_insert trigger that calls a procedure that will insert the record into the database table. For each record on_insert fires onc

  • Firefox not opening a private browsing window instead getting another normal browsing window

    I went through the forum question and found answers and tried that but it does not seem to resolve the problem. Tried the steps given before that doesn't resolve it tried uninstall completely and reinstall with new setup , still not getting the priva