XML Handling in HTMLDB

I have a XML file like below:
<?xml version="1.0" encoding="UTF-8"?>
<Data>
     <Barcode>
          <Data_Identifier>:}</Data_Identifier>
<PN_Start>16</PN_Start>
          <PN_End>25</PN_End>
     </Barcode>
     <SubSystem>
          <SubSystemName>AAA</SubSystemName>
          <FR>
               <PartName>A1</PartName>
               <PartName>A2</PartName>
               <PartName>A3</PartName>
          </FR>
          <SV>
               <PartName>V1</PartName>
               <PartName>V2</PartName>
               <PartName>V3</PartName>
               <PartName>V4</PartName>
          </SV>
     </SubSystem>
     <SubSystem>
          <SubSystemName>BBB</SubSystemName>
          <FR>
               <PartName>C1</PartName>
               <PartName>C2</PartName>
               <PartName>C3</PartName>
          </FR>
          <SV>
               <PartName>W1</PartName>
               <PartName>W2</PartName>
               <PartName>W3</PartName>
               <PartName>W4</PartName>
          </SV>
     </SubSystem>
</Data>
Is there anyway I can load the data in <subsystem> and <FR> tag into a table and passby all others, so I can have table/tables like these:
Subsystem FR_PN
=====================
AAA A1
AAA A2
AAA A3
BBB C1
BBB C2
BBB C3
Thanks for your help in advance.
Ran

Ran,
you can also look at my XML processing in the database posting at http://inside-apex.blogspot.com/2007/03/xml-processing-in-database.html
I think the presentations should contain the necessary information to extract this data.
Patrick
Check out my APEX-blog: http://inside-apex.blogspot.com
Check out the ApexLib Framework: http://apexlib.sourceforge.net

