Accessing KM document content  in Portal Code.

Hi friends,
          I have a requirement to access Document stored in Knowlwdge management , while modifying one of the par files.  But I have no idea how to access it in my code.
        Please suggest some solution.
Regards,
Vidit

Hello Vidit,
here is a small piece of java code which shows how to get the content of an document in KM:
          //Get resource RID
          RID rid = RID.getRID("path to dokument"); //For example /documents/example.doc          
          IResource res = null;     
          try {
               IResourceFactory rfac = ResourceFactory.getInstance();
               res = (IResource) rfac.getResource(rid,rfac.getServiceContext("ice_service"));
          } catch (ResourceException re) {
               String sre = re.getLocalizedMessage();
               // Your error handling               
          BufferedInputStream stream = new BufferedInputStream(res.getContent().getInputStream(), 1024);     
          BufferedReader br = new BufferedReader(new InputStreamReader(stream,"windows-1251"));     
Hope it helps, regards.
mz

Similar Messages

  • Accessing the KM Respository through Portal Code.

    Hi,
    I am New to Portal development.
    I want to Access the KM Repository through AbstractPortalComponent.
    Plz Reply ASAP with code.
    Thanks and Regards
    Kiran

    Hi Kiran,
    Here's some sample code that I've got of an abstract portal component that goes through the contents of a KM folder and displays the KM description for the file:
    package com.graybar.portal.titleload;
    import com.sapportals.portal.prt.component.*;
    import java.io.File;
    import java.util.ArrayList;
    import com.sapportals.portal.prt.component.IPortalComponentResponse;
    import com.sapportals.portal.security.usermanagement.*;
    import com.sapportals.wcm.repository.*;
    import com.sapportals.wcm.repository.service.IRepositoryServiceFactory;
    import com.sapportals.wcm.util.uri.*;
    public class TitleLoad extends AbstractPortalComponent {
        public void doContent(IPortalComponentRequest request, IPortalComponentResponse response) {
              response.write("starting... <BR>");     
              response.write("***************************** <BR>");
              IUser user = (IUser)request.getUser().getUser();
              IResourceContext resourceContext = new ResourceContext(user);
              // starting folder
              RID repositoryID = new RID("/documents/TitleLoad");
              // Get the Service
              IRepositoryServiceFactory repServiceFactory = null;
              try {
                   repServiceFactory = ResourceFactory.getInstance().getServiceFactory();
              } catch (Exception ex) {
                   ex.printStackTrace();
              if(repServiceFactory == null) {
                   System.out.println("Repository Service Factory is null!!");
              try {
                   IResource resource = ResourceFactory.getInstance().getResource(repositoryID, resourceContext);
                   if( resource != null ) {
                        if (resource.isCollection()) {
                             ICollection collection = (ICollection)resource;
                             IResourceList children = collection.getChildren();
                             int resourceCounter = 0;
                             String attrType = new String();
                             response.write("size = " + children.size() + "<BR>");
                             IProperty prop = null;
                             String propValue = null;
                             String resRid = null;
                             for (int i = 0; i < children.size(); i++){
                                  String validTo = new String();
                                  ArrayList attributes = new ArrayList();
                                  IResource ir = children.get(i);
                                  if (ir.getRID() != null)
                                       resRid = ir.getRID().toString();
                                  PropertyName propNameP = new PropertyName("http://sapportals.com/xmlns/cm", "description");
                                  prop = ir.getProperty(propNameP);
                                  response.write("before <BR>");
                                  try {
                                       propValue = prop.getStringValue();
                                  } catch (Exception e) {
                                       propValue = "";
                                  response.write("after <BR>");
                                  response.write("Name = " + ir.getName() + "; Description = " + propValue + "<BR>");
                                  resourceCounter++;
                   } else {
                        // resource not found
                        System.out.println("resource " + resource.getRID() + " does not exist");
              } catch( ResourceException e ) {
                // problem while retrieving the resource
                System.out.println("exception while trying to get resource " + e.getRID() + ": " + e.getMessage());
         response.write("finished <BR>");

  • How to access IFS document contents in PL/SQL procedure ?

    I am interested in using IFS as a way to load documents
    (PDF, HTML, RFT, text...) in an Oracle database table, and
    then access the table via a regular application Server.
    I understand that the right way to do this is via a Java API
    mapped on top of IFS.
    But we already have a fairly sophisticated web application using
    Java and PL/SQL procedures so that I would ideally need
    to write a PL/SQL procedure such as :
    function get_document (ifs_file_name in varchar, ifs_file_path in varchar) return clob
    For this I need to outline how to query the IFS schema using SQL.
    Any idea which table to query ?
    Have a nice day

    Many thanks to Chris Schneider : it works. Withing a few hours
    I was able to make a servlet with a file name as a parameter which sends back
    the file contents (in our case its a PDF file).
    Here is a sample servlet which uses this access scheme :
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class TestIFS extends HttpServlet
    * Handle the GET and HEAD methods by building a simple web page.
    * HEAD is just like GET, except that the server returns only the
    * headers (including content length) not the body we write.
    public void doGet (HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException
    //PrintWriter out;
    String title = "Test d'acchs IFS";
    // set content type and other response header fields first
    response.setContentType("application/pdf");
    // then write the data of the response
              ServletOutputStream outbin = response.getOutputStream();
              String theQuery=
         "SELECT "+
         " odm_publicobject.name object_name"+
         ", odmm_contentstore.id content_id"+
         ", odm_format.mimetype"+
         ", odmm_contentstore.globalindexedblob "+
         "FROM odm_publicobject"+
         ", odm_document"+
         ", odm_contentobject"+
         ", odmm_contentstore"+
         ", odm_format "+
         "WHERE odm_publicobject.id = odm_document.id "+
         "AND odm_document.contentobject = odm_contentobject.id "+
         "AND odm_contentobject.content = odmm_contentstore.id "+
         "AND odm_contentobject.format = odm_format.id "+
         "AND odm_publicobject.name = ";
              theQuery += "'" + request.getParameter("fic") + "'";
              try {
                   System.out.println("TestIFS debut");
                   DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
                   Connection conn = DriverManager.getConnection ("jdbc:oracle:oci8:@LXP9","ifssys","ifssys");
                   Statement stmt = conn.createStatement ();
                   ResultSet rset = stmt.executeQuery (theQuery);
                   while (rset.next ()) {
                        byte b[] = new byte[10000000];               
                        b = rset.getBlob(4).getBytes (1,10000000);
                        outbin.write (b);
                   rset.close();
                   System.out.println("TestIFS fin");
              catch (Exception e) {
    (beware mime type is forced to PDF, and file size max 10Mb)

  • No login shown when trying to access documents in the portal km

    I've an strange behaviour on a customer Netweaver 7.0 (SPS 14) system.
    When i try to display an document from the km and i'm not logged on in the system i normaly expect to
    get an dialog where i can make an log on to the system.
    But on this system i receive an error when i try to access km documents without login.
    In the logfile the following error is reported:
    #1#com.sapportals.portal.prt.runtime.PortalRuntimeException: Access is denied: pcd:portal_content/every_user/general/eu_role/com.sap.km.home_ws/com.sap.km.hidden/com.sap.km.urlaccess/com.sap.km.docs - user: J2EE_Guest,
    Caused by: com.sapportals.portal.pcd.gl.PermissionControlException: Access denied (Object(s): portal_content/every_user/general/eu_role/com.sap.km.home_ws/com.sap.km.hidden/com.sap.km.urlaccess/com.sap.km.docs)
    Question is now for me, why do the portal use the J2EE_Guest user and not shown an login screen like i expected it.

    Hi Thomas
    You need to check out the security zone setting as well as the settings for the iview you have referenced in your error in order to get the behavior you like.
    Please see
    http://help.sap.com/saphelp_nw70/helpdata/EN/25/85de55a94c4b5fa7a2d74e8ed201b0/frameset.htm
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/00bfbf7c-7aa1-2910-6b9e-94f4b1d320e1
    and
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/502ca482-d170-2910-ed9a-91408d979d3a.
    Then you should know what to do.
    Best regards,
    Martin Søgaard

  • Error: Object Required apperas when accessing Content Admin Portal Content

    After installing Ep 7.0 sp16 Portal and logging in as Administrator we get
    Error: Object Required apperas when accessing Content Admin >Portal Content
    The same error appears when trying to access System Admin > permissions.
    Anything to do with catolog search is throwing Error: Object Required  popup.
    Appreciate feedback in resolving this.
    Rajesh.R.

    I have just started to get this error as well... On my computer I get the "Error: Object Required" when accessing the Portal Content page but if I log in on someone elses computer using the same browser, OS, etc The error does not appear and I am able to browse the Portal Content.
    Any more insight on the resolution to this issue would be appreciated.

  • Problem in uploading document in KM content in portal

    Hello All,
    I am functional consultant and new to portal.Please help me in resolving below issue .
    I am facing a problem while uploading document in KM content in portal
    When i browse the file from Desktop and click on upload .file does not get uploaded and also  it does not throw any error or info message .
    Please help.
    Thanks
    Archana

    Dear Archana,
    Please refer the SAP Note 898637. Hope it is helpful.
    Regards,
    Samir

  • IFrame accessing the KM content documents

    Hi Folks
    I need a detail clarity on IFRAME
    i am trying to access my KM documents residing at KM Content via my IFRAME.
    //PATHFILE = has my document Path
    <IFRAME SRC='/irj/go/km/docs<%=PATHFILE%>'    WIDTH='100%' HEIGHT='100%' frameborder='0' scrolling='no' >
    I developed a PDK application , Using  IFRAME i am able to access the document of type txt , pdf and all image files
    But i am not able to access the Microsoft documents (like MS word , MS PPT, MS Excel)
    The thing i am looking is, i want to open all the microsoft documents in the same window (i dont want the OPEN ,SAVE , CANCE popup window)
    Can any one throw some pointer over this...........
    Thanks
    Kumar T

    Closing the thread as I didnt find any reply on it.

  • SOLUTION - How to display a BLOB content in Portal Report

    Courtesy of Kelly Wong:
    1. Every time a record of the file information is inserted into the
    PORTAL30.WWDOC_DOCUMENT table while you inserted a record to the blob
    field in a portal form that you created.
    [The fact that a file uploaded appears in the WWDOC_DOCUMENT table is actually a side-effect of Forms file upload, this may change in a future version. However this example gives a pretty good solution to the problem - Dmitry]
    2. If you describe the PORTAL30.WWDOC_DOCUMENT table, you will find
    that a few of the columns are: NAME, FILENAME, MIME_TYPE, BLOB_CONTENT,
    CREATOR, etc.
    3. I created a pl/sql procedure that takes a NAME parameter.
    The code of the procedure is as follows:
    CREATE OR REPLACE Procedure get_url
    (V_FILENAME IN VARCHAR2)
    IS
    url varchar2(100);
    BEGIN
    url := '/pls/portal30/docs/'&#0124; &#0124;v_filename;
    portal30.wwv_redirect.url(p_url =>url);
    END;
    4. I then created a portal report, select NAME, FILENAME, MIMETYPE,
    CREATOR fields from PORTAL30.WWDOC_DOCUMENT. (remember, no BLOB_CONTENT
    field is selected!) My select statement is:
    SELECT '<A
    HREF="scott.get_url?v_filename='&#0124; &#0124;name&#0124; &#0124;'">'&#0124; &#0124;filename&#0124; &#0124;'</A>' filename,
    name,mime_type,creator
    from portal30.wwdoc_document
    where creator = 'KELLY'
    You can see that I am passing in "NAME" instead of "FILENAME" into the
    get_url procedure because the it needs the "NAME" info to display the
    file.
    Actually, the content in the NAME column is something like:"563.TXT",
    and the content in the FILENAME column is "F15675/IPORTAL_LOCAL.TXT".
    The hyperlink can be either on the NAME or FILENAME field, as long as
    you pass in the content of "NAME" into the procedure.
    And it should be fairly easily to substring the FILENAME to show only
    "IPORTAL_LOCAL.TXT" if the client doesn't like to see the number
    portion.
    That is, when I click on the link, I am able to see my file in a new
    browser window.The only drawback in this scenario is if there is a link
    from your document to a portal component (form/report), it may not link
    to the form/report. If there are links in the document link to other
    document (html, txt, etc.), it will be no problem. It just open the
    document in another browser window.
    Please feel free to give me any comment on this and post it to the forum
    if needed. I just don't want to search for the original questions in
    the forum and attach the reply to it.
    Regards;
    Kelly.

    Is this method working also for portal 3.0.9?
    I can't get it to work.
    Is there a way do put a link to download the content of a blob field inside a report in version 3.0.9 that comes with iAS 1.0.2.2?
    Thank's in advance
    Mauro

  • Getting the document content in a variable??

    Hi,
    How can I get the entire contents of a document into a string variable? I donot
    want to print the contents inline but rather have to get them in a variable. Using
    printDoc or printProperty tag?? I guess I will have to use printDoc but then how
    can I stop the contents from being displayed in the jsp and how can I put them
    in a variable??
    Please help me...
    Thanx.
    Prirua

    You should always double-check code put on the newsgroups, even if it's
    put there by me :)
    It probably should be at the beginning:
    <es:forEachInArray array="<%=docs%>" id="adoc"
    type="com.bea.p13n.content.document.Document">
    <%
         byte[] bytes = adoc.getContentBlock(0L, -1L);
    Notice 'byte[]' instead of 'bytes[]', the type specified as Document
    (Content doesn't have the getContentBlock() method, the sub-interface
    Document does), and the 'L's on the numbers to specify that they are
    longs to help the compiler find the correct method.
    Greg
    Prirua wrote:
    Hi,
    Thanx for your propmt reply. My code looks somethinglike this
    <es:forEachInArray array="<%=docs%>" id="adoc" type="com.bea.p13n.content.Content"
              <%
              bytes[] bytes = adoc.getContentBlock(0, -1); // retrieve all the content
              String enc = adoc.getPropertyAsString(null, "encoding");
              String str = null;
              if (enc != null)
                   str = new String(bytes, 0, bytes.length, enc);
              else // use VM default encoding
                   str = new String(bytes);
              %>
              <li>The document title is: <cm:printProperty id="adoc" name="Title" encode="html"
    />
         </es:forEachInArray>
    But it is giving me these two errors...
    C:\bea\wlportal4.0\applications\portal\MyPortal\WEB-INF\_tmp_war_portalDomain_po
    rtalServer_MyPortal\jsp_servlet\_portlets\__contentq.java:152: cannot resolve
    sy
    mbol
    symbol : class bytes
    location: class jsp_servlet._portlets.__contentq
    bytes[] bytes = adoc.getContentBlock(0, -1); // retrieve
    all the content //[ /portlets/contentQ.jsp; Line: 19]
    ^
    C:\bea\wlportal4.0\applications\portal\MyPortal\WEB-INF\_tmp_war_portalDomain_po
    rtalServer_MyPortal\jsp_servlet\_portlets\__contentq.java:152: cannot resolve
    sy
    mbol
    symbol : method getContentBlock (int,int)
    location: interface com.bea.p13n.content.Content
    bytes[] bytes = adoc.getContentBlock(0, -1); // retrieve
    all the content //[ /portlets/contentQ.jsp; Line: 19]
    ^
    2 errors
    Could you plz specify if I have to include some file or something ?
    Thanx.
    Gregory Smith <[email protected]> wrote:
    You will need to call the getContentBlock() method on the Document
    object to retrieve the bytes of the document's content. Then, you do
    whatever you need to with the bytes. When converting it to a String,
    you
    should be aware of double-byte-character encodings, and should check
    the
    Document's encoding metadata attribute, e.g.:
    <%
    bytes[] bytes = doc.getContentBlock(0, -1); // retrieve all the content
    String enc = doc.getPropertyAsString(null, "encoding");
    String str = null;
    if (enc != null)
    str = new String(bytes, 0, bytes.length, enc);
    else // use VM default encoding
    str = new String(bytes);
    %>
    In 8.1, the new <cm:getProperty> is able to retrieve the BinaryValue
    of
    a binary property of a Node.
    Greg
    Prirua wrote:
    Hi,
    How can I get the entire contents of a document into a string variable?I donot
    want to print the contents inline but rather have to get them in a variable.Using
    printDoc or printProperty tag?? I guess I will have to use printDocbut then how
    can I stop the contents from being displayed in the jsp and how canI put them
    in a variable??
    Please help me...
    Thanx.
    Prirua

  • How to read text file content in portal application?

    Hi,
    How do we read text file content in portal application?
    Can anyone forward the code to do do?
    Regards,
    Anagha

    Check the code below. This help you to know how to read the text file content line by line. You can display as you require.
    IUser user = WPUMFactory.getServiceUserFactory().getServiceUser("cmadmin_service");
    IResourceContext resourceContext = new ResourceContext(user);
    String filePath = "/documents/....";
    RID rid = RID.getRID(filePath);
    IResource resource = ResourceFactory.getInstance().getResource(rid,resourceContext);
    InputStream inputStream = resource.getContent().getInputStream();
    BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
    String line = reader.readLine();
    while(line!=null) {
          line = reader.readLine();
         //You can append in string buffer to get file content as string object//
    Regards,
    Yoga

  • Workflow content in portal.

    We have enabled a workflow in UCM and documents are correctly participating in workflow.
    We are showing document in our portal application using content presenter.
    If a contributor creates a new document, it goes for approval. Now if approver login in our portal application he is not able to see document because content presenter is not showing those documents which do not have atleast one release version available. To sumup content presenter only shows release documents and if for a release document there is a new version in workflow, it will allow approve/reject/view of workflow document. BUT for fresh document it does not show anything. Is it right? I believe to approver it should show initial document, which does not have any released version available also. So that approver can approve.
    Spaces User's guide says
    "You can view content items displayed in Content Presenter while they are in a workflow, including Site Studio contributor data files displayed in a Site Studio region template. As long as the content item has at some point had Released status in Content Server, you can display the content item in Content Presenter. Then, if a revision of the content item is pending in workflow, Content Presenter allows approvers for the content item to toggle between the published version and the version in workflow in page edit mode or in-context edit (contributor) mode, and also provides links to approve or reject the item in workflow, and view additional details about the item."
    Is this a limitation with content presenter?
    What could be best possible way to allow approver to approve initial document from a custom portal application. Is there any taskflow, which can show documents waiting approval? Can we integrated it with worklist?
    Thanks
    Sanjeev.

    Hi Jiri, Thank you for your reply.
    I don't have access to unix box so I can't verify 'CollectionreleasedOnly' property. Is there any way to verify it from UCM UI.
    I see everything is working fine in UCM. If contributor check in a new document, approver can see that in 'My workflow assignment'. Problem is only with content presenter. Content presenter does not show new document if its in workflow. Content presenter only shows document if atleast one revision is in released status.
    If we follow these steps:
    1. Contribute checks in a new document --> Document goes in workflow successfully and approver can see document from 'My workflow assignment'. BUT same document is not visible to approver in webcenter portal if content presenter is used to show document. This is the actual problem.
    2. Let say approver approves the document from UCM 'My workflow assignment' --> Now everyone can see the document as its in released status.
    3. Now if contributor checks out and check in a new version --> Document goes in workflow successfully and approver can see document from 'My workflow assignment'. Approver can also see document from content presenter. By default content presenter will show published version of document. If Approver goes in edit mode (ctrl+shift+c), he can approve/reject/preview workflow version of same document. Its working perfectly as expected.
    So question is why content presenter is not showing workflow document when its checked in first time?
    Thanks
    Sanjeev

  • Access DMS documents from MDM ??

    Hello folks
    We have a customer that has SAP DMS (Document Management System from SAP ERP) where the product image files are stored on a SAP Content Server.
    We are planning to implement MDM for rich product catalogue whereby end-users access MDM via Portal, but we need to access some documents on DMS too.
    I know that there is standard PLM iviews that shows DMS documents linked to a Material, can we use these iviews to modify them so that they are launched on request of user after browsing in MDM iviews (managing same material numbers) ?
    Has anyone of you made this ?
    Any hint/help on this is most welcome !
    Thanks
    /Sooriya

    Hi Sooriya,
    We can get the Product ID from MDM Standard iview through EPCF Eventing. Based on that ID, we can fetch the documents from DMS.
    I am new to DMS. Can you please share some information on fetching document links from DMS through standard or APIs?
    In my scenario, i have to fetch the documents link from DMS for all Master records and store the link in MDM. Also, when a new master s created in MDM, I have to attach/upload documents for the master record and store the document link in MDM. The actual document is present in DMS. When I send the newly created Master data to ECC, I have to link the Master data and the documents in ECC also.
    Your help is greatly appreciated!
    Thanks,
    Arun prabhu S

  • How to access KM documents from detailed navigation tree area in EP???

    Hello Gurus,
    I want to simulate the portal navigation. I want to show a page also with a detailed navigation tree with links to several KM documents on left frame and a content area for such content files on right frame.
    I have decided to modify standard par file "com.sap.portal.navigation.lightdetailednavigationtree" and I tried to modify JSP to show dinamically several links to KM documents applying logic based on webdynpro tutorial "Using Knowledge Management funcionality in Web Dynpro applications". But a runtime error occurs. I don´t know if I must add sharing references in portalapp.xml for using such classes and also I don´t know the way to do it.
    It would be really grateful if somebody could guide me through this issue or give me another more proper solution.
    Thanks in advance.
    Best Regards.
    Rosa

    Hi javier,
    If u want to access KM documents in some different format then ur default KM navigation Iview.
    Then please have a look at this blog. It will really help you:
    Launching WebDynpro from Universal Worklist
    I hope it helps.
    Please revert back in case of further issues.
    Regards,
    Sumit

  • Accessing the xml content

    can any one help me to access the xml contents using a servlet or a java code.
    eg: there are some tags in xml and i want to access those contents from those tags and display it..
    if u can please mail me to:
    [email protected]

    Hi Suresh
    I need the same one for my requirement if u have please post to this site or send me an email .
    [email protected]
    I can able to parsed one structured XML file using SAX
    Sample code :
    // ===========================================================
         // SAX DocumentHandler methods
         // ===========================================================
         public void startDocument() throws SAXException {
              logger.info("Start of document");
         public void endDocument() throws SAXException {
              logger.info("End of document");
         public void startElement(String namespaceURI, String localName, // local
                   // name
                   String qualName, // qualified name
                   Attributes attrs) throws SAXException {
              elemName = new String(localName); // element name
              if (elemName.equals(""))
                   elemName = new String(qualName); // namespaceAware = false
              tagPosition = TAG_START;
              // Set the string for accumulating the text in a tag to empty
              elemChars = "";
              // If the element name is "row", create a new row instance
              // If the element is "indexxid", "ModelPrice", or "ModelSpread",
              // the value will be read in the method "characters" and stored.
              if (elemName.equals("row")) {
                   row = new IndexRow();
                   numRows++;
              // logger.info("Number of numRow:"+numRows);
         } // end method startElement
         public void endElement(String namespaceURI, String simpleName, // simple
                   // name
                   String qualName // qualified name
         ) throws SAXException {
              elemName = new String(simpleName);
              if (elemName.equals(""))
                   elemName = new String(qualName); // namespaceAware = false
              tagPosition = TAG_END;
              String indexId = new String();
              Double dblVal = new Double(0);
              // If element name is "row", put the current row in the map for row
              // instances
              if (elemName.equals("row")) {
                   if (numRows <= 5) { logger.info("Row is: " + row.toString()); }
                   //ABX
                   //indexRows.put(row.getIndexxId(), row);
                   if (family.equals("ABX.HE")){
                   indexRows.put(row.getIndexREDId(), row);
                   else {
                        //CDX ITRXX
                             indexRows.put(row.getIndexxId(), row);
              } else if (elemName.equals("IndexID")) {
                   row.setIndexxId(elemChars);
              else if (elemName.equals("ModelPrice")) {
                   // Leave double value at default of zero if there are no chars
                   if (elemChars.trim().length() != 0) {
                        dblVal = new Double(elemChars);
                        row.setModelPrice(dblVal);
                        indexId = row.getIndexxId();
              } else if (elemName.equals("ModelSpread")) {
                   // Leave double value at default of zero if there are no chars
                   if (elemChars.trim().length() != 0) {
                        dblVal = new Double(elemChars);
                        row.setModelSpread(dblVal);
                        indexId = row.getIndexxId();
              } else if (elemName.equals("CompositePrice")) {
                   // Leave double value at default of zero if there are no chars
                   if (elemChars.trim().length() != 0) {
                        dblVal = new Double(elemChars);
                        row.setCompositePrice(dblVal);
                        indexId = row.getIndexxId();
              } else if (elemName.equals("CompositeSpread")) {
                   // Leave double value at default of zero if there are no chars
                   if (elemChars.trim().length() != 0) {
                        dblVal = new Double(elemChars);
                        row.setCompositeSpread(dblVal);
                        indexId = row.getIndexxId();
              } else if (elemName.equals("REDCode")) {
                   row.setRedCode(elemChars);
              else if (elemName.equals("Name")) {
                   row.setRowName(elemChars);
              } else if (elemName.equals("Series")) {
                   row.setSeries(elemChars);
              } else if (elemName.equals("Version")) {
                   row.setVersion(elemChars);
              } else if (elemName.equals("Term")) {
                   row.setTerm(elemChars);
              } else if (elemName.equals("Maturity")) {
                   row.setMaturity(elemChars);
              } else if (elemName.equals("OnTheRun")) {
                   row.setOnTheRun(elemChars);
              } else if (elemName.equals("Date")) {
                   row.setRowDate(elemChars);
              } else if (elemName.equals("Depth")) {
                   row.setDepth(elemChars);
              else if (elemName.equals("Heat")) {
                   // logger.info("Chars for element " + elemName + " are '" +
                   // elemChars + "'");
                   // Leave double value at default of zero if there are no chars
                   if (elemChars.trim().length() != 0) {
                        dblVal = new Double(elemChars);
                        row.setHeat(dblVal);
                        indexId = row.getIndexxId();
    //          ABX.HE
              else if (elemName.equals("IndexREDId")){
                   row.setIndexREDId(elemChars);
              else if (elemName.equals("Coupon")){
                   row.setCoupon(elemChars);
              if (elemName.equals("Ontherun")) {
                   row.setOnTheRun(elemChars);
         } // end method endElement
         public void characters(char buf[], int offset, int len) throws SAXException {
              // If at end of element, there will be no characters
              if (tagPosition == TAG_END) {
                   return;
              // The characteres method may be called more than once
              // for an element if the internal buffer fills up.
              // Append the characters until the end of the element.
              String strVal = new String(buf, offset, len);
              elemChars = elemChars + strVal;
         } // end method characters
    } // end class MarkItIndexLoader
    but the problem is i want to parse any XML file means any Elemets would be change any time using SAX .In the above example
    else if (elemName.equals("Heat")) {
    else if (elemName.equals("IndexREDId")){
    } else if (elemName.equals("Maturity")) {
    like above I am doing hard code so i don't want hard coding the elements names I want to read any element name and value dynamically.
    Dynamically i want to read the root and child elements
    EX: I can give any XML file like
    Student.XML: <root>..</StName>..</StAge>...</root>
    Employee.XML: <root>..</EmpName>..</EmpAge>...</root>
    CdCatalog.XML: <root>..</Cdtitle>...</CdNumber>...</root>
    I need one java program can ready any type of XML file elements and send to the Database table.
    Please any one done like this task please suggest some reference links or books or sample snippet which can help me to develop program in my requirement.

  • Accessing KM documents in Web service

    Hi All,
    I am developing web service using EJB Module.Here, I have accessed UME using  com.sap.security.api.jar. It is working fine. But I want access KM documents in this module. So that, I have used com.sap.security.ep5.api.jar. So I have used code to get user like this.
    com.sapportals.portal.security.usermanagement.IUserFactory userFactory1= WPUMFactory.getUserFactory();
    com.sapportals.portal.security.usermanagement.IUser userObj =  userFactory1.getUser("administrator");
    But it gives null pointer exception. How can I solve this propbelm?.
    Thanks,
    Venkatesh R

    hi
    https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/7609
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d465a209-0801-0010-e88d-f651c4084b9d
    https://www.sdn.sap.com/irj/scn/thread?messageID=339695
    bvr

Maybe you are looking for

  • Like operator in plsql

    Hi All, Below code should be returning 2 values. but i get only one. when i just execute the sql query alone i am getting 2 values. but when i execute the funciton i get only one vlaue. can you please advise? i have given sample table data and result

  • ASM Disk Migration

    HI There, Im working on an 11.2.0.3 GI and RDBMS running on AIX 7.1 I have a situation where one of the one of the ASM disk groups on a particular cluster consists of 20 disks, 10 of which need to be swapped out for 10 new disks. As far as I am aware

  • Smart mailbox for Unread messages doesn't update automatically.

    Hello everyone. I've set up a smart mailbox in Mail to show only my unread messages.  But, it doesn't update automatically in that when I read a message, that message remains visible in the list until I leave and then return to the "Unread Messages"

  • Low pass filter for video

    Does anyone know of a video filter that would work similar to a Low Pass filter in audio? I inherited some DV-25 footage that has a properly lit person along side some terribly flaring windows. It occurred to me that since DV cameras shoot super-whit

  • Environment Segmentation - PGI vs VXLAN

    I have been tasked with redesigning my companys virtual infrastructure (vSphere 5.5 Ent Plus). This redesign will involve the consolidation of two physically air gapped Dev and Production environments into one IT Service, logically separated environm