Installing a DOM XML Parser

Hey, I apologize for the newbie question but I suppose this is as good a place as any for it. I'm in desperate need of a DOM XML parser and have decided upon the Apache parser, "Xerces," featured here. My problem is this, every time I make a move towards installing it, I get all mixed up at the mention of my "Apache, ant and forrest" installations that I am apparently supposed to have in order for this library to work. My question is, is this library only for use in web-based applications and thus requires Apache in order to run? I ask because the application I'm working on is simply for desktop usage and the users it will be distributed to will not have Apache installations. If somebody could help me out with a quick little walk-through on the installation of this library it would be IMMENSELY appreciated.
Edited by: Tracekill on Sep 13, 2009 11:01 AM

Study up on the javax.xml.parsers API here at Sun. Next, download Xerces from Apache (xml.apache.org). Finally, take a tutorial.
- Saish

Similar Messages

  • DOM XML parser program

    Hi,
    I am trying to write a sample program using DOM xml parser in java to read the values in a XML file.
    please suggest me what are all the things I have to do for that.
    I know Java and XML. I want to know how to access values from XML file in java.
    Thanks
    Selvakumar

    Study up on the javax.xml.parsers API here at Sun. Next, download Xerces from Apache (xml.apache.org). Finally, take a tutorial.
    - Saish

  • DOM XML Parser in Stateless Session Bean- Not able to generate Container

    I am trying to do some XML Parsing using a DOM Parser in a Stateless Session Bean. I am importing org.apache.xerces.parsers.DOMParser and trying the following statement DOMParser parser = new DOMParser();
    Even though I am able to compile and generate the initial jar file. When I try to generate the container using the Weblogic Deployer GUI tool, the process keeps on going(I mean that I see the small window saying Container Generating working) and it never stops.
    Any suggestions are welcome.

    Many thanks ksaks for replying.
    Actually day before yesterday we were able to do something like this. But then I kept this thread open only to see if experts have some good way of doing this.
    What I mean is if this way is industry standards in terms of design and does it follow the most popular way how experts do it?
    I am asking this as WebProjects have webcontent/web-inf directory wherein we put those xsds and property files, but we do not have anything like this in an EJB project. so was just wondering if this is the correct way of doing it or not.
    I am still following this approach because I had to proceed further in my development. Confirmation would erase any other doubts on this.
    Hope you find time to reply.
    Kind Regards,
    user2205
    Edited by: user2205 on Nov 10, 2008 11:43 PM

  • DOM XML Parsing...

    Hi All,
    I need a sample code to parse the following xml...
    <EMPLOYEE>
    <RECORD>
    <EMPID>12</EMPID>
    <EMPNAME>ROCK</EMPNAME>
    </RECORD>
    <RECORD>
    <EMPID>13</EMPID>
    <EMPNAME>PETER</EMPNAME>
    </RECORD>
    <RECORD>
    <EMPID>14</EMPID>
    <EMPNAME>JOHN</EMPNAME>
    </RECORD>
    </EMPLOYEE>
    I need a generic parser code, to parse the records and populate into employee table.
    Thanks in Advance....
    Regards,
    Simbhu

    One way is using supplied XML function
    SQL> create table my_employee ( empid number primary key, empname varchar2(50));
    Table created.
    SQL> insert into my_employee
    2 select extractValue(column_value, '/RECORD/EMPID') EMPID, extractValue(col
    umn_value, '/RECORD/EMPNAME') EMPNAME from TABLE(
    3 XMLSEQUENCE(
    4 EXTRACT(
    5 XMLTYPE(
    6 '<EMPLOYEE> <RECORD> <EMPID>12</EMPID> <EMPNAME>
    ROCK</EMPNAME></RECORD><RECORD><EMPID>13</EMPID><EMPNAME>PETER</EMPNAME></RECORD
    <RECORD><EMPID>14</EMPID><EMPNAME>JOHN</EMPNAME></RECORD></EMPLOYEE>'7 ),
    8 '/EMPLOYEE/RECORD'
    9 )
    10 )
    11 ) tb;
    3 rows created.
    SQL> select * from my_employee;
    EMPID EMPNAME
    12 ROCK
    13 PETER
    14 JOHN
    Better way is if you have XSD, register it into Oracle. Oracle will create underlying tables.
    Best Regards
    Erturk

  • HELP ::: DOM XML Parser

    Hi,
    I am trying to parse this xml.
    <Node>MS
    <Condition>BooleaaaaanOperator
    <Operation>AND</Operation>
    <Condition>NumberList
    <Comment>Only destinations are allowed to be sent.</Comment>
    <Type>0</Type>
    <Number>083538</Number>
    </Condition>
    <Condition22>BooooooooooooleanOperator
    <Operation1>NOT</Operation1>
    <Condition55>BooleeeeeeeeeeanOperator
    <Operation2>AND</Operation2>
    <Condition33>ExtensionNr
    <Comment>When Extension Number 2 is not set to 1 it indicates the content type of the message.</Comment>
    <Number>2</Number>
    <Value>1</Value>
    </Condition33>
    <Condition44>ExtensionNr
    <Numm>101010101010101</Numm>
    <Value>0-1002</Value>
    </Condition44>
    </Condition55>
    </Condition22>
    </Condition>
    <Node>Fee
    I can get the Numm string using the parser by this line
    elementSub5.getFirstChild().getNextSibling().getNodeName())
    BUT:: I cannot get the value of that node to print out, or set it to a variable.
    I really need the 101010101010101 but cannot get them. I have tried everything.

    If you could post more code I could possibly help you out. Just post some code of where the problem is and I will look at it. I believe there is a getNodeValue() method and there may be a getTextContent() method or something... actually I think I ran into this problem before... you can pull the value out of the toString() method by using a substring.
    I used something like this and it worked fine...
    String data = node.toString();
    data = data.substring(data.indexOf(":")+1, data.length()-1);
    In your case perhaps you can try something like this...
    String elementData = elementSub5.getFirstChild().getNextSibling().toString();
    elementData = elementData.substring(elementData.indexOf(":")+1, elementData.length()-1);
    That substring method may not be 100% accurate... you best bet is to just put the node to a string and by debugging the program look at what the string value is. You can then adjust the substring to grab the correct data from the XML.
    You would think there is a better way to do this... but I could not find it and this way worked for me...

  • Errors installing XML Parser for PL/SQL

    I tried to install the parser and get the following errors :
    D:\xml\lib\java>loadjava -user user/pwd -r -v xmlparserv2.jar
    initialization complete
    loading : oracle/xml/parser/v2/XSLResultElement
    creating : oracle/xml/parser/v2/XSLResultElement
    Error while retrieving errors for oracle/xml/parser/v2/XSLResultElement
    ORA-00904: invalid column name
    loading : oracle/xml/parser/v2/XSLCopy
    creating : oracle/xml/parser/v2/XSLCopy
    Error while retrieving errors for oracle/xml/parser/v2/XSLCopy
    ORA-00904: invalid column name
    loading : oracle/xml/parser/v2/XMLByteReader
    creating : oracle/xml/parser/v2/XMLByteReader
    Error while retrieving errors for oracle/xml/parser/v2/XMLByteReader
    ORA-00904: invalid column name
    We have Oracle 8.1.5.0.0 running with JRE 1.1.8 installed.
    I updated loadjava.bat to call JRE 1.1.8 instead of JRE 1.1.7.
    Can't afford an upgrade to 8.1.6
    Any help appreciated

    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

  • 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

  • Installing XML Parser for PL/SQL

    Hi,
    I have downloaded the plxmlparser_V1_0_1.tar.gz and followed the instruction to install it. The README file said to use the loadjava to upload xmlparserv2.jar and plsql.jar in order.
    When I tried to load xmlparserv2.jar using the following command
    loadjava -user test/test -r -v xmlparserv2.jar
    to upload the jar file into an 8i database.
    After much of the uploading, I got the following error messages:
    identical: oracle/xml/parser/v2/XMLConstants is unchanged from previously loaded file
    identical: org/xml/sax/Locator is unchanged from previously loaded file
    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 : oracle/xml/parser/v2/mesg/XMLErrorMesg_en_US.properties
    creating : oracle/xml/parser/v2/mesg/XMLErrorMesg_en_US.properties
    Error while creating resource oracle/xml/parser/v2/mesg/XMLErrorMesg_en_US.properties
    ORA-29547: Java system class not available: oracle/aurora/rdbms/Compiler
    loading : xmlparser_2.0.2.1_production
    creating : xmlparser_2.0.2.1_production
    Error while creating resource xmlparser_2.0.2.1_production
    ORA-29547: Java system class not available: oracle/aurora/rdbms/Compiler
    loading : oracle/xml/parser/v2/mesg/XMLErrorMesg.properties
    creating : oracle/xml/parser/v2/mesg/XMLErrorMesg.properties
    Error while creating resource oracle/xml/parser/v2/mesg/XMLErrorMesg.properties
    ORA-29547: Java system class not available: oracle/aurora/rdbms/Compiler
    resolver :
    Error while resolving class org/w3c/dom/DOMImplementation
    ORA-00904: invalid column name
    Error while resolving class org/w3c/dom/html/HTMLDivElement
    ORA-00904: invalid column name
    Error while resolving class org/w3c/dom/html/HTMLMapElement
    ORA-00904: invalid column name
    Error while resolving class org/xml/sax/Locator
    ORA-00904: invalid column name
    loadjava: 229 errors
    Then I removed -r from the previous command:
    loadjava -user test/test -v xmlparserv2.jar
    I still got errors but it's down to four.
    identical: org/xml/sax/Locator is unchanged from previously loaded file
    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 : oracle/xml/parser/v2/mesg/XMLErrorMesg_en_US.properties
    creating : oracle/xml/parser/v2/mesg/XMLErrorMesg_en_US.properties
    Error while creating resource oracle/xml/parser/v2/mesg/XMLErrorMesg_en_US.properties
    ORA-29547: Java system class not available: oracle/aurora/rdbms/Compiler
    loading : xmlparser_2.0.2.1_production
    creating : xmlparser_2.0.2.1_production
    Error while creating resource xmlparser_2.0.2.1_production
    ORA-29547: Java system class not available: oracle/aurora/rdbms/Compiler
    loading : oracle/xml/parser/v2/mesg/XMLErrorMesg.properties
    creating : oracle/xml/parser/v2/mesg/XMLErrorMesg.properties
    Error while creating resource oracle/xml/parser/v2/mesg/XMLErrorMesg.properties
    ORA-29547: Java system class not available: oracle/aurora/rdbms/Compiler
    loadjava: 4 errors
    Then I tried to load the plsql.jar but I got the following errors:
    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
    resolver :
    Error while resolving class oracle/xml/parser/plsql/XMLDOMImplCover
    ORA-00904: invalid column name
    Error while resolving class oracle/xml/parser/plsql/XMLDocumentCover
    ORA-00904: invalid column name
    Error while resolving class oracle/xml/parser/plsql/XSLStylesheetCover
    ORA-00904: invalid column name
    Error while resolving class oracle/xml/parser/plsql/XMLNodeListCover
    ORA-00904: invalid column name
    Error while resolving class oracle/xml/parser/plsql/XMLEntityCover
    ORA-00904: invalid column name
    Error while resolving class oracle/xml/parser/plsql/XMLNodeCover
    ORA-00904: invalid column name
    Error while resolving class oracle/xml/parser/plsql/XMLPICover
    ORA-00904: invalid column name
    Error while resolving class oracle/xml/parser/plsql/XMLAttrCover
    ORA-00904: invalid column name
    Error while resolving class oracle/xml/parser/plsql/XMLCharDataCover
    ORA-00904: invalid column name
    Error while resolving class oracle/xml/parser/plsql/XMLTextCover
    ORA-00904: invalid column name
    Error while resolving class oracle/xml/parser/plsql/XMLElementCover
    ORA-00904: invalid column name
    Error while resolving class oracle/xml/parser/plsql/XMLNotationCover
    ORA-00904: invalid column name
    Error while resolving class oracle/xml/parser/plsql/XMLDTDCover
    ORA-00904: invalid column name
    Error while resolving class oracle/xml/parser/plsql/XMLNNMCover
    ORA-00904: invalid column name
    Error while resolving class oracle/xml/parser/plsql/XMLParserCover
    ORA-00904: invalid column name
    Error while resolving class oracle/xml/parser/plsql/XSLProcessorCover
    ORA-00904: invalid column name
    loadjava: 17 errors
    Could someone tell me how to resolve the problems? I think I have install the JServer on the database, correctly.
    null

    The JServer option is not properly installed if you're getting errors like this during loadjava.
    You need to run INITJVM.SQL and INITDBJ.SQL to get the JavaVM properly installed.
    Usually these are in the ./javavm subdirectory of your Oracle Home.

  • Since installing the latest update, Firefox will not load; it gives me the following error -- XML Parsing Error: not well formed.

    since installing the latest update, Firefox first operated with some errors but now will not load at all; it gives me the following error --
    XML Parsing Error: not well formed
    locations chrome://browser/content/browser.xml
    Line Number 1191, column 20:
    utton id="back-forward-dropmarker" type="menu" chromedir="&locale.dir;"-------------------
    please note that the words "utton ID" are exactly as the error message gives it; and at the end of the message there are exactly 19 hyphens.
    I don't know why this faulty code is referencing things to do with "chrome"... the Chrome browser is not installed on this PC or anywhere on our network.
    Also, this is not the first problem I had after clicking Firefox's prompt for the latest update. Before Firefox retreated into this error message, it was loading but running with some faults...
    1. the bookmark symbol was not appearing on the right hand side of the URL line, so I had always to click on "bookmark this page", after which the bookmark symbol did appear; however I don't know if the bookmarking function worked properly.
    2. the back and forward buttons were not highlighted, as if I had not come from a previous page; so once I clicked on a link to a new page I could not go back to where I came from because Fiefox thought I hadn't come from anywhere.
    3. there may have been other errors, but I did not find them.
    How do I reinstate my Firefox program to work properly please? do I have to download the latest version and reinstal? if so, do I have to remove the old version first? or is there a fix?
    Even to write this message I have been forced to use (yuk -- I don't like to say this!!!) Internet Explorer. So please -- I need help urgently.
    Thanks,
    NOEL

    Some how I solved my problem by opening a user account and downloading Firefox 4.0 beta and installing it, I did try it, worked fine, so I did close the user account and did go back to my own account(switched user), the main page that I had problem with Firefox which would not open, I dabble click on Firefox it start working again!! I hope that solves your problem too.
    firefox will not open, it gives me this cod and would not turn off, Error on switching in renew: NS_ERROR_UNEXPECTED, Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.getCharPref] id: none

  • XML Parser Exception in Install of AIA 11.1.1.5 on SOA 11.1.1.5

    I am attempting to install AIA Foundation Pack on a SOA domain and continually encounter an XML parsing exception error as the installer is attempting to install WSM security policies. Here are the key details:
    AIA version = 11.1.1.5
    SOA Suite = 11.1.1.5
    WebLogic = 10.3.5
    Operating System = Fedora14 (a home lab machine but I don't think this is an OS issue)
    The error is encountered about 17 minutes into the lengthy process. Just before the error appears in the installation log, the following message appears indicating roughly what step is being performed:
    [zip] Building zip: /opt/oraclemw/aia11115/aia_instances/dev1/tmp/aia_security_policies.zip
    The core error messages are:
    [exec] SEVERE: WSM-01605 XML parser exception
    [exec] oracle.xml.parser.v2.XMLParseException: Expected 'EOF'.
    [exec] at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:323)
    The python modules being executed by the WLST scripting tool at the time of the failure are:
    [exec] Problem invoking WLST - Traceback (innermost last):
    [exec] File "/opt/oraclemw/aia11115/Infrastructure/Install/AID/lib/py/importpolicy.py", line 29, in ?
    [exec] File "/opt/oraclemw/oracle_common/common/wlst/wsmManage.py", line 719, in importRepository
    [exec] File "/opt/oraclemw/oracle_common/common/wlst/lib/ora_util.py", line 51, in raiseScriptingException
    [exec] OracleScriptingException: None
    Finally, the outer XML files being used as input for the deployer that seems to be running at the time are:
    /opt/oraclemw/aia11115/Infrastructure/Install/AID/AIAExecuteDriver.xml
    with references to lines 221 and 64.
    The problem occurs whether I try to use Java JDK 16.0.20 or JRockit R28.2.0 as the JRE when running the AIA installer. (The WebLogic domain is configured to use JRockit).
    Any suggestions? Is there a library conflict being picked up between different releases of XercesImpl? I would hope there isn't actually a bad XML file in the AIA artifacts or WSM (Web Service Management) policies being deployed.

    HI
    How this issue was resolved? Please explain in detail. I am facing the same issue.
    Regards
    Arun

  • Java.lang.ClassCastException: oracle.xml.parser.v2.XMLText cannot be cast to org.w3c.dom.Element

    Hello
    I am getting java.lang.ClassCastException: oracle.xml.parser.v2.XMLText cannot be cast to org.w3c.dom.Element error. This code is in java which is present in java embedding.
    The SOA is parsing the xml in java code using oracle.xml.parser.v2 . This wont be a problem if the SOA uses default w3c DOM parser. How do i force SOA to use w3c DOM parser.
    Is there any thing i can do with class loading?
    Kindly help.
    Regards
    Sharat

    Can you paste your java code here ? I assume, you must have tried type-casting.

  • Installing XML Parser for Java v2

    I downloaded Oracle XML Parser for Java v2 and looked in the doc directory of the unzipped files but couldn't find any doc about installation. Can anyone point me in the right the direction or tell me how to install and use it to convert XML files stored in the files system to HTML output using XSL stylesheet. Thanks

    There is no installation involved beyond including the xmlparserv2.jar in your CLASSPATH. Take a look in the sample directory where we have included sample code and instructions on their use.
    Addiaitonal HTML conversion samples are included with the XSQL Servlet download.
    Oracle XML Team
    null

  • XML Parser for Java v2. Applying XSLT to DOM tree

    I encountered pretty weird behavior of XML Parser for Java v2.
    While applying XSLT to XML document created in memory using DOM
    interface I couldn't access element attributes. For example,
    given the XML document:
    <root>
    <Item ID="00001">Value of Item 00001</Item>
    <Item ID="00002">Value of Item 00002</Item>
    </root>
    and XSLT:
    <xsl:template match="/">
    <HTML>
    <HEAD>
    <TITLE>XSLT Test</TITLE>
    </HEAD>
    <BODY>
    <xsl:for-each select="/Error">
    <H1>Error</H1><xsl:value-of select="."/>
    </xsl:for-each>
    <TABLE border="0" cellspacing="0" cellpadding="2">
    <TBODY>
    <xsl:for-each select="/root">
    <TR>
    <TH style="background-color:khaki">
    <xsl:text>Attribute</xsl:text>
    </TH>
    <TH style="background-color:khaki">
    <xsl:text>Value</xsl:text>
    </TH>
    </TR>
    <xsl:for-each select="Item">
    <TR>
    <TD><xsl:value-of select="@ID"/></TD>
    <TD><xsl:value-of select="."/></TD>
    </TR>
    </xsl:for-each>
    </xsl:for-each>
    </TBODY>
    </TABLE>
    </BODY>
    </HTML>
    </xsl:template>
    If I build DOM tree by parsing XML file the resulting HTML
    document after applying XSLT will display
    Attribute Value
    00001 Value of Item 00001
    00002 Value of Item 00002
    But if I build DOM tree using following code:
    XMLDocument xDoc = new XMLDocument();
    Element root = xDoc.createElement( "root" );
    xDoc.appendChild( root );
    Element elem = xDoc.createElement( "Item" );
    elem.setAttribute( "ID", "00001" );
    root.appendChild( elem ).
    appendChild( xDoc.createTextNode( "Value of Item 00001" ) );
    elem = xDoc.createElement( "Item" );
    elem.setAttribute( "ID", "00002" );
    root.appendChild( elem )
    .appendChild( xDoc.createTextNode( "Value of Item 00002" ) );
    the same XSLT will produce the following HTML output:
    Attribute Value
    Value of Item 00001
    Value of Item 00002
    So the value for the ID attribute is not displayed. At the same
    time I can access this attribute using DOM interface. For
    example, following code
    NodeList nList = xDoc.getElementsByTagName( "Item" );
    Element e;
    for( int i = 0; i < nList.getLength(); i++ )
    e = (Element)nList.item( i );
    System.out.println( "ID: " + e.getAttribute( "ID" ) );
    produces an output
    ID: 00001
    ID: 00002
    Here is the code for applying XSLT to DOM tree:
    DOMParser parser = new DOMParser();
    parser.parse( new FileInputStream( "test.xsl" ) );
    XMLDocument xsldoc = parser.getDocument();
    XSLStylesheet xsl = new XSLStylesheet( xsldoc, createURL( "" ) );
    XMLDocument out = new XMLDocument();
    out.appendChild( new XSLProcessor().processXSL(xsl, xDoc) );
    out.print( new FileOutputStream( "test.html" ) );
    Andrei Filimonov
    null

    We are not getting what you're getting on Solaris. See the
    following:
    Script started on Tue Jun 22 18:53:56 1999
    Processing /view/test/vobs/oracore3/.ndeprodrc.csh
    Processing /private/.nderc.csh
    [test] > cat bruno.xml
    <my_grandpa age="88">
    <my_dad age="66">
    <me age="44">
    <my_son age="22">
    </my_son>
    </me>
    </my_dad>
    </my_grandpa>
    [test] > cat bruno.xsl
    <?xml version="1.0"?>
    <!-- Identity transformation -->
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
    <xsl:template match="me">
    <xsl:value-of select="my_son/@age"/>
    <xsl:value-of select="@age"/>
    <xsl:value-of select="../@age"/>
    <xsl:value-of select="../../@age"/>
    </xsl:template>
    </xsl:stylesheet>
    [test] > java XSLSample bruno.xsl bruno.xml
    <root>
    22446688
    </root>
    [test] > exit
    script done on Tue Jun 22 18:54:22 1999
    What platform are you on and does your stylesheet and xml doc
    match ours?
    Oracle XML Team
    http://technet.oracle.com
    Oracle Technology Network
    Bruno Bontempi (guest) wrote:
    : I had a similar problem in accessing element attributes from
    an
    : XSLT sheet.
    : It seems like the processor correctly accesses element
    attributes
    : in the context node, but does not retrieve values of
    attributes
    : outside the context node.
    : For example, for an XML document like:
    : <my_grandpa age="88">
    : <my_dad age="66">
    : <me age="44">
    : <my_son age="22">
    : </my_son>
    : </me>
    : </my_dad>
    : </my_grandpa>
    : and an XSL stylesheet like:
    : <xsl:template match="me">
    : <xsl:value-of select="my_son/@age"/>
    : <xsl:value-of select="@age"/>
    : <xsl:value-of select="../@age"/>
    : <xsl:value-of select="../../@age"/>
    : </xsl:template>
    : I expect an output like:
    : 22446688
    : but all I get is
    : 44
    : I am also using Jim Clark's XT, which is returning the
    expected
    : result.
    : Thanks in advance for your help,
    : Bruno.
    : Andrei Filimonov (guest) wrote:
    : : I encountered pretty weird behavior of XML Parser for Java
    v2.
    : : While applying XSLT to XML document created in memory using
    DOM
    : : interface I couldn't access element attributes. For example,
    : : given the XML document:
    : : <root>
    : : <Item ID="00001">Value of Item 00001</Item>
    : : <Item ID="00002">Value of Item 00002</Item>
    : : </root>
    : : and XSLT:
    : : <xsl:template match="/">
    : : <HTML>
    : : <HEAD>
    : : <TITLE>XSLT Test</TITLE>
    : : </HEAD>
    : : <BODY>
    : : <xsl:for-each select="/Error">
    : : <H1>Error</H1><xsl:value-of select="."/>
    : : </xsl:for-each>
    : : <TABLE border="0" cellspacing="0" cellpadding="2">
    : : <TBODY>
    : : <xsl:for-each select="/root">
    : : <TR>
    : : <TH style="background-color:khaki">
    : : <xsl:text>Attribute</xsl:text>
    : : </TH>
    : : <TH style="background-color:khaki">
    : : <xsl:text>Value</xsl:text>
    : : </TH>
    : : </TR>
    : : <xsl:for-each select="Item">
    : : <TR>
    : : <TD><xsl:value-of select="@ID"/></TD>
    : : <TD><xsl:value-of select="."/></TD>
    : : </TR>
    : : </xsl:for-each>
    : : </xsl:for-each>
    : : </TBODY>
    : : </TABLE>
    : : </BODY>
    : : </HTML>
    : : </xsl:template>
    : : If I build DOM tree by parsing XML file the resulting HTML
    : : document after applying XSLT will display
    : : Attribute Value
    : : 00001 Value of Item 00001
    : : 00002 Value of Item 00002
    : : But if I build DOM tree using following code:
    : : XMLDocument xDoc = new XMLDocument();
    : : Element root = xDoc.createElement( "root" );
    : : xDoc.appendChild( root );
    : : Element elem = xDoc.createElement( "Item" );
    : : elem.setAttribute( "ID", "00001" );
    : : root.appendChild( elem ).
    : : appendChild( xDoc.createTextNode( "Value of Item
    00001" )
    : : elem = xDoc.createElement( "Item" );
    : : elem.setAttribute( "ID", "00002" );
    : : root.appendChild( elem )
    : : .appendChild( xDoc.createTextNode( "Value of Item
    00002" )
    : : the same XSLT will produce the following HTML output:
    : : Attribute Value
    : : Value of Item 00001
    : : Value of Item 00002
    : : So the value for the ID attribute is not displayed. At the
    same
    : : time I can access this attribute using DOM interface. For
    : : example, following code
    : : NodeList nList = xDoc.getElementsByTagName( "Item" );
    : : Element e;
    : : for( int i = 0; i < nList.getLength(); i++ )
    : : e = (Element)nList.item( i );
    : : System.out.println( "ID: " + e.getAttribute( "ID" ) );
    : : produces an output
    : : ID: 00001
    : : ID: 00002
    : : Here is the code for applying XSLT to DOM tree:
    : : DOMParser parser = new DOMParser();
    : : parser.parse( new FileInputStream( "test.xsl" ) );
    : : XMLDocument xsldoc = parser.getDocument();
    : : XSLStylesheet xsl = new XSLStylesheet( xsldoc, createURL
    : : XMLDocument out = new XMLDocument();
    : : out.appendChild( new XSLProcessor().processXSL(xsl, xDoc) );
    : : out.print( new FileOutputStream( "test.html" ) );
    : : Andrei Filimonov
    null

  • XML validation using XDK DOM/SAX Parser

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

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

  • Problem casting org.w3c.dom.Document to oracle.xml.parser.v2.XMLDocument

    I have the following problem:
    I get my xml-documents as an XMLType from the database and want to compare these using the supplied Oracle class oracle.xml.differ.XMLDiff (i use the java version supplied with Oracle 9i r2).
    XMLType.getDOM() returns the xml-document as a org.w3c.dom.Document,
    what i need for oracle.xml.differ.XMLDiff is a oracle.xml.parser.v2.XMLDocument.
    How can i cast/convert between these two formats?
    thanks!
    p.s. cross-posting with Re: Casting/Converting XMLType to XMLDocument? (but i think this forum is more relevant).

    Hi,
    thanks for the suggestion: i have written the code shown below. It results in a casting error.
    As far as i know, i don't use a oracle.xdb.dom.XDBDocument, i only use a oracle.xdb.XMLType as the input parameter for my conversion-method:
    any new suggestions ???
    p.s. the second method which is commented does work, but is a bit verbose.
       private static oracle.xml.parser.v2.XMLDocument convert2XMLDocument(XMLType xml) {
         // simple version (should work according to tech. doc. 9i r2/ 10g r1 database)
         oracle.xml.parser.v2.XMLDocument doc = null;
         try {
            // n.b. probleem is dat XMLType.getDOM() een w3c.Document object teruggeeft ipv een oracle.XMLDocument.
            System.out.println("convert2XMLDocument(): casting w3c.Document naar oracle.XMLDocument.");
            doc = (oracle.xml.parser.v2.XMLDocument) xml.getDOM(); // public org.w3c.dom.Document getDOM()
            System.out.println("convert2XMLDocument(): done casting w3c.Document naar oracle.XMLDocument.");
         catch (Exception e) {
            e.printStackTrace(System.out);
        return doc;
       private static XMLDocument convert2XMLDocument(XMLType xml) {
         // complex version: works ok !!!
         XMLDocument doc = null;
         try{
            DOMParser parser  = new DOMParser();
            parser.setValidationMode(oracle.xml.parser.v2.XMLParser.NONVALIDATING);
            parser.setPreserveWhitespace (true);   
            parser.parse(new StringReader(xml.getStringVal()));
            doc = parser.getDocument();
        catch ( XMLParseException e ) {
          e.printStackTrace(System.out);
        catch ( SQLException e ) {
          e.printStackTrace(System.out);
        catch ( Exception e ) {
          e.printStackTrace(System.out);
        return doc;
    convert2XMLDocument(): casting w3c.Document naar oracle.XMLDocument.
        java.lang.ClassCastException: oracle.xdb.dom.XDBDocument
         at pnb.bdb.xml.testJDBC.convert2XMLDocument(testJDBC.java:305)
         at pnb.bdb.xml.testJDBC.main(testJDBC.java:187)

Maybe you are looking for

  • Windows Home Server vs. Windows Server 2012

    I have used Windows Home Server 2011 but I have problems with connections and backups. Is Windows Server 2012 more reliable to use with computer backups? Nikorios

  • Left side shift/command/option keys not working

    I have a 2010 11" macbook air and out of nowhere my left side Shift Command Option keys are not working at all. Anyone had this issue? or know what I can do to solve it? I have tried connecting my keyboard to it and doing the reset PRAM, SMC, PMU wit

  • Iphone 3gs updated and now won't activate

    Recently got iphone 3gs second hand and when I updated it on itunes via computer, it says it can't be activated because the 'server is temporarily unavailable' and on itunes on the computer it says the sim cant be recognised.. What do I do? Tried upd

  • Return Delivery Quantity Changing

    Hi, I have created a GR for a 100 nos and i want to process a return delivery wrt to the mateial document. But the actual quantity to be returned is only 20. But when i am giving the material documetn as reference with the return delivery option, the

  • Video Scaler clocking problem

    Hi all, I have a problem with making work such configuration: TPG->Scaler->VidOut->HDMI                                 |                              VTC TPG is configured to output 336x256 image yuv422. Scaler input is configured to take 336x256 in