PLSQL parser for XML

What is wrong with this?
declare
n xmlparser.DOMNode;
n1 xmlparser.DOMNode;
n2 xmlparser.DOMNode;
e xmlparser.DOMElement;
begin
e := xmlparser.createElement (document,'TEST_ELEMENT');
n1 := xmlparser.makeNode(e);
n2 := xmlparser.appendChild(n,xmlparser.makeNode(e));
creates a empty node
<Location>
<Country>US
<TEST_ELEMENT/>
</Country>
</Location>
Question : How can I create a Text Node under <TEST_ELEMENT>,
example
<TEST_ELEMENT>Test element comment node
</TEST_ELEMENT>
Thanks for your help.
null

sk (guest) wrote:
: What is wrong with this?
: declare
: n xmlparser.DOMNode;
: n1 xmlparser.DOMNode;
: n2 xmlparser.DOMNode;
: e xmlparser.DOMElement;
: begin
: e := xmlparser.createElement (document,'TEST_ELEMENT');
: n1 := xmlparser.makeNode(e);
: n2 := xmlparser.appendChild(n,xmlparser.makeNode(e));
: creates a empty node
: <Location>
: <Country>US
: <TEST_ELEMENT/>
: </Country>
: </Location>
: Question : How can I create a Text Node under <TEST_ELEMENT>,
: example
: <TEST_ELEMENT>Test element comment node
: </TEST_ELEMENT>
: Thanks for your help.
Use the createTextNode method to create a new text node. Then
convert the DOMElement to a DOMNode using makeNode. Now, you can
use appendChild to append the text node to the DOMElement.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
null

