Oracle XML DOM parser - attribute values are not printing on the screen ??

Hi Everyone,
I am just trying to use oracle DOM parser to paerse one of my xml file, java file can be compiled and run agianst a xml file, But I cannot see any attribute values printing on the screen..
Appreciate if anyone can help, where I have gone wrong please?
Below is the java file:
// menna puthe DOMSample eka - duwanawa 19/12/2005
import java.io.*;
import java.net.*;
import org.w3c.dom.*;
import org.w3c.dom.Node;
import oracle.xml.parser.v2.*;
public class DOMSample {  //public class eka ***
static public void main(String[] argv){  // main method eka ###
try {
if (argv.length != 1){
// Must pass in the name of the XML file...
System.err.println("Usage: java DOMSample filename");
System.exit(1);
// Get an instance of the parser
DOMParser parser = new DOMParser();
// Generate a URL from the filename.
URL url = createURL(argv[0]);
// Set various parser options: validation on,
// warnings shown, error stream set to stderr.
parser.setErrorStream(System.err);
parser.showWarnings(true);
// Parse the document.
parser.parse(url);
// Obtain the document.
Document doc = parser.getDocument();
// Print document elements
System.out.print("The elements are: ");
printElements(doc);
// Print document element attributes
System.out.println("The attributes of each element are: ");
printElementAttributes(doc);
catch (Exception e){
System.out.println(e.toString());
} // main method eka ###
static void printElements(Document doc) {
NodeList nl = doc.getElementsByTagName("*");
Node n;
for (int i=0; i<nl.getLength(); i++){
n = nl.item(i);
System.out.print(n.getNodeName() + " ");
System.out.println();
static void printElementAttributes(Document doc){
NodeList nl = doc.getElementsByTagName("*");
Element e;
Node n;
NamedNodeMap nnm;
String attrname;
String attrval;
int i, len;
len = nl.getLength();
for (int j=0; j < len; j++){
e = (Element)nl.item(j);
System.out.println(e.getTagName() + ":");
nnm = e.getAttributes();
if (nnm != null){
for (i=0; i<nnm.getLength(); i++){
n = nnm.item(i);
attrname = n.getNodeName();
attrval = n.getNodeValue();
System.out.print(" " + attrname + " = " + attrval);
System.out.println();
static URL createURL(String filename) {  // podi 3 Start
URL url = null;
try {
url = new URL(filename);
} catch (MalformedURLException ex) { /// BBBBBB
try {
File f = new File(filename);
url = f.toURL();
} catch (MalformedURLException e) {
System.out.println("Cannot create URL for: " + filename);
System.exit(0);
} // BBBBBB
return url;
} // podi 3 End
} //public class eka ***
// End of program
output comes as below:
Isbn:
Title:
Price:
Author:
Message was edited by:
chandanal

Hi Chandanal,
I edited your code slightly and I was able to get the correct output.
I changed the following line:
for (int j=0; j >< len; j++)to:
for (int j=0; j < len; j++)I have included the complete source below:
// menna puthe DOMSample eka - duwanawa 19/12/2005
import java.io.*;
import java.net.*;
import org.w3c.dom.*;
import org.w3c.dom.Node;
import oracle.xml.parser.v2.*;
public class DOMSample {
    //public class eka ***
    public static void main(String[] argv) {
        // main method eka ###
        try {
            if (argv.length != 1) {
                // Must pass in the name of the XML file...
                System.err.println("Usage: java DOMSample filename");
                System.exit(1);
            // Get an instance of the parser
            DOMParser parser = new DOMParser();
            // Generate a URL from the filename.
            URL url = createURL(argv[0]);
            // Set various parser options: validation on,
            // warnings shown, error stream set to stderr.
            parser.setErrorStream(System.err);
            parser.showWarnings(true);
            // Parse the document.
            parser.parse(url);
            // Obtain the document.
            Document doc = parser.getDocument();
            // Print document elements
            System.out.print("The elements are: ");
            printElements(doc);
            // Print document element attributes
            System.out.println("The attributes of each element are: ");
            printElementAttributes(doc);
        } catch (Exception e) {
            System.out.println(e.toString());
    // main method eka ###
    static void printElements(Document doc) {
        NodeList nl = doc.getElementsByTagName("*");
        Node n;
        for (int i = 0; i < nl.getLength(); i++) {
            n = nl.item(i);
            System.out.print(n.getNodeName() + " ");
        System.out.println();
    static void printElementAttributes(Document doc) {
        NodeList nl = doc.getElementsByTagName("*");
        Element e;
        Node n;
        NamedNodeMap nnm;
        String attrname;
        String attrval;
        int i, len;
        len = nl.getLength();
        for (int j = 0; j < len; j++) {
            e = (Element)nl.item(j);
            System.out.println(e.getTagName() + ":");
            nnm = e.getAttributes();
            if (nnm != null) {
                for (i = 0; i < nnm.getLength(); i++) {
                    n = nnm.item(i);
                    attrname = n.getNodeName();
                    attrval = n.getNodeValue();
                    System.out.print(" " + attrname + " = " + attrval);
            System.out.println();
    static URL createURL(String filename) {
        // podi 3 Start
        URL url = null;
        try {
            url = new URL(filename);
        } catch (MalformedURLException ex) {
            /// BBBBBB
            try {
                File f = new File(filename);
                url = f.toURL();
            } catch (MalformedURLException e) {
                System.out.println("Cannot create URL for: " + filename);
                System.exit(0);
        // BBBBBB
        return url;
    // podi 3 End
} //public class eka ***-Blaise

Similar Messages

  • F4 values are not accepted by the screen fields

    I have a field called month in a screen i could get the values for F$ by using below field. My F4 values are there in the domain fixed values so i had to use DD_DOMA_GET.and got the values fron ZMONTH domain. When im pressing F$ i can c input help values like
    01  january
    02 february
    12 December
    boldn i am selecting it the value is not selected or seen in the input/output field of the screen.bold.
    form MONTH_VALUES .
    DATA:
      fs_taba TYPE dd07v.
    DATA:
    it_taba TYPE STANDARD TABLE OF dd07v,
    it_tabb TYPE STANDARD TABLE OF dd07v,
    WA_DD07V TYPE DD07V.
    CALL FUNCTION 'DD_DOMA_GET'
      EXPORTING
        domain_name   = 'ZMONTH'
        langu         = sy-langu
        withtext      = 'X'
      TABLES
        dd07v_tab_a   = it_taba
        dd07v_tab_n   = it_tabb
      EXCEPTIONS
        illegal_value = 1
        op_failure    = 2
        OTHERS        = 3.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT  it_taba INTO fs_taba.
        MOVE fs_taba-domvalue_l TO WA_STATUS-DOMVALUE_L.
        MOVE   fs_taba-ddtext  TO WA_STATUS-ddtext.
        APPEND WA_STATUS TO GT_STATUS.
        CLEAR WA_STATUS.
        CLEAR fs_taba.
    ENDLOOP.
    ULINE.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield        = 'STATUS'
                value_org       = 'S'
           TABLES
                value_tab       = GT_STATUS
           EXCEPTIONS
                parameter_error = 1
                no_values_found = 2
                OTHERS          = 3.
      IF sy-subrc <> 0.
    ENDIF.
    REFRESH GT_STATUS.
    endform.

    Hi,
    If the values are in the value range of the domain then they will definitely come. And you have to trigger some event after selecting the value from the list.
    for example if you want some thing to display after selecting a value from drop down then after selecting the value from the f4 help list press enter or some button kind of thing.
    Thanks,
    Sri.

  • Oracle xml DB and text features are not installed

    HI,
    I installed Sql developer 3.0 ,oracle 11g and jdk 7 on centos 5.when iam running sql developer its showing error message oracle xml DB and text features are not installed.
    pls anyone help me out.
    thanks
    srinivas
    Edited by: srinivas on Oct 17, 2011 4:49 AM

    may be help you
    Re: Connection Error - Oracle XMLDB and Text Features are not installed.

  • Custom field values are not storing in the data base

    Hi Friends,
    We have created one  Custom field called   ZZ_APPROVER in Rfx Header , we have included this field in the below  stuctures
    1.INCL_EEW_PD_HEADER_CSF_BID
    2.INCL_EEW_PD_HEADER_CSF
    The data type of this field ( ZZ_APPROVER ) is CHAR and the length is 1 .  we have given 2  fixed values in Value Range
    1 -
    X+2 Approver
    2 --- Provisional Approver
    so when we select either 1 or 2 ( in Drop Down ), its displaying properly on RFx Screen, but when we try save this document the values are not strong in the data base.
    Can any one give me idea why its not stroring in the data base
    Thanks in Advance
    Kumar Srini

    Hi Ganapathy,
    A Record is created in table BBP_PDHSC , for other z fields, the values are stroing , but for this field ( ZZ_APPROVER ) [ drop down list ], the value is not stroring
    Thnx
    Kumar Srini

  • I just updated my iPhone 4 to iOS 7.1. The apps I had previously installed are not showing on the screen. They are located in App Store icon. How do I move the icons so they are showing on the screen.

    I just updated my iPhone 4 to iOS 7.1. The apps I had previously installed are not showing on the screen. They are located in App Store icon. How do I move the icons so they are showing on the screen.

    You can move apps around in iOS 7 the same as iOS 6. Press an app icon until you see it wiggle; then drag it to where ever you want it to be. Drag it onto another app to create a folder with the two apps. Tap the Home button to stop the wiggle.

  • Printing.  My prints are not printing at the proper size.  If I designate 5x7 it prints at something around 4x3.  I have set all the parameters.

    My prints are not printing at the proper size.  If I designate 5x7 it prints at something around 4x3.  I have set all the parameters.

    When you saye a you have set all the parameters, does that include the cell size in the print module? Are you printing on 5 x 7 paper? And, if you are, have you set that paper size in the page setup?

  • After updating to Yosemite, my screen saver settings are not maintained.  The screen saver reverts to some Apple default.  There is no way to get my setting to be maintained.

    After updating to Yosemite, my screen saver settings are not maintained.  The screen saver reverts to some Apple default.  There is no way to get my setting to be maintained.

    Hi ..
    Might be corrupted preferences.
    Open the Finder. From the Finder menu bar click Go > Go to Folder
    Type or copy paste the following:
    ~/Library/Preferences/com.apple.screensaver.plist
    Click Go then move the com.apple.screensaver.plist file to the Trash.
    Restart your Mac then reset your screen saver.

  • Created a trigger but new values are not inserting in the backup table

    I have created a backup table and writter a trigger on a table such that after update old values and new values are to be inserted into the backup table, but new values are not inserting. I am giving the code please help me
    create or replace trigger "SUPPQUOTES_AUDIT"
    after update or delete on phsuppquotes for each row
    begin
    insert into phquotes_audit(cprc_new,suppcode,itemcode,cprc_old,negodt,validdt,userid,TRANDATE) values
    (:new.cprc,:old.suppcode,:old.itemcode,:old.cprc,:old.negodt,:old.validdt,:old.userid,SYSDATE);
    end;

    old values and new
    values are to be inserted into the backup table, butwell you have only one insert there, inserting old values with a new id (which is ok if you don't update the id column, but I don't think that :new is available for deleting ops); you should have two inserts:
    insert into
    phquotes_audit(cprc_new,suppcode,itemcode,cprc_old,negodt,validdt,userid,TRANDATE) values (:old.cprc,:old.suppcode,:old.itemcode,:old.cprc,:old.negodt,:old.validdt,:old.userid,SYSDATE);
    if (updating) then
    insert into phquotes_audit(cprc_new,suppcode,itemcode,cprc_old,negodt,validdt,userid,TRANDATE) values (:new.cprc,:new.suppcode,:new.itemcode,:new.cprc,:new.negodt,:new.validdt,:new.userid,SYSDATE);
    end if;
    gojko adzic
    http://gojko.net

  • Measure Values are not shown in the pivot tables

    Measures without aggregation (in rpd) are not shown in pivot table.
    Im trying to add multiple columns in the fact table as measures,one which is summable had has the SUM function and three which are not summable.
    The initial report will be as follows and I have been able to get the data displayed.
    Year | Month| Company Name| SUM(C1)| C2|C3
    However if I pivot the table as follows data in column C2 and C3 are not Displayed.
    Columns
         Year     
              Month     
              Company     
    Rows                    
    Measure Lablel                    
    Measures
         SUM(C1)     
                   C2     
                   C3                    
    Should we have an aggregation rule applued in C2 and C3 ?

    Yes, all the column entries must have agg rule. You can specify one such as 'first' in the pivot table.

  • CO-PA- Actual Values are not flowing in the CO-PA

    Hi ,
       I have created an operating concern and created the characteristics and value fields as per our requirement. I have assigned a particular cost element to a value field through FI direct posting .
      I have mapped SD Condition types to my value fields
      I have also activated the Operating Concern
      Now when i  am tryinng to post the document from FI no CO-PA document is getting generated nor the actuals are getting transferred to the CO-PA.
      And when i am trying to post a document from FI to Profitability Segment (through account assignment) iam getting following dump.
    The current ABAP program "SAPLKEET" had to be terminated because one of the
    statements could not be executed.
                                                                                    This is probably due to an error in the ABAP program.
                                                                                    In program "RK2FGPKE ", the following syntax error occurred
    in the Include "RK2FGTKE " in line 23:
    "The Dictionary structure or table "T25A2" is either not active or does"
    " not exist."                                         
    But I have already created a segment as my characteristics and i have created a segment for my operating concern and I have checked that this is getting stored in table T2509.
    I have checked with the table T25A2 it is not activated .
    Can anyone suggest am i going wrong in the customisation part.
    how do i solve it plz assist me as early as possible.
    Regards
    Sunil

    hi sunil
    as per ur mail this problem is occured in table space . kaindly consult ur BASIS onsultant first. based on that ask the ABAP ER . some times it will happen if any oracle applicastion not works

  • Values are not getting displayed in screen

    Hi Experts,
    I have used BAPI_CHARACT_CREATE to upload characteristics(t-code: ct04),
    All data are uploaded into the Master Table, while changing the same in t-code ct04 the Value and Description is not getting displayed in screen( in Table control).
    NOTE: If i use BAPI_CHARACT_GETDETAIL to get the details of a character i am getting all the values which i have uploaded. (But not in the t-code ct04).
    BDC and LSMW is not working for this t-code.
    Please help me out.
    Thanks and Regards,
    LOGU

    Hi,
    i think you have not released the objects to repository. test and try again..
    thanks
    karthik

  • Lead time values are not appearing in the report for current year.

    Hi friends,
    Iam checking a report in production.  where lead time values are displayed as 0 for 1 key figure lead time3 (w/0 dim) . i found there is a formula for this it shows like NODIM ( 'Lead Time 3' ).and there is a value for cal.lead time
    how can i get values in the report.
    Thanks ,
    VRV.

    Hi,
    Although your question is not clear, I understood that the formula built on that KF is NODIM. Basically it means, units of measurement is not considered when calculating.
    Eg: 5 Minutes + 5 Kilograms = 10
    You please try to analyze your KF by the above logic. Then you would be able to figure out why the data is not appearing in the report..
    Assign if helps...
    Regards,
    Suman

  • Modified idoc values are not reflecting in the IDOC display (ie we02)

    Hello Team
    I wrote one inbound interface for posting GR by using the IDOC MBGMCR03. In the inbound FM, i wrote some code for retrieving some data and mapping to its relevant fields of the segments. It is working fine but when i see the idoc values in WE02/WE05, i am not able to see the values which i have added in the FM. so please suggest me how to get the values in the IDOC display.
    Regds
    Raj

    Hello Team
    Thanks for your replies. Let me put my question in this way to you.
    In the inbound FM (ie idoc_input_mbgmcr), i have fetched some values from SAP by using the values which came from PI to that IDOC through mapping. what ever the values i have fetched from SAP in inbound FM, i have mapped them to the relevent segments and finally the complete structure i have passed to BAPI, where it will post GR. All these things are working fine, idoc is also getting successfull.
    But when i go and see the successfull idoc values, it is not showing the values which i have mapped in inbound FM. Now i want those values in that Final idoc.
    So pls check and suggest.
    Regards
    Rj

  • Custom Table Editor: values are not populated to the model

    H,
    I wrote a custom table renderer which uses JComboBox + editor, which seem to work (after editing, the displayed cell reflects the change) but after editing the table manually, the model is not altered when i call table.getModel();
    The editor part is as simple as
      class MPComboBoxEditor extends DefaultCellEditor {
            private final JComboBox box;
            public MPComboBoxEditor(JComboBox b) {
                super(b);
                this.box = b;
        }The renderer:
    public class CellRendererWithMPComboBox extends JLabel implements TableCellRenderer {
        private final Context c;
        private final JTable table;
        private DefaultTableCellRenderer rend = new DefaultTableCellRenderer();
        private JLabel label = new JLabel();
        public CellRendererWithMPComboBox(Context c, JTable table) {
            super();
            this.c = c;
            this.table = table;
         * Set this renderer to the given column
         * @param column
        public void setRendererTo(int column) {
            TableColumn col = table.getColumnModel().getColumn(column);
            col.setCellEditor(new JComboBoxEditor(JComboBox(<some values>)));
            col.setCellRenderer(this);
        @Override
        public Component getTableCellRendererComponent(JTable table, Object value,
                boolean isSelected, boolean hasFocus, int row, int column) {
            if (hasFocus && isSelected) {
                if (isSelected) {
                    setForeground(table.getSelectionForeground());
                    super.setBackground(table.getSelectionBackground());
                } else {
                    setForeground(table.getForeground());
                    setBackground(table.getBackground());
                 label.setText((value == null) ? "" : value.toString());
                return label;
            } else {
                label.setText((value == null) ? "" : value.toString());
                return label;
        }the model simply extends DeafultTableModel to get formatted numbers.
        @Override
        @SuppressWarnings("unchecked")
        public Object getValueAt(int row, int column) {
            Object o = super.getValueAt(row, column);
            Class t = getColumnClass(column);
            if (!t.getName().equals("java.lang.Object")) {
                if (o != null && (t.isAssignableFrom(Double.class) ||
                        t.isAssignableFrom(double.class) ||
                        t.isAssignableFrom(float.class) ||
                        t.isAssignableFrom(Float.class))) {
                    return FormatNumber.formatDezimal(Double.valueOf(o.toString()));
                } else {
                    return o;
            } else {
                return o;
        }Do i need to override some setValueAt method in the editor/renderer or something?
    Thanks one more time!
    Regards,
    Andreas

    I don't see any getModel() in your code extract. If the renderer renders it right after edition, then the value is probably correct in the model.
    Also, remember [this thread|http://forums.sun.com/thread.jspa?threadID=5396048], where it appeared you were not clear about which model you were looking at.
    Do i need to override some setValueAt method in the editor/renderer or something?No. But have you overridden the model's setValueAt?
    Edited by: jduprez on Jul 15, 2009 4:56 PM

  • Safari 4 fonts are not clear on the screen.....

    I downloaded and installed Safari 4 for Windows over the weekend.
    I find that the fonts are not clear...they are actually fuzzy. Right now I have this page side by side with another browser and the type is definitely different.
    Any thoughts?
    Thank you
    Elliot

    First, try resetting your phone:
    Press the sleep/wake button & home button at the same time, keep pressing until you see the Apple logo, then release.

Maybe you are looking for

  • Syncing Classic with USB killed docking station for my Nano

    I have two libraries in Itunes, one for music and one for books. I use my Nano for music. After I organized a second library for books, I bought a Classic. It uses a USB cable. After my first hookup of the Classic, syncing the book library. The firew

  • Problem in events

    Hi, There are two tabs in my selection screen ,when I enter the values in first tab and click the execute button ,ALV is shown.After showing the ALV when back button is clicked ,it will come to the first tab.Uptill this point program is working fine.

  • N8 - Picture Browser Issue After Firmware Update

    Since I´ve updated to PR1.1 I have a lot of tearing and blurriness when I see my pics at max zoom in the phone´s own pic browser. Pics viewed in my PC are just fine. I´ve tried to reinstall the FW 2 times already, but the problem remains. Details fro

  • White Lines/ Foreign Patterns in Fonts only  while Playing

    Vram in use 64K, Keynote 2.0.2 Does anyone know how to correct this problem? It seems that whenever i play the slide presentation white lines are running through the entire slides and foreign patterns appear in the fonts. i have changed the display,

  • Module Pool - Error Message

    hi all, plz help: requirement: thr r 2 screen fields CODE(Input Enable) and DESC(Output Only). when user enters CODE corresponding DESC will come automatically but if no value is entered in CODE, DESC will also be blank with an error msg below: 'Ente