Similar Messages

  • Extended xml handling in asynchronous inbound (server) proxy

    Hello,
    I want to activate extended xml handling on an asynchronous inbound server proxy.
    looking at online help:
    http://help.sap.com/saphelp_nwpi71/helpdata/en/73/3f5c3c3906b006e10000000a11402f/frameset.htm
    this should be the code:
      lo_server_context   = cl_proxy_access=>get_server_context( ).
      lo_payload_protocol ?= lo_server_context->get_protocol( if_wsprotocol=>payload ).
      CALL METHOD lo_payload_protocol->set_extended_xml_handling( abap_true ).
    However the controller tables remain empty when executing a scenario to the application system.
    Also adding a static attribute extended_xml_handling does not have the correct result.
    any suggestions???
    Regards,
    Emile

    Hello Emile,
    do you have a solution regarding your problem? If not, here is a good one.
    I think you have inserted the code inside the generated proxy method. Within this method it is a little bit tricky to get the controller structures filled. This could be done by parsing the input data once more... Here is an code example for this:
    ls_input_data-name = 'INPUT'.
    GET REFERENCE OF input INTO ls_input_data-value.
    APPEND ls_input_data TO lt_input_data.
    lo_server_context = cl_proxy_access=>get_server_context( ).
    lo_payload_protocol ?= lo_server_context->get_protocol( if_wsprotocol=>payload ).
    lo_payload_protocol->set_extended_xml_handling( extended_xml_handling = 'X' ).
    lo_payload_handler = lo_payload_protocol->get_payload_handler( '<Name of structure data element>' ).
    lo_payload_input = lo_payload_protocol->get_sent_request_payload( ).
    lo_payload_handler->get_request_data_from_payload(
      EXPORTING
        payload = lo_payload_input
      CHANGING
        request_data = ls_input_data ).
    But a much easier and better way is to insert the following coding within a constructor of the generated Proxy class.
    lo_server_context = cl_proxy_access=>get_server_context( ).
    lo_payload_protocol ?= lo_server_context->get_protocol( if_wsprotocol=>payload ).
    lo_payload_protocol->set_extended_xml_handling( extended_xml_handling = 'X' ).
    As in each standard ABAP class, you can insert your own constructor within proxy classes. If you do so and insert the code in it the controller table will be filled with the needed information.
    Best Regards,
    Lars

  • Where to set extended XML handling in WESOUT while sending XML

    Hello Experts,
    Requirement : Add a Z field to a standard message type so that
    it can be sent to another system while XML .
    Transaction cod e: WESOUT is used for that.
    But as per the link :
    http://help.sap.com/saphelp_nw04/helpdata/en/73/3f5c3c3906b006e10000000a11402f/content.htm
    SET_EXTENDED_XML_HANDLING  should be set.
    I agree that it should be done via framework it self.But can any one suggest a possible place where we can make
    frame work to consider the handling of extended structure.
    Thanks
    ~Raj

    Hi Raj,
    extended XML Handling is for changing the behavior of default/initial values of existing fields in the XML structure.
    I suggest using a [data type enhancement|http://help.sap.com/saphelp_nw70/helpdata/en/a8/bfc6373c8fea43bdb3541535bcbd43/content.htm] in ESR to add a custom field to the desired data type. Then create a proxy in transaction SPROXY from the data type enhancement and implement the proxy in order to populate the custom field.
    Best regards, Martin

  • Soap - Adapter / XML-Handling

    Hello @,
    is it possible to receive a xml-file via SOAP-Adapter and pass it to a another SOAP-Receiver without haveing any mapping between?

    >
    Bernd Kresse wrote:
    > Ah ... ok, that is also my knowledge about this. I must define the structure of the message to handle a message, regardless of needing a mapping.
    >
    > What about define a "structure" with only tag and put the "real" structure in this single tag?
    if you are not using a mapping then the structure is irrelevant (for file scenarios etc) but since yours is a SOAP the structure will anyway be present in terms of a WSDL

  • Web-services.xml  handler chain

    Hi All,
    My question is this. I use servicegen ant task to generate the web-services.xml
    file,
    then I open the .ear file using winzip and edit the web-services.xml file to include
    the handler-chain information. I have included the following information :
    <handler-chains>
    <handler-chain name="myChain">
    <handler class-name="com.whatever.core.sec.iec.ejb.IECSOAPHandler">
    <init-params>
    <init-param name="logDirectory" value="C:/temp" />
    <init-param name="severityLevel" value="verbose" />
    </init-params>
    </handler>
    </handler-chain>
    </handler-chains>
    and then I include the following in the operation tag:
    <operation method="batchResponseToPSS([B)" component="ejbcomp0" name="batchResponseToPSS"
    handler-chain="myChain">
    and the also following
          <operation method="onlineResponseToPSS([B)" component="ejbcomp0" name="onlineResponseToPSS"
    handler-chain="myChain">
    Without the handler-chains element my app works fine.
    My whole web-sercvices.xml is located at following location:
    http://newsgroups.bea.com/cgi-bin/dnewsweb?cmd=article&group=weblogic.developer.interest.webservices&item=3921&utag=
    Any insight will be appreciated.
    Thanks
    ---Radhe
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    I am still not clear what error you are getting.
    1. Are you saying that the handler is not getting
    called?
    2. or you are not able to invoke the web service
    at all?
    If it is 1 check the web-service.xml file of the ear
    deployed. Make sure that your change is not overwritten
    by servicegen.
    If it is 2 then check the URL of the web service in
    web-service.xml file and use a browser to get to
    that URL.
    Regards,
    -manoj
    http://manojc.com
    "Radhe" <[email protected]> wrote in message
    news:[email protected]...
    >
    Manoj,
    Thanks for your reply. When I bring up the WLS, from the messages on theconsole,
    it comes-up pretty cleanly. Theare are no error messages.
    I looked into log files and their is nothing. This has surprised me.
    I worked with some of my friends and they are clueless. I never thoughtto just
    read SOAP Headers, that I have to go through so much pain.
    Also part of my web-services.xml file is generated through servicegen,then I
    crack open the .ear file strip the web-services.xml file, edit it and putit back.
    >
    IF there is some error I would have fixed it.
    Does handler-chains in web-services.xml work, or it is some fiction, BEAmade
    up. I am clueless where I am screwing it up.
    Thanks
    ---Radhe
    "manoj cheenath" <[email protected]> wrote:
    Can you please post the error message?
    This example may also help you:
    http://www.manojc.com/?sample4
    Regards,
    -manoj
    http://manojc.com
    "Radhe" <[email protected]> wrote in message
    news:[email protected]...
    Hi All,
    My question is this. I use servicegen ant task to generate theweb-services.xml
    file,
    then I open the .ear file using winzip and edit the web-services.xmlfile
    to include
    the handler-chain information. I have included the following
    information
    <handler-chains>
    <handler-chain name="myChain">
    <handler
    class-name="com.whatever.core.sec.iec.ejb.IECSOAPHandler">
    <init-params>
    <init-param name="logDirectory" value="C:/temp" />
    <init-param name="severityLevel" value="verbose" />
    </init-params>
    </handler>
    </handler-chain>
    </handler-chains>
    and then I include the following in the operation tag:
    <operation method="batchResponseToPSS([B)" component="ejbcomp0"
    name="batchResponseToPSS"> >> handler-chain="myChain">> >>> >> and the also following> >>> >>       <operation method="onlineResponseToPSS([B)" component="ejbcomp0"> >name="onlineResponseToPSS"> >> handler-chain="myChain">> >>> >> Without the handler-chains element my app works fine.> >>> >> My whole web-sercvices.xml is located at following location:> >>> >>>>http://newsgroups.bea.com/cgi-bin/dnewsweb?cmd=article&group=weblogic.developer.interest.webservices&item=3921&utag=> >>> >>> >> Any insight will be appreciated.> >>> >> Thanks> >> ---Radhe> >> >>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • ORA-31183 error in XML handling routine after upgrade to 10gr2

    Hello,
    I have a series of packages that parse XML documents from a staging table, held as XMLType, and breaks it out to populate several relational structures.
    These where original developed using 9.2.0.4, and have been used through all patch upgrades to 9i, and on 10gr1 with no issue.
    However, we upgraded to 10gr2 this week, and the code has stopped working, returning the following error for all records:-
    ORA-31183: Node type document cannot be converted to desired type
    ORA-06512: at "XDB.DBMS_XMLDOM", line 1075
    ORA-06512: at "XDB.DBMS_XMLDOM", line 1093
    ORA-06512: at line 123
    I have isolated the error to a call to dbms_xmldom.makeelement. The segment of the code that fails is
    v_parser := dbms_xmlparser.newparser;
    dbms_xmlparser.parseclob(v_parser, v_mqtl_rec.msg_data.getclobval());
    v_dom := dbms_xmlparser.getdocument(v_parser);
    dbms_xmlparser.freeparser(v_parser);
    v_item_node := dbms_xmldom.makeNode(v_dom);
    v_element := dbms_xmldom.makeelement(v_save_callback_node); --ERROR OCCURES HERE
    v_nodelist := dbms_xmldom.getchildrenbytagname(v_element,'NotifyCallback');
    where v_mqtl_rec.msg_data.getclobval() is the clob from the xmltype, v_parser is dbms_xmlparser.parser, v_item_node is dbms_xmldom.domnode and v_nodelist is dbms_xmldom.domnodelist.
    looking at the 10gr2 documntation, I cannot see any changes to this API call.
    Any suggestions on why this no longer works?
    Regards,
    Dave

    Figured it out. Turns out the 10gr2 version of DBMS_XMLDOM is a bit stricter on what on can do with various flavours of domnodes.
    Just in case anyone else gets a similar error, here's how I resolved it.
    I replaced the three lines:-
    v_item_node := dbms_xmldom.makeNode(v_dom);
    v_element := dbms_xmldom.makeelement(v_save_callback_node); --ERROR OCCURES HERE
    v_nodelist := dbms_xmldom.getchildrenbytagname(v_element,'NotifyCallback');
    with the following line:-
    v_nodelist := dbms_xmldom.getelementsbytagname(v_dom,'NotifyCallback');
    Regards,
    Dave.

  • Error xml handling

    Hello,
    Wanted to discuss a scenario.
    There is a java bean which picks word files and converts into xml files.
    2 kinds of xml files can be generated ( Either of 2): In case its second kind of file ,need to send it as an email.
    how can we achieve this?
    Thank You.

    Receiver determination is the first step in message processing after sender adapter picks the file.
    specify the condition in receiver determination.
    when the first condition is satisfied,message will be routed to correct interface determination and receiver agreement,this will do the correct message mapping,invoke the IDOC receiver communication channels and post in ECC
    Same thing happens when message is roited to mail adapter configuration.

  • File permissions while handling the XML in JDOM

    I have been working on setting up an email application to backup notification emails when the SMTP server is down. I backup the emails into an XML file. I am trying to figure out how to handle file permissions on the file since multiple applications could be trying to manipulate the file at the same time, hence possibly corrupting what is supposed to be there. Currently this is the code I have written which seems to work fine except that I get the document before locking the file and I am wondering if someone knows a better way to handle this. I am not too familiar with java's I/O operations so any help would be great and very much appreciated. Here is a snippet of my code....
         SAXBuilder builder = new SAXBuilder();
          document = builder.build(fileName);
          out = new FileOutputStream(fileName);
          FileChannel channel = out.getChannel();
          FileLock lock = channel.tryLock();
          createMailDocument(from, to, cc, subject, body, attachment, application, time);
          System.out.println("Writing xml");
          XMLOutputter serializer = new XMLOutputter();
          serializer.output(document, out);
          out.flush();
          out.close();

    My main problem is this part...
          SAXBuilder builder = new SAXBuilder();
          document = builder.build(fileName);
          out = new FileOutputStream(fileName);
          FileChannel channel = out.getChannel();
          FileLock lock = channel.tryLock();I setup the document before I lock the file. I am concerned that the xml structure could change before I lock the file. I am just curious whether my concerns are valid since I am fairly new to XML handling and I/O. If they are valid, I want to know if anyone has a better implementation that I could use.

  • XML parsing -  org.xml.sax.driver not specified

    I am attempmtping to parse my first XML document and get the following excpetion when running my prog.
    org.xml.sax.SAXException: System property org.xml.sax.driver not specified.
    I am following the examples in the O'Reilly Java and XML book but suspect I am missing something obvious.
    This is the offending line of code:
    XMLReader xr = XMLReaderFactory.createXMLReader();
    Any help will be appreciated.

    You need to set a property for your class that invokes your SAX handler. This is the property you need to set
    org.xml.sax.driver=???
    Where ??? is the name of the package where your SAXparser lives.
    for example, my sax driver is in:
    org.xml.sax.driver=org.apache.xerces.parsers.SAXParser
    (see code below)
    Also, a sweet reference is Elliot Rusty Harold's "XML processing with Java", which answered all the practical questions I had -- really! And is free, online.
    http://www.ibiblio.org/xml/books/xmljava/chapters/index.html
    This is the code for main() where my xml handler is invoked
    try
    {  SpiderHandler spiderHandler = new SpiderHandler(testSpider);
       XMLReader reader = XMLReaderFactory.createXMLReader();
       reader.setContentHandler(spiderHandler);
       for (int i=4; i<args.length; i++)
       {   FileReader xmlScript = new FileReader(args);
    System.out.println("Input file number "+i+" named "+args[i]);
    // org.xml.sax.XMLReader.parse(InputSource) interface
    // see org.xml.sax.InputSource class      
    reader.parse(new InputSource(xmlScript));
    catch(Exception e)
    {   System.out.println("Error encountered in parsing from main(). \n");
    e.printStackTrace();
    Luck to you! XML is a joy.

  • XML Parsing in a Schedule Job (OIM 11g R1)

    Hi,
    I am writing a lookup recon - schedule task in OIM 11g R1 to connect to a webservice and get the lookup attribute values. Now, I am able to fetch the values in a xml format. I am facing an issue while trying to parse the xml values (tried both as a string and from a file).
    I have tried using both the SAX and the DOM parser. PFA the snippet for the DOM Parser:
                        DocumentBuilderFactory builderFactory =
                            DocumentBuilderFactory.newInstance();
                        DocumentBuilder builder = null;
                        try {
                            builder = builderFactory.newDocumentBuilder();
                        } catch (ParserConfigurationException e) {
                            e.printStackTrace();
                        org.w3c.dom.Document doc =
                            (org.w3c.dom.Document)builder.parse(file);
                        System.out.println("Parsed the xml");
                        org.w3c.dom.NodeList nodes =
                            doc.getElementsByTagName("entry");
                        System.out.println("Total Profiles fetched:: " +
                                           nodes.getLength());
    This is giving the nodes.getLength() as 0. Though the code runs fine in the Java Client (directly from eclipse)
    The snippet for the SAX method is :
                SAXParserFactory factory = SAXParserFactory.newInstance();
                SAXParser saxParser = factory.newSAXParser();
                DefaultHandler handler = new DefaultHandler() {
                    boolean bfname = false;
                    boolean blname = false;
                    boolean bnname = false;
                    boolean bsalary = false;
                    public void startElement(String uri, String localName,
                                             String qName,
                                             Attributes attributes) throws SAXException {
                        //   System.out.println("Start Element :" + qName);
                        if (qName.equalsIgnoreCase("d:Name")) {
                            blname = true;
                    public void endElement(String uri, String localName,
                                           String qName) throws SAXException {
                        //     System.out.println("End Element :" + qName);
                    public void characters(char[] ch, int start,
                                           int length) throws SAXException {
                        if (blname) {
                            System.out.println("d:Name : " +
                                               new String(ch, start, length));
                            blname = false;
                           saxParser.parse("home/oracle/UserProfiles.xml", handler);
    This is throwing a java.net.malformedurlexception: no protocol: /home/oracle/userprofiles.xml exception. I tried to pass it as "file://home/oracle/UserProfiles.xml" but then is gives a
    java.net.ConnectException: Connection refused Even this code is running fine in the Java Client when ran directly. It seems there is some weblogic configurations I am missing for the XML parsing?
    Please do help, if anyone has faced any issues parsing an xml in a Schedule job. Will highly appreciate your inputs.
    Thanks,
    Anuj.  

    Hi,
    I am writing a lookup recon - schedule task in OIM 11g R1 to connect to a webservice and get the lookup attribute values. Now, I am able to fetch the values in a xml format. I am facing an issue while trying to parse the xml values (tried both as a string and from a file).
    I have tried using both the SAX and the DOM parser. PFA the snippet for the DOM Parser:
                        DocumentBuilderFactory builderFactory =
                            DocumentBuilderFactory.newInstance();
                        DocumentBuilder builder = null;
                        try {
                            builder = builderFactory.newDocumentBuilder();
                        } catch (ParserConfigurationException e) {
                            e.printStackTrace();
                        org.w3c.dom.Document doc =
                            (org.w3c.dom.Document)builder.parse(file);
                        System.out.println("Parsed the xml");
                        org.w3c.dom.NodeList nodes =
                            doc.getElementsByTagName("entry");
                        System.out.println("Total Profiles fetched:: " +
                                           nodes.getLength());
    This is giving the nodes.getLength() as 0. Though the code runs fine in the Java Client (directly from eclipse)
    The snippet for the SAX method is :
                SAXParserFactory factory = SAXParserFactory.newInstance();
                SAXParser saxParser = factory.newSAXParser();
                DefaultHandler handler = new DefaultHandler() {
                    boolean bfname = false;
                    boolean blname = false;
                    boolean bnname = false;
                    boolean bsalary = false;
                    public void startElement(String uri, String localName,
                                             String qName,
                                             Attributes attributes) throws SAXException {
                        //   System.out.println("Start Element :" + qName);
                        if (qName.equalsIgnoreCase("d:Name")) {
                            blname = true;
                    public void endElement(String uri, String localName,
                                           String qName) throws SAXException {
                        //     System.out.println("End Element :" + qName);
                    public void characters(char[] ch, int start,
                                           int length) throws SAXException {
                        if (blname) {
                            System.out.println("d:Name : " +
                                               new String(ch, start, length));
                            blname = false;
                           saxParser.parse("home/oracle/UserProfiles.xml", handler);
    This is throwing a java.net.malformedurlexception: no protocol: /home/oracle/userprofiles.xml exception. I tried to pass it as "file://home/oracle/UserProfiles.xml" but then is gives a
    java.net.ConnectException: Connection refused Even this code is running fine in the Java Client when ran directly. It seems there is some weblogic configurations I am missing for the XML parsing?
    Please do help, if anyone has faced any issues parsing an xml in a Schedule job. Will highly appreciate your inputs.
    Thanks,
    Anuj.  

  • ?xml version="1.0"? tag not appearing as first characters in document

    Hi,
    JSP below successfully creates a XML document but it includes a blank line before the <?xml version="1.0"?> tag.
    This causes my PL/SQL to return a "ORA-20100: Error occurred while parsing: PI names starting with 'xml' are
    reserved." error when using the XMLPARSER package.
    I am outputting the XML to IE5.0 but even if I do a SYSTEM out I get the same blank line before the initial tag.
    There are posts on here that confirm the PI error is caused by the tag not being the first characters in the document, but no solution/fix is provided.
    Any ideas much appreciated.
    JSP Code
    <%@ page import="java.sql.*, oracle.jbo.*, oracle.jdeveloper.cm.*, oracle.jdbc.*,oracle.xml.sql.query.*" %>
    <%String driver="oracle.jdbc.driver.OracleDriver";
    Driver d = new oracle.jdbc.driver.OracleDriver();
    String dbURL="jdbc:oracle:thin:@localhost:1521:mydb";
    String login="i2k";
    String password="fred";
    Connection cn = null;
    cn = DriverManager.getConnection(dbURL,login,password);
    // SQL Statement from URL Parameters
    String sql = request.getParameter("sql");
    if(sql == null){
    sql = "select * from vfi_trans";
    // Create SQL-to-XML Handler
    OracleXMLQuery q = new OracleXMLQuery(cn, sql);
    // Use <TransactionList> as document element for Rowset
    q.setRowsetTag("TransactionList");
    // Use <Transaction> for each row in the result
    q.setRowTag("Transaction");
    // set encoding
    q.setEncoding("iso-8859-1");
    // ensure lower case element names
    q.useLowerCaseTagNames();
    // Generate XML results and write to output
    String xmldoc = q.getXMLString();
    out.println(xmldoc.trim());
    //System.out.println(xmldoc.indexOf("\n"));
    cn.close();%>
    PL/SQL
    PROCEDURE XML_HANDLER2 IS
    -- MODIFICATION HISTORY
    -- Person Date Comments
    vfiURL VARCHAR2(100);
    parser xmlparser.Parser;
    vfiXML xmldom.DOMDocument;
    transactions xmldom.DOMNodeList;
    transactions_found NUMBER;
    curNode xmldom.DOMNode;
    textChild xmldom.DOMNode;
    v_itrans_site vfi_trans.itrans_site%TYPE;
    BEGIN
    dbms_output.put_line('Integrator 2000 Transactions');
    -- This is the URL to browse for an XML-based vfi feed of stories on XML
    vfiURL := 'http://10.1.1.111:7070/i2k25_html/ShowQuery.jsp?sql=select%20*%20from%20vfi_trans';
    -- Set the machine to use as the HTTP proxy server for URL requests
    http_util.setProxy('MYPROXY');
    -- Parse the live XML vfi feed from Moreover.com by URL
    parser := xmlparser.newParser;
    vfiXML := xml.parseURL( vfiURL );
    xmlparser.freeParser(parser);
    -- Search for all <headline_text> elements in the document we recieve
    transactions := xpath.selectNodes(vfiXML,'/TransactionList/ITRANS_ID');
    -- Loop over the "hits" and print out the text of the title
    FOR j IN 1..xmldom.getLength(transactions) LOOP
    -- Get the current <headline_text> node (Note the list is zero-based!)
    curNode := xmldom.item(transactions,j-1);
    -- The text of the title is the first child (text) node of
    -- the <headline_text> element in the list of "hits"
    -- textChild := xmldom.getFirstChild(curNode);
    v_itrans_site := xpath.valueof(curNode, '.');
    dbms_output.put_line('('| |LPAD(j,2)| |') '| | v_itrans_site);
    END LOOP;
    -- Free the XML document full of vfi stories since we're done with it.
    xml.freeDocument(vfiXML);
    EXCEPTION
    WHEN OTHERS THEN
    RAISE;
    END; -- Procedure
    null

    Charles,
    I believe that the blank line is caused by the JSP engine when it strips out the '<%@ page import...>' (replace bracket with brace) statement. God (or at least Larry E) forgive me for posting a link at IBM, but this article speaks to your issue:
    http://www-106.ibm.com/developerworks/library/j-dynxml.html?dwzone=ibm
    Maybe you need to put the <?xml?> tag in the jsp itself and strip it out of your xmldoc before outputting it.
    Good luck.

  • Create a tree from XML

    hi. I have created a simple XML file which contains a hierarchical structure of strings.
    Also, I have created a SAXParser to read from the xml.
    But I don't know how to put this structure in a JTree.I don't want to show the tree on screen. I want to be able to access certain nodes at different times.
    Any help?

    I've created the SAXParser and as you can see I've read the XML file. I need to write some code in the characters method to add the relecvant strings to the tree. I'm quite new at this...
    public class Echo extends DefaultHandler
    public static void main(String args[])
    DefaultHandler handler=new Echo();
    SAXParserFactory factory=SAXParserFactory.newInstance();
    try
    SAXParser saxParser=factory.newSAXParser();
    saxParser.parse(new File("meniu.xml"),handler);
    }catch(Throwable t)
    t.printStackTrace();
    System.exit(0);
    public void startDocument()
    throws SAXException
    public void endDocument()
    throws SAXException
    public void startElement(String namespaceURI,
    String sName,
    String qName,
    Attributes attrs)
    throws SAXException
    String eName=sName;
    if("".equals(eName)) eName=qName;
    public void endElement(String namespaceURI,
    String sName,
    String qName)
    throws SAXException
    public void characters(char[] buf,int offset, int len)
    throws SAXException
    String s=new String(buf,offset,len);
    if(!s.trim().equals("")) {

  • XML Publisher and HTML DB

    Hello;
    Is anyone out there have integrated the XML Publisher with Application Express (aka HTML DB) ?
    Thank you.
    Shaun

    Hi Mike,
    i'm looking for the same info about integrating xml pub with htmldb.
    For now i'm only testing it, however i heard that can be paid as well 40$ for employee.
    Is not too much as we pay as well microsoft...
    However would be nice to have a separate price list regarding only the xml publ. (such as it's a standalone product)
    However did you go further into the evaluation of htmldb + xml pub?
    thanx

  • Not able to validate the xml document against DTD using SAX

    Hi ,
    i am not able to validate xml document against its DTD using SAX parser even after setting setValidating = true. even if the file is not correct according to DTD , it is not throwing any exception. what could be the reason.? please help..
    kranthi
    this is the code sample i used.
    SAXParserFactory factory = SAXParserFactory.newInstance();
    factory.setValidating(true);
         try {
    factory.newSAXParser().parse(new File("sample.xml"), handler);
         } catch (SAXException e) {
         e.printStackTrace();                         System.exit(2);
         } catch (ParserConfigurationException e) {
    e.printStackTrace();
    }

    Hi karthik
    Thanks for your response
    Actually iam a beginner in java coding hence struggling to come up with the things
    I tried putting your code and onserver side i see it is returning 09:12:17,234 INFO [STDOUT] [root: null]
    actually the same program i wrote in java
    and the same method i was calling from the main
    and it is working fine and the xml document is getting displayed one important thing to be noted here is that the factory.newDocumentBuilder().parse(new File(filename));is returing XmlDocument
    and the printing takes place
    but the in same method public static Document parseXMLFile(String filename, boolean b) in servlet
    the line factory.newDocumentBuilder().parse(new File(filename)); is returning DeferredDocumentImpl
    and this creating problem , had it returned XmlDocument
    i would have printed the elements one one
    but as it is returning deferredimpl
    iam unable to print the elements
    could you please tell me why factory.newDocumentBuilder().parse(new File(filename)); is returning DeferredDocumentImpl
    in servlets but in plain java pogram it is returing XmlDocument
    Thanks
    Bhanu

  • XML and sending its data by sockets

    In my new project, i need to receive data from an XML file and send it to a client when the client has requested it from my server.
    so far, i've stored the elements into variables (i'll call them item1, item2, and item3 for now). I put this into the protocol so when the client calls upon the server to store itemn to one of its variables, it will do so.
    apperently, all this does is send my String variable output, which starts out as null and doesn't change, and so the output remains null which in turn will close my client. here's my protocol (it gathers data from avalonmap.xml):
    * xmlStorage.java
    * Created on January 3, 2006, 12:23 AM
    * To change this template, choose Tools | Options and locate the template under
    * the Source Creation and Management node. Right-click the template and choose
    * Open. You can then make changes to the template in the Source Editor.
    package mudmap.xml;
    import java.io.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    * @author Fender Bender
    public class mapLoader extends DefaultHandler {
        StringBuffer textBuffer;
        String roomName, region, color, roomOwner,roomCCC, roomCCCID, roomItem,
                roomItemID;
        String directions[];
        String dx,dy;
        static String currentElement;
        /** Creates a new instance of mapLoder() */
        public mapLoader() {
        public String processInput(String input) {
            String output="hello";
            if(input=="getRoom") { // for now, I'll call this item1. if client requests
                output = roomName;  //  it, the output will be roomName
                                                      // which is defined at //============
                                                      // in EchoText()
            return output;
        public static void main(String argv[]) {
            // Use an instance of ourselves as the SAX event handler
            DefaultHandler handler = new mapLoader();
    // Use the default (non-validating) parser
            SAXParserFactory factory = SAXParserFactory.newInstance();
            try {
    // Set up output stream
                out = new OutputStreamWriter(System.out, "UTF8");
                SAXParser saxParser = factory.newSAXParser();
                saxParser.parse( new File("avalonmap.xml"), handler );
            } catch (Throwable t) {
                t.printStackTrace();
            System.exit(0);
        static private Writer out;
        public void startDocument()
        throws SAXException {
            nl();
            nl();
            emit("START DOCUMENT");
            nl();
            emit("<?xml version='1.0' encoding='UTF-8'?>");
        public void endDocument()
        throws SAXException {
            nl();
            emit("END DOCUMENT");
            nl();
            emit(region + "\n" + color + "\n" + roomOwner  + "\n" + roomName + "\n" +
                    dx + "," + dy + "\n" + "room CCCs: " + roomCCC + " (" +
                    roomCCCID + ")\n" + "room items: " + roomItem + " (" +
                    roomItemID +")");
            try {
                nl();
                out.flush();
            } catch (IOException e) {
                throw new SAXException("I/O error", e);
        public void startElement(String namespaceURI,
                String sName, // simple name
                String qName, // qualified name
                Attributes attrs)
                throws SAXException {
            echoText();
            nl();
            emit("ELEMENT: ");
            String eName = sName; // element name
            if ("".equals(eName)) eName = qName; // not namespace-aware
            emit("<"+eName);
            currentElement=eName;
            if (attrs != null) {
                for (int i = 0; i < attrs.getLength(); i++) {
                    String aName = attrs.getLocalName(i); // Attr name
                    if ("".equals(aName)) aName = attrs.getQName(i);
                    nl();
                    emit(" ATTR: ");
                    emit(aName);
                    emit("\t\"");
                    emit(attrs.getValue(i));
                    emit("\"");
            if (attrs.getLength() > 0) nl();
            emit(">");
        public void endElement(String namespaceURI,
                String sName, // simple name
                String qName // qualified name
                throws SAXException {
            echoText();
            currentElement="";
            nl();
            emit("END_ELM: ");
            String eName = sName; // element name
            if ("".equals(eName)) eName = qName; // not namespace-aware
            emit("</"+eName+">");
        public void characters(char buf[], int offset, int len)
        throws SAXException {
            String s = new String(buf, offset, len);
            if (textBuffer == null) {
                textBuffer = new StringBuffer(s);
            } else {
                textBuffer.append(s);
        private void echoText()
        throws SAXException {
            if (textBuffer == null) return;
            nl();
            emit("CHARS:  |" + currentElement + ": ");
            String s = ""+textBuffer;
            if(currentElement=="region") {
                region = s;
            } else if(currentElement=="color") {
                color = s;
            } else if(currentElement=="roomOwner") {
                roomOwner = s;
            } else if(currentElement=="roomName") {
                roomName = s;                                             //============
            } else if(currentElement=="x") {
                dx = s;
            } else if(currentElement=="y") {
                dy = s;
            } else if(currentElement=="roomCCC") {
                roomCCC = s;
            } else if(currentElement=="roomCCCID") {
                roomCCCID = s;
            } else if(currentElement=="roomItem") {
                roomItem = s;
            } else if(currentElement=="roomItemID") {
                roomItemID = s;
            emit("|");
            textBuffer = null;
        private void emit(String s)
        throws SAXException {
            try {
                out.write(s);
                out.flush();
            } catch (IOException e) {
                throw new SAXException("I/O error", e);
        private void nl()
        throws SAXException {
            String lineEnd = System.getProperty("line.separator");
            try {
                out.write(lineEnd);
            } catch (IOException e) {
                throw new SAXException("I/O error", e);
    }

    for one thing, don't use == to compare strings... You have that all over the place, like:
    if(currentElement=="region") {                                                                                                                                                                                                                                                   

Maybe you are looking for