Similar Messages

  • PL/SQL Parser for XML

    When production version of Oracle XML Parser for PL/SQL is
    available?
    and what are other XML utilities to be available for PL/SQL?
    null

    Do you have more precison about the date of the production
    version of Oracle XML Parser for PL/SQL?
    Oracle XML Team wrote:
    : We have not yet announced a production date for the PL/SQL
    : version as this just went beta and we need to get sufficient
    : feedback. Have you tried it? Other PL/SQL XML utilities can
    be
    : found at http://www.oracle.com/xml/plsxml/index.html.
    : Oracle XML Team
    : http://technet.oracle.com
    : Oracle Technology Network
    : Boris Kolodny (guest) wrote:
    : : When production version of Oracle XML Parser for PL/SQL is
    : : available?
    : : and what are other XML utilities to be available for PL/SQL?
    null

  • Custom parser for XML

    Hello forum,
    I want to put in iFS XML documents with binary content encoded in base64.
    I have created "PrintedDoc" base on "Document" with new attributes: Name, Pages, PeportName.
    I created test XML file and iFS parses it just fine.
    This is an example of XML file:
    <?xml version = '1.0' standalone = 'yes'?>
    <PrintedDoc>
    <Name> Angebot-Nr. 123 vom 12.06.2002.pdf </Name>
    <FolderPath> /printed/Angebote </FolderPath>
    <Pages> 3 </Pages>
    <Format RefType="name"> PDF </Format>
    <ReportName> Angebot </ReportName>
    <Content>AABC-+.....AABCD</Content>
    </PrintedDoc>
    Now I want to decode content back into binary format and store binary data. I have written java class for decoding. I will write a parser that decodes base64 content into binary data.
    My question: How I can register my parser for that xml document? I read about including namespace into document and registering custom XML parser, but this will give me the whole xml document as incoming data.
    I would appreciate if you share your experience or give some hints.
    TIA
    Alexandre

    Hi again,
    I'm trying to write XML pareser implementing XmlParserInterface. I have implemented parse methods and used IfsXmlParser.CreateDOM to get parsed XMLDocument.
    As far as I know, my xml parser should be instaneiated by IfsXmlParser, which in turn calls one of parse methods. The problem is that XmlParserInterface doesn't contain constructors to implement. For example, interface Parser has constructor with argument of type LibrarySession.
    How I can get current LibrarySession from my XML parser? Should I implement both interfaces Parser and XmlParserInterface?
    Thanks for any help,
    Alexandre.
    PS: are Java sources of iFS available somewhere? It would be helpful to get knowledge of how the things working. There is no documentation for creating XML parsers. I have only found about writing usual custom parsers in Developer Guide and a little in iFS API. But that is very scant. :(((

  • Parser for XML as output from DB..

    Hi Guys,
    Can some one tell me a parser which can take a query and gives the output as an XML format. And takes an XML file and puts the data into DB. pl. let me know from where i can download the parser. and if u have any sample code pl give me.
    Any help would be appreciated greatly.
    Thanks in advance.
    Anil([email protected]).

    Thanks alot Bernhard.
    I got it. But now i would like to know, can i specify the XML format to be generated(DTD kind of thing)when we make a query, like the query will be getting the data of two tables say master and child. so for each record of master there can be multiple childs. at that time i dont want the master data come along with all the childs(master data duplication should not be there). let me put like this. In the master tag there can/should be multiple child tags(sub tags). can this be done using the XSU or XDK ? In the same way can we insert data into two tables at a time. its like we will be taking the data from two tables do some operations reduce some data and then insert into two tables again. can this be achieved with xml file. And i would like to know how to generate one xml for one master record(including its child records, going to be join or sub query etc..) Am i clear on to my question ? If u have any sample data on this could u give me. once again thanks alot for the url.
    Any help would be appreciated greatly.
    Thanks in advance.
    Anil([email protected]).

  • SAX Parser For XML

    Hello all,
    I am trying Parsing XML thorugh SAX. Were to get SJXP.jar and parser.jar files on sun site
    if any body have these files plz mail :[email protected]

    String buf = (new String(ch, start, length)).trim();
    if (thisElement != "root"){   
    if ((buf.length() == 0) && (thisElement !="") ){
    It run ok!
    Thanks 58871!
    Now, i want to export oracle table to xml file like :
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <emp>
    <ename>aaa</ename>
    <sal>3000</sal>
    </emp>
    <emp>
    <ename>bbb</ename>
    <sal>5000</sal>
    </emp>
    </root>
    Can SAX export to xml format?
    Pham Thanh Tung

  • Parser for XML

    Hi you all,
    I would just like to hear from you, what parser do you usually use to work with XML.
    JAXP or JDOM.
    THere so many choices...
    Many Thanks,
    MeTitus

    `hi
    DOM is mainly used if we have to build or alter the xml docs and sax if we have to only read the xml docs
    DOM is mainly prefered in the real world
    hope this helps

  • PL/SQL parser for 7.3 DB?

    We have an ORACLE 7.3 DB and are looking for a PL/SQL parser for XML... Some of the posts I've seen seem to suggest that a solution exists, but I'm not having any luck finding out for sure...
    Thanks,
    Jeff

    http://technet.oracle.com/tech/xml/info/index2.htm?Info&plsxml/xml4plsql.htm

  • Package for xml file insersion

    hi every body
    if any body know the link for the package of xml file insersion into oracle database. and also parser for xml file then plz tell me.
    my email address is " [email protected] "

    hi every body
    if any body know the link for the package of xml file insersion into oracle database. and also parser for xml file then plz tell me.
    my email address is " [email protected] "

  • SAX, incor. data for XML element, XML 1.1 doc (1.0 ok) in JRE 6 (JRE 5 ok)

    Hello,
    for some reason, the test case below fails when driven with Java 6. Looks like, when long string data is stored in a XML element, DocumentHandler's characters() method will be provided with incorrect data.
    With XML 1.0, parsing works fine in all my tests, Apache Xerces, JRE 5, JRE 6.
    With XML 1.1., parsing works fine with Apache Xerces, JRE5 but not with JRE6.
    I've checked it with latest JRE 6 update 4.
    Anyone else xperiencing such problems with XML1.1 parsing when using JAXP bundled with Java 6?
    I've tried to file a bug at bugdatabase, but for some reason I got no response for my issue - so I'm trying the forum now ;-)
    Thanx for comments
    Merten
    import java.io.StringReader;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.Attributes;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import org.xml.sax.helpers.DefaultHandler;
    import junit.framework.TestCase;
    import junit.framework.TestResult;
    import junit.framework.TestSuite;
    /** snippet to demonstrate problem in SAXParser */
    public class ProblemWithSAXParser extends TestCase
    public static void main(String[] args)
    TestResult result=junit.textui.TestRunner.run(suite());
    System.exit(result.wasSuccessful() ? 0 : 1);
    private static junit.framework.Test suite()
    final TestSuite ts=new TestSuite();
    ts.addTestSuite(ProblemWithSAXParser.class);
    return (ts);
    /** small DocumentHandler, just waiting for one and only XML element <c></c> */
    class MySAXDocumentHandler extends DefaultHandler
    boolean listening=false;
    public void startElement(final String uri, final String localName, final String qName, final Attributes attributes)
    throws SAXException
    System.out.println("startElement uri " + uri + " localName " + localName + " qName " + qName);
    if("c".equals(qName))
    listening=true;
    public void endElement(final String uri, final String localName, final String qName) throws SAXException
    System.out.println("endElement uri " + uri + " localName " + localName + " qName " + qName);
    if("c".equals(qName))
    listening=false;
    public void characters(final char ch[], final int start, final int length) throws SAXException
    if(listening)
    final String str=new String(ch, start, length);
    System.out.println("<c> element, start==" + start + " length==" + length + " ch.length==" + ch.length + " ch=="
    + str);
    sb.append(str);
    private final StringBuffer sb=new StringBuffer();
    /** return what I got for XML element <c></c> */
    public String toString()
    return (sb.toString());
    /** test an XML document with an element <c>, use XML 1.0 and XML 1.1 and some (more)
    * content in the XML element */
    public void testWithSunAndApache() throws Exception
    // test XML element content for <c> element
    final StringBuffer plain_str=new StringBuffer("");
    for(int i=0; i < 500; i++)
    plain_str.append("0123456789 This is some text ").append(i).append(". ");
    final String xml_orig=plain_str.toString();
    // SAX parsers, one Sun, one (original) Apache Xerces
    // accept that Apache Xerces is not in path ...
    final String prop_name="javax.xml.parsers.SAXParserFactory";
    final String prop_val_sun="com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl";
    final String prop_val_apache="org.apache.xerces.jaxp.SAXParserFactoryImpl";
    System.setProperty(prop_name, prop_val_sun);
    final SAXParser sax_sun=SAXParserFactory.newInstance().newSAXParser();
    System.out.println("SaxParser Sun= " + sax_sun);
    assertTrue(("" + sax_sun).indexOf("com.sun.") >= 0);
    System.setProperty(prop_name, prop_val_apache);
    SAXParser sax_apache;
    try
    sax_apache=SAXParserFactory.newInstance().newSAXParser();
    catch(final Throwable t)
    System.err.println("no Apache Xerces in path? " + t);
    sax_apache=null;
    System.out.println("SaxParser Apache= " + sax_apache);
    assertTrue(sax_apache==null || ("" + sax_apache).startsWith("org.apache."));
    // i==0: XML 1.0, i==1: XML 1.1
    for(int i=0; i <= 1; i++)
    assert i == 0 || i == 1;
    final String xml_version=(i == 0 ? "1.0" : "1.1");
    final StringBuffer sb=new StringBuffer("<?xml version=\"" + xml_version + "\" encoding=\"UTF-8\"?><c>");
    sb.append(xml_orig);
    sb.append("</c>");
    final String xml=sb.toString();
    // parse it!
    final StringReader string_reader_sun, string_reader_apache;
    string_reader_sun=new StringReader(xml);
    final InputSource input_source_sun=new InputSource(string_reader_sun);
    string_reader_apache=new StringReader(xml);
    final InputSource input_source_apache=new InputSource(string_reader_apache);
    final MySAXDocumentHandler my_handler_sun, my_handler_apache;
    my_handler_sun=new MySAXDocumentHandler();
    my_handler_apache=new MySAXDocumentHandler();
    sax_sun.parse(input_source_sun, my_handler_sun);
    if(sax_apache!=null)
    sax_apache.parse(input_source_apache, my_handler_apache);
    final String xml_sun=my_handler_sun.toString();
    final String xml_apache=my_handler_apache.toString();
    assertNotNull(xml_sun);
    assertNotNull(xml_apache);
    System.out.println("xml version " + xml_version);
    System.out.println("xml " + xml);
    System.out.println("xml_orig " + xml_orig);
    System.out.println("xml_sun " + xml_sun);
    System.out.println("xml_apache " + xml_apache);
    // test the data returned from DocumentHandler
    if(sax_apache!=null)
    assertEquals(xml_orig, xml_apache);
    assertEquals(xml_orig.length(), xml_sun.length()); // length seems to be okay
    assertEquals(xml_orig, xml_sun); // content seems to be not okay for XML 1.1
    }

    thanx, DrClap, haven't seen the "code" button for some reason, code is attached again
    The output of my test is like this for JRE6 (truncated)
    xml_sun 456789 This is is some text 0. 0123456789 This is some text 1.
    xml_apache 0123456789 This is some text 0. 0123456789 This is some text 1.
    Notice, xml_sun not only starts wrong ("0123" missing) - for some reason, the text there is not "This is some text" but "This is is some text" - very interesting in a way. I guess there's an issue with repeated text chunks ...
    So, the data in my XML element is kind of changed, the length of the string is okay but the characters are "misplaced" or so :-) I thought about a problem with StringBuffer first, but the StringBuffer works fine for Apache ... so I really think there's an issue with JRE 6's parser for XML 1.1
    Merten
    import java.io.StringReader;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import org.xml.sax.Attributes;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import org.xml.sax.helpers.DefaultHandler;
    import junit.framework.TestCase;
    import junit.framework.TestResult;
    import junit.framework.TestSuite;
    /** snippet to demonstrate problem in SAXParser */
    public class ProblemWithSAXParser extends TestCase
    public static void main(String[] args)
      TestResult result=junit.textui.TestRunner.run(suite());
      System.exit(result.wasSuccessful() ? 0 : 1);
    private static junit.framework.Test suite()
      final TestSuite ts=new TestSuite();
      ts.addTestSuite(ProblemWithSAXParser.class);
      return (ts);
    /** small DocumentHandler, just waiting for one and only XML element <c></c> */
    class MySAXDocumentHandler extends DefaultHandler
      boolean listening=false;
      public void startElement(final String uri, final String localName, final String qName, final Attributes attributes)
        throws SAXException
       System.out.println("startElement uri " + uri + " localName " + localName + " qName " + qName);
       if("c".equals(qName))
        listening=true;
      public void endElement(final String uri, final String localName, final String qName) throws SAXException
       System.out.println("endElement uri " + uri + " localName " + localName + " qName " + qName);
       if("c".equals(qName))
        listening=false;
      public void characters(final char ch[], final int start, final int length) throws SAXException
       if(listening)
        final String str=new String(ch, start, length);
        System.out.println("<c> element, start==" + start + " length==" + length + " ch.length==" + ch.length + " ch=="
          + str);
        sb.append(str);
      private final StringBuffer sb=new StringBuffer();
      /** return what I got for XML element <c></c> */
      public String toString()
       return (sb.toString());
    /** test an XML document with an element <c>, use XML 1.0 and XML 1.1 and some (more)
      * content in the XML element */
    public void testWithSunAndApache() throws Exception
      // test XML element content for <c> element
      final StringBuffer plain_str=new StringBuffer("");
      for(int i=0; i < 500; i++)
       plain_str.append("0123456789 This is some text ").append(i).append(". ");
      final String xml_orig=plain_str.toString();
      // SAX parsers, one Sun, one (original) Apache Xerces
      // accept that Apache Xerces is not in path ...
      final String prop_name="javax.xml.parsers.SAXParserFactory";
      final String prop_val_sun="com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl";
      final String prop_val_apache="org.apache.xerces.jaxp.SAXParserFactoryImpl";
      System.setProperty(prop_name, prop_val_sun);
      final SAXParser sax_sun=SAXParserFactory.newInstance().newSAXParser();
      System.out.println("SaxParser Sun= " + sax_sun);
      assertTrue(("" + sax_sun).indexOf("com.sun.") >= 0);
      System.setProperty(prop_name, prop_val_apache);
      SAXParser sax_apache;
      try
       sax_apache=SAXParserFactory.newInstance().newSAXParser();
      catch(final Throwable t)
       System.err.println("no Apache Xerces in path? " + t);
       sax_apache=null;
      System.out.println("SaxParser Apache= " + sax_apache);
      assertTrue(sax_apache==null || ("" + sax_apache).startsWith("org.apache."));
      // i==0: XML 1.0, i==1: XML 1.1
      for(int i=0; i <= 1; i++)
       assert i == 0 || i == 1;
       final String xml_version=(i == 0 ? "1.0" : "1.1");
       final StringBuffer sb=new StringBuffer("<?xml version=\"" + xml_version + "\" encoding=\"UTF-8\"?><c>");
       sb.append(xml_orig);
       sb.append("</c>");
       final String xml=sb.toString();
       // parse it!
       final StringReader string_reader_sun, string_reader_apache;
       string_reader_sun=new StringReader(xml);
       final InputSource input_source_sun=new InputSource(string_reader_sun);
       string_reader_apache=new StringReader(xml);
       final InputSource input_source_apache=new InputSource(string_reader_apache);
       final MySAXDocumentHandler my_handler_sun, my_handler_apache;
       my_handler_sun=new MySAXDocumentHandler();
       my_handler_apache=new MySAXDocumentHandler();
       sax_sun.parse(input_source_sun, my_handler_sun);
       if(sax_apache!=null)
        sax_apache.parse(input_source_apache, my_handler_apache);
       final String xml_sun=my_handler_sun.toString();
       final String xml_apache=my_handler_apache.toString();
       assertNotNull(xml_sun);
       assertNotNull(xml_apache);
       System.out.println("xml version " + xml_version);
       System.out.println("xml        " + xml);
       System.out.println("xml_orig   " + xml_orig);
       System.out.println("xml_sun    " + xml_sun);
       System.out.println("xml_apache " + xml_apache);
       // test the data returned from DocumentHandler
       if(sax_apache!=null)
        assertEquals(xml_orig, xml_apache);
       assertEquals(xml_orig.length(), xml_sun.length()); // length seems to be okay
       assertEquals(xml_orig, xml_sun); // content seems to be not okay for XML 1.1
    }

  • XML Parser for PLSQL and BIG5/UTF-8

    I'm trying store data in traditional chinese submitted by IE5 (through oXMLHttpRequest.send() and javascript), I tried both 'encoding="BIG5"' and 'encoding="UTF-8"'.
    It seems that the parser ignore all characters that are not ascii regardless of their encoding.
    Any thoughts will be much appreciated
    procedure UpdateXMLProc(xmlSrc varchar2)
    is
    p xmlparser.parser;
    doc xmldom.DOMDocument;
    nlist xmldom.DOMNodeList;
    list_len pls_integer;
    node1 xmldom.DOMNode;
    node2 xmldom.DOMNode;
    node3 xmldom.DOMNode;
    begin
    p := xmlparser.newParser;
    xmlparser.parseBuffer(p, xmlSrc);
    doc := xmlparser.getDocument(p);
    nlist := xmldom.getElementsByTagName(doc, 'ROW');
    list_len := xmldom.getLength(nlist);
    -- loop through elements
    for j in 0..list_len-1 loop
    node1 := xmldom.item(nlist, j);
    -- get primary key values
    node2 := xmldom.getFirstChild(node1);
    loop
    -- get the text node and if not null get value
    node3 := xmldom.getFirstChild(node2);
    if not xmldom.isNull(node3) then
    -- THIS OUTPUT MAY ALTER CHARACTER IF IT'S NOT ASCII
    htp.p(xmldom.getNodeValue(node3));
    end if;
    -- get next field
    node2 := xmldom.getNextSibling(node2);
    exit when (xmldom.isNull(node2));
    end loop;
    end loop;
    -- THIS OUTPUT WILL BE IN THE SAME ENCODING AS THE ORIGINAL
    htp.p(xmlSrc);
    end;
    null

    I just ran the initjvm.sql,initdbj.sql and
    initsqlj.sql.
    Still getting the error.
    Please help!!!!
    Thanks
    Jay
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jay ([email protected]):
    I have Oracle8i Release 8.1.5.0.0 - ProductionWith the Java option
    PL/SQL Release 8.1.5.0.0 - Production version
    runnig in sun sparc server.
    While I am loading Oracle XML Parser for PLSQL(using plxmlparser_V1_0_1.tar.gz) have a problem. When I try to load the xmlparser.jar class and I get the
    following messages:
    initialization complete
    Error while accessing MD5 table
    ORA-00942: table or view does not exist
    loading : org/w3c/dom/DOMImplementation
    Error while loading org/w3c/dom/DOMImplementation
    ORA-04068: existing state of packages has been discarded
    ORA-04063: package body "TEST.LOADLOBS" has errors
    ORA-06508: PL/SQL: could not find program unit being called
    ORA-06512: at line 1
    creating : org/w3c/dom/DOMImplementation
    Error while creating class org/w3c/dom/DOMImplementation
    ORA-00406: COMPATIBLE parameter needs to be 8.1.0.0.0 or greater
    Error while accessing MD5 table
    ORA-00942: table or view does not exist
    loading : org/w3c/dom/html/HTMLDivElement
    Error while loading org/w3c/dom/html/HTMLDivElement
    ORA-04068: existing state of packages has been discarded
    ORA-04063: package body "TEST.LOADLOBS" has errors
    ORA-06508: PL/SQL: could not find program unit being called
    and so on.
    Could anyone please tell me if I need to do any pre-installation steps.
    Thanks
    Jay<HR></BLOCKQUOTE>
    null

  • Installation of xml parser for PLSQL

    Hi,
    I hv installed oracle 8.1.7 on windows with
    jserver.
    and I did following step to install xml parser for PLSQL.
    1. loadjava -user usernmae/password@connectstr -r -v xmlparserv2.jar
    2. loadjava -user usernmae/password@connectstr -r -v xmlplsql.jar
    loading both jar files gives errors like
    resolving: oracle/xml/parser/plsql/xmlparsercover
    Error while computing shortname of oracle/xml/parser/plsql/xmlparsercover
    ORA-29540 - class oracle/aurora/rdbms/dbmsjava does not exists
    ORA-06512: in admin.dbms_java line o
    ORA-06512: IN LINE 1
    i am getting this error for all class..
    after thjat i run oracle_home/xdk/plsql/parser/bin/load.sql
    and then when i try to run demo example
    ( oracle_home/xdk/plsql/demo/ )
    then its giving following error..
    ORA-29541: class ADMIN.oracle/xml/parser/plsql/XMLParserCover could not be
    resolved
    ORA-06512: at "ADMIN.XMLPARSERCOVER", line 0
    ORA-06512: at "ADMIN.XMLPARSER", line 57
    ORA-06512: at "ADMIN.DOMSAMPLE", line 72
    ORA-06512: at line 1
    Does anyone has idea about these errors..
    need help urgently..
    Thanx
    Mehul

    Geoff Hicks (guest) wrote:
    : Problems being experienced trying to install the XML parser for
    : PL/SQL (zip file plxmlparser_v1_0_0_1_tar.gz).
    : We are on Oracle8i (8.1.5.0.0) (with JServer).
    : On installing the Oracle XML parser for PL/SQL the following
    : errors appear having run the loadjava command line tool for
    : xmlparser.jar:-
    : loading : META-INF/MANIFEST.MF
    : creating : META-INF/MANIFEST.MF
    : Error while creating resource META-INF/MANIFEST.MF
    : ORA-29547: Java system class not available:
    : oracle/aurora/rdbms/Compiler
    : loading : xmlparser_1.0.1.4_production
    : creating : xmlparser_1.0.1.4_production
    : Error while creating resource xmlparser_1.0.1.4_production
    : ORA-29547: Java system class not available:
    : oracle/aurora/rdbms/Compiler
    : Lots of the following resolver errors are returned:-
    : resolver :
    : Error while resolving class org/w3c/dom/html/HTMLDivElement
    : ORA-00904: invalid column name
    It looks like you have not initialized JServer in your 8.1.5
    database. This needs to be done first.
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    null

  • 2-byte error in XML Parser for PL/SQL

    environment:
    oracle 8.1.5
    XML parser for Java 2.0.2.6.0
    XML parser for PL/SQL 1.0.1.0.0
    we use CLOB as xml data container, but it does not work properly with 2 byte chracter set.
    I tested same situation except using VARCHAR2 instead of CLOB, it works without problem.
    I think there is some bug in method parseClob of oracle.xml.parser.plsql.XMLParserCover about converting CLOB into String.
    I appreciate any help to work around this problem.

    Hi,
    We couldn't reproduce this error with our test case. Can you please post a test case that gives you this problem so we can assist you further?
    Thank you,
    Oracle XML Team

  • Installation of XML Parser for PL/SQL

    After following the installation instruction on XML Parser PL/SQL on UNIX, I got the below error message when running the sample:
    SQL> exec domsample('/home/jyuan/oracle/plxml/sample','family.xml','err_dom.txt')
    BEGIN domsample('/home/jyuan/oracle/plxml/sample','family.xml','err_dom.txt'); END;
    ERROR at line 1:
    ORA-20100: Error occurred while parsing: Permission denied
    ORA-06512: at "JYUAN.XMLPARSER", line 22
    ORA-06512: at "JYUAN.XMLPARSER", line 69
    ORA-06512: at "JYUAN.DOMSAMPLE", line 80
    ORA-06512: at line 1
    I also checked the dba_role_privs to see if I have the privilege. The below result shows I am ok.
    SQL> select * from dba_role_privs where grantee='JYUAN';
    GRANTEE GRANTED_ROLE ADM DEF
    JYUAN CONNECT NO YES
    JYUAN ENG_DEVELOPER NO YES
    JYUAN JAVASYSPRIV NO YES
    JYUAN JAVAUSERPRIV NO YES
    I do see package XMLPARSER and procedure DOMSAMPLE in my schema. But, I don't know how to fix the problem. Your help is highly appreciated.
    Thank you.

    The XML Parser for Java comes preinstalled, as does the XML SQL utility.
    Assuming your 8.1.7 Oracle home is represented by ?, you need to:
    [list=1]
    [*]cd ?/xdk/lib
    [*]loadjava -v -r -u user/password xmlplsql.jar
    [*]cd ?/xdk/plsql/parser/bin
    [*]sqlplus user/password @load
    [list]

  • Creating a PLSQL script to parse structured XML with repeated tags

    Hi, I'm trying to parse an xml feed but the way it's structured makes it difficult to pull out the values. (see example) Would anyone be able to recommend a solution or some ideas as to how to get around this?
    SAMPLE XML:<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
         <env:Header>
         </env:Header>
         <env:Body>
              <ns3:commandResponse xmlns:ns2="http://test.com/2011/Generic/schema" xmlns:ns3="http://test.com/2011/Generic">
                   <return>
                   <ns2:return>success</ns2:return>
                   <ns2:Command>issues</ns2:Command>
                        <ns2:WorkItems>
                             <ns2:Id>216141</ns2:Id>
                             <ns2:ModelType>Issue</ns2:ModelType>
                             <ns2:DisplayId>216141</ns2:DisplayId>
                             <ns2:Field>
                                  <ns2:Name>Type</ns2:Name>
                                  <ns2:Value>
                                       <ns2:Item>
                                            <ns2:Id>Dev Task</ns2:Id>
                                            <ns2:ModelType>Type</ns2:ModelType>
                                            <ns2:DisplayId>Dev Task</ns2:DisplayId>
                                       </ns2:Item>
                                  </ns2:Value>
                             </ns2:Field>
                             <ns2:Field>
                                  <ns2:Name>ID</ns2:Name>
                                  <ns2:Value>
                                       <ns2:int>216141</ns2:int>
                                  </ns2:Value>
                             </ns2:Field>
                             <ns2:Field>
                                  <ns2:Name>Reason</ns2:Name>
                                  <ns2:Value>
                                       <ns2:string>Integrating</ns2:string>
                                  </ns2:Value>
                             </ns2:Field>
                             <ns2:Field>
                                  <ns2:Name>Dev Task Component</ns2:Name>
                                  <ns2:Value>
                                       <ns2:string>Java Tools</ns2:string>
                                  </ns2:Value>
                             </ns2:Field>
                             <ns2:Field>
                                  <ns2:Name>Created Date</ns2:Name>
                                  <ns2:Value>
                                       <ns2:datetime>2009-08-10T15:52:39.000-04:00</ns2:datetime>
                                  </ns2:Value>
                             </ns2:Field>
                             <ns2:Field>
                                  <ns2:Name>Date Closed</ns2:Name>
                                  <ns2:Value/>
                             </ns2:Field>
                             <ns2:Field>
                                  <ns2:Name>Modified Date</ns2:Name>
                                  <ns2:Value>
                                       <ns2:datetime>2011-03-04T12:57:05.000-05:00</ns2:datetime>
                                  </ns2:Value>
                             </ns2:Field>
                        </ns2:WorkItems>
                   </return>
              </ns3:commandResponse>
         </env:Body>
    </env:Envelope>This is just a sample with just one WorkItem, but there would be much more, N number of items with 9 fields per item. (Not all of the fields were put in the sample, and some can have null values)
    I only need to pull the content from /ns2:WorkItems/ns2:Field/ns2:Value/ns2:Item/ns2:Id for the first field and the /ns2:value/* tag of all the other fields. Then put this in a table where each row is a workitem and the fields are the columns (create table workitems (Type,ID,Reason,Dev Task Component,Created Date, Date Closed, Modified Date) --all the fields should be varchar2 except the dates)
    What I've been trying so far seems rather brute force by running a nested loop to go through every item and field and then an IF case for each field 1,2,...9 which would insert the value into a table.
    At the moment I'm using something like below to pull a single value
    path1 = '//ns2:WorkItems[1]/ns2:Field[1]/ns2:Value[1]/ns2:Item[1]/ns2:Id[1]';
    nameserve = 'xmlns:ns2="http://test.com/2011/Generic/schema"';
    extractvalue(xmltype(src_clob),path1,nameserve);I'm not entirely sure if I would be able to substitute the [1]'s with [' || nitem || '] where nitem is loop number to do something like:
    for nitem in 1..itemcount
    loop
        FOR nfield in 1..9
        loop
            if nfield=1 then
                path1 := '//ns2:WorkItems[' || nitem || ']/ns2:Field[' || nfield || ']/ns2:Value[1]/ns2:Item[1]/ns2:Id';
                fieldvalue := extractvalue(xmltype(src_clob),path1,nameserve);';
            else
                path2 := '//ns2:WorkItems[' || nitem || ']/ns2:Field[' || nfield || ']/ns2:Value[1]/*[1]';
                fieldvalue := extractvalue(xmltype(src_clob),path2,nameserve);';
            end if;
        end loop;
    end loop;The problem with the above script is how do I insert this fieldvalue into different columns on a table without using an IF case for each field.
    I was wondering if there is simpler way to put each field into a different column and loop through every workitem. I looked into dynamically naming variables but I don't think plsql supports that.
    Any help/advice is appreciated,
    Thanks!
    Edited by: 843508 on Mar 10, 2011 1:56 PM
    Edited by: 843508 on Mar 10, 2011 1:57 PM
    Edited by: 843508 on Mar 10, 2011 2:01 PM

    If it were me, I wouldn't use PL/SQL to try and process XML, but would use SQL's XMLTABLE functionality e.g.
    SQL> ed
    Wrote file afiedt.buf
      1  WITH t as (select XMLTYPE('
      2  <RECSET xmlns:aa="http://www.w3.org">
      3    <aa:REC>
      4      <aa:COUNTRY>1</aa:COUNTRY>
      5      <aa:POINT>1800</aa:POINT>
      6      <aa:USER_INFO>
      7        <aa:USER_ID>1</aa:USER_ID>
      8        <aa:TARGET>28</aa:TARGET>
      9        <aa:STATE>6</aa:STATE>
    10        <aa:TASK>12</aa:TASK>
    11      </aa:USER_INFO>
    12      <aa:USER_INFO>
    13        <aa:USER_ID>5</aa:USER_ID>
    14        <aa:TARGET>19</aa:TARGET>
    15        <aa:STATE>1</aa:STATE>
    16        <aa:TASK>90</aa:TASK>
    17      </aa:USER_INFO>
    18    </aa:REC>
    19    <aa:REC>
    20      <aa:COUNTRY>2</aa:COUNTRY>
    21      <aa:POINT>2400</aa:POINT>
    22      <aa:USER_INFO>
    23        <aa:USER_ID>3</aa:USER_ID>
    24        <aa:TARGET>14</aa:TARGET>
    25        <aa:STATE>7</aa:STATE>
    26        <aa:TASK>5</aa:TASK>
    27      </aa:USER_INFO>
    28    </aa:REC>
    29  </RECSET>') as xml from dual)
    30  -- END OF TEST DATA
    31  select x.country, x.point, y.user_id, y.target, y.state, y.task
    32  from t
    33      ,XMLTABLE(XMLNAMESPACES('http://www.w3.org' as "aa"),
    34                '/RECSET/aa:REC'
    35                PASSING t.xml
    36                COLUMNS country NUMBER PATH '/aa:REC/aa:COUNTRY'
    37                       ,point   NUMBER PATH '/aa:REC/aa:POINT'
    38                       ,user_info XMLTYPE PATH '/aa:REC/*'
    39               ) x
    40      ,XMLTABLE(XMLNAMESPACES('http://www.w3.org' as "aa"),
    41                '/aa:USER_INFO'
    42                PASSING x.user_info
    43                COLUMNS user_id NUMBER PATH '/aa:USER_INFO/aa:USER_ID'
    44                       ,target  NUMBER PATH '/aa:USER_INFO/aa:TARGET'
    45                       ,state   NUMBER PATH '/aa:USER_INFO/aa:STATE'
    46                       ,task    NUMBER PATH '/aa:USER_INFO/aa:TASK'
    47*              ) y
    SQL> /
       COUNTRY      POINT    USER_ID     TARGET      STATE       TASK
             1       1800          1         28          6         12
             1       1800          5         19          1         90
             2       2400          3         14          7          5p.s. XML questions are better suited in the XML DB forum:
    XML DB FAQ

  • Installation of XML parser for PL/SQL, and XML_SQL

    I have just migrated a 7.3.4.4 database to 8.1.7. Please could you tell me what I need to install (and where I would find the software and installation instructions) so that we can use the XML parser for PL/SQL and also XML_SQL. (NB Do I need to install java - and if so, again where would I find the installation software and instructions). Many Thanks.
    Jenny

    The XML Parser for Java comes preinstalled, as does the XML SQL utility.
    Assuming your 8.1.7 Oracle home is represented by ?, you need to:
    [list=1]
    [*]cd ?/xdk/lib
    [*]loadjava -v -r -u user/password xmlplsql.jar
    [*]cd ?/xdk/plsql/parser/bin
    [*]sqlplus user/password @load
    [list]

Maybe you are looking for

  • Help with Joins in ABAP

    Hello Experts, I am struggling with a problem. In my development I have two db tables for eg. Table A and Table B. Now table A has about 200,000 entries and table B has about 800,000 entries. I want to delete all the extra entries (junk entries-not 

  • How to display values of shuttle pane by defaul in left shuttle

    Hi I have created shuttle pane through JDeveloper and I have set all properties It also displays on page well there are two boxes or shuttle displayed one is for containing all values another for selected values but in my case bydefault all values ar

  • What is the use of change pointer technique in IDOC

    hi could anybody suggest me what is the use of change pointer technique and how to use it thank you kalyan.

  • How to hide fields in XD99 transaction

    Hi Experts , I got a requirement to hide some fields in XD99 transaction for specific user group, I tried creating transaction variant but it is not allowing me to create for XD99 and displaying error ''Variants are  possible  only for dialog  transa

  • Adapters

    If you have an SAP system WAS 7.0 and an XI/PI system 7.0 then what scenarios you can you practise? With these systems is it possible to practise: File, XI, RFC and IDOC obviously yes But what about: JMS JDBC SOAP HTTP MAIL Is it possible to practise