Oracle XML Parsers DOM vs SAX
I have many huge XML formated data files I'm trying to importing into Oracle tables. The DOM model with XSL stylesheets will work great because many of the files XML element tags do not match the Oracle table column names. The problem is that the XML files are too large and memory is used up. Is there a compatible SAX solution to use a XSL stylesheet to map different columns to an Oracle table?
Thanks in advance
Chuck Salerno
[email protected]
XSLT Transformation is based on the DOM representation of XML documents. However, you can divide the XML Document into small fragments before loading.
If you problem is just that the elements tags doesn't match the database columns, you can just using SAX to do the modification.
Thanks.
Similar Messages
-
XML parser used in Oracle...DOM or SAX?
Hi,
My db version:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
Question:
I get an XML feed and load it into a temporary table T1.
My requirement is to load it in the exact sequence as I get the rows in xml and also populate a column in the temporary table as a sequence like 1 2 3 corresponding to the rows in the xml
When I do load the xml, it gets loaded in same order the xml feed is sent. So no worries.
But while I was researching I came to know that Oracle could use either DOM or SAX parser. If it uses SAX, then the order is maintained as in XML. But if DOM is used, the order wont be maintained.
Please let me know, how I can ensure that the xml order is maintained as it is while loading into temp table.I apologize, here is more details
{code}
CREATE TABLE XMLTEMPTBL
PARAM NVARCHAR2(30 BYTE),
PARAMORDERSEQ NUMBER(3)
XML format:
<?xml version="1.0"?>
<ROWSET>
<ROW>
<PARAM1>abc</PARAM1>
</ROW>
<ROW>
<PARAM2>def</PARAM2>
</ROW>
<ROW>
<PARAM3>ghi</PARAM3>
</ROW>
<ROW>
<PARAM4>jkl</PARAM4>
</ROW>
</ROWSET>
PROCEDURE insertparams (p_xmldoc IN CLOB)
IS
insctx DBMS_XMLSTORE.ctxtype;
ROWS NUMBER;
BEGIN
/*inserting insdoc into a temp table*/
insctx := DBMS_XMLSTORE.newcontext ('xmlTempTbl');
ROWS := DBMS_XMLSTORE.insertxml (insctx, p_xmldoc);
DBMS_XMLSTORE.closecontext (insctx);
END;
I want to insert into table this way:
select * from xmltemptb;
PARAM PARAMORDERSEQ
abc 1
def 2
ghi 3
jkl 4
{code}
My procedure is not 100% correct (but it gives an idea what code I am using to load into table), but I want to ensure the xml rows are loaded into the table in the same sequence. -
Over the past couple of weeks we have been working on a solution which uses the newly available adobe XPAAJ api's (XML/PDF Access API for Java) for Java.
The client has a legacy requirement to where users are issued with a pdf form which they complete, save and upload to the server via a JSP. A neat bit of Java code utilizing the XPAAJ API's then strips out the form entered data and spits out XML. This is then parsed and inserted into relational tables within the schema.
Our solution needs to be deployed to an Oracle stack. However we ran into a number of problems when deploying the solution to AS 10.1.2. The adobe API's are not compatible with the Oracle XML Parsers. When extracting the form data, no error is reported and the code which performs the xml parsing just fails. Very nasty.
The main problem has been that Oracle XDK libraries have been hard-coded into the classpath of the container using the referential JAR file Class-Path mechanism. Altering this has required the use of the JRE extension library mechanism, or altering the boot classpath of the JVM when it is launched to load the alternative XML parser implementation instead. While this works, it has been an unsupported operation since the effect of this change is not limited to a specific application – it’s effect are felt across the entire container and this may lead to unpredictable results at runtime.
~http://www.oracle.com/technology/tech/java/oc4j/10131/how_to/how-to-swapxmlparser/doc/readme.html
We did look at a number of other solutions including embedding the java classes I'd written into the database. After loading the apache Xerces api's into our schema we hit upon the same problem. It seems that the same thing happens in the database and the Oracle XML parser is used by default.. Please see SR Number : 6153038.994 on Metalink.
If you can upgrade to AS 10.1.3 then you can follow the excellent how to at:http://www.oracle.com/technology/tech/java/oc4j/10131/how_to/how-to-swapxmlparser/doc/readme.html . Demo code can be found at: http://www.oracle.com/technology/tech/java/oc4j/10131/how_to/how-to-swapxmlparser/how-to-swapxmlparser.zip
The how-to details how to swap xml parsers within the application server.
Other possible solutions that are also available include:
- Shelling out to the OS from the DB or Apps Server, You can then execute the app as a command line app with a custom classpath. Very bad architecture design.
- Setting up an RMI client / server application where client is the db or apps server. You can find examples of this on the web. google 'Simple RMI example'.
- Bootstrapping the XML parser in AS 10.1.2 (unsupported).
I hope people have found this informative. It might save someone a lot of time.
Message was edited by:
Kris Jones"When I was installing SOA 10.1.3.1.0 on oracle 10.2.0.1 and it was giving error that it needs minimum 10.2.0.3, just wondering 10.1.2.0.2 + SOA =will this work?"
so you talk about the db version. SOA 10.1.3.x runs on 10.2.0.1 and above (I ran for the longest time on XE) and if I remember correctly that's a warning, and not a hard prereq.
Regarding Appserver versions - soa 10.1.3 runs on AS 10.1.3 only -
Does anyone know which XML parser is used by default in the XPAAJ API's.
We are trying to compile an application into the Oracle Database. The solution then uses the internal Oracle JVM which strips out form data. However there appears to be a problem extracting xml data and we think its down to the Oracle XML parsers. Running the solution from the command line works as expected.
Anyone have any ideas?
Regards
KrisIn addition to what lk555 says, you have to specify the position of the node with reference to its other siblings to specifically point to the node you are referring to.
if you have the following structure:
<root>
<child/>
<child/>
<child/>
</root>
The third child is obtained by /child[3], instead of just /child. The value 3 specifies its position.
Hope this helps -
XML Validation using XDK SAX/DOM 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.Got the answer !!!
NetBeans it self support generation of dtd file based on XML file.
Open XML file and right click on the code block. Select option to generate dtd file.
This is the drtd file it has generated..
<?xml version='1.0' encoding='UTF-8'?>
<!--- Put your DTDDoc comment here. -->
<!ELEMENT book (person)*>
<!--- Put your DTDDoc comment here. -->
<!ELEMENT person (age|last|first)*>
<!--- Put your DTDDoc comment here. -->
<!ELEMENT first (#PCDATA)>
<!--- Put your DTDDoc comment here. -->
<!ELEMENT last (#PCDATA)>
<!--- Put your DTDDoc comment here. -->
<!ELEMENT age (#PCDATA)> -
Oracle XML DOM parser - attribute values are not printing on the screen ??
Hi Everyone,
I am just trying to use oracle DOM parser to paerse one of my xml file, java file can be compiled and run agianst a xml file, But I cannot see any attribute values printing on the screen..
Appreciate if anyone can help, where I have gone wrong please?
Below is the java file:
// menna puthe DOMSample eka - duwanawa 19/12/2005
import java.io.*;
import java.net.*;
import org.w3c.dom.*;
import org.w3c.dom.Node;
import oracle.xml.parser.v2.*;
public class DOMSample { //public class eka ***
static public void main(String[] argv){ // main method eka ###
try {
if (argv.length != 1){
// Must pass in the name of the XML file...
System.err.println("Usage: java DOMSample filename");
System.exit(1);
// Get an instance of the parser
DOMParser parser = new DOMParser();
// Generate a URL from the filename.
URL url = createURL(argv[0]);
// Set various parser options: validation on,
// warnings shown, error stream set to stderr.
parser.setErrorStream(System.err);
parser.showWarnings(true);
// Parse the document.
parser.parse(url);
// Obtain the document.
Document doc = parser.getDocument();
// Print document elements
System.out.print("The elements are: ");
printElements(doc);
// Print document element attributes
System.out.println("The attributes of each element are: ");
printElementAttributes(doc);
catch (Exception e){
System.out.println(e.toString());
} // main method eka ###
static void printElements(Document doc) {
NodeList nl = doc.getElementsByTagName("*");
Node n;
for (int i=0; i<nl.getLength(); i++){
n = nl.item(i);
System.out.print(n.getNodeName() + " ");
System.out.println();
static void printElementAttributes(Document doc){
NodeList nl = doc.getElementsByTagName("*");
Element e;
Node n;
NamedNodeMap nnm;
String attrname;
String attrval;
int i, len;
len = nl.getLength();
for (int j=0; j < len; j++){
e = (Element)nl.item(j);
System.out.println(e.getTagName() + ":");
nnm = e.getAttributes();
if (nnm != null){
for (i=0; i<nnm.getLength(); i++){
n = nnm.item(i);
attrname = n.getNodeName();
attrval = n.getNodeValue();
System.out.print(" " + attrname + " = " + attrval);
System.out.println();
static URL createURL(String filename) { // podi 3 Start
URL url = null;
try {
url = new URL(filename);
} catch (MalformedURLException ex) { /// BBBBBB
try {
File f = new File(filename);
url = f.toURL();
} catch (MalformedURLException e) {
System.out.println("Cannot create URL for: " + filename);
System.exit(0);
} // BBBBBB
return url;
} // podi 3 End
} //public class eka ***
// End of program
output comes as below:
Isbn:
Title:
Price:
Author:
Message was edited by:
chandanalHi Chandanal,
I edited your code slightly and I was able to get the correct output.
I changed the following line:
for (int j=0; j >< len; j++)to:
for (int j=0; j < len; j++)I have included the complete source below:
// menna puthe DOMSample eka - duwanawa 19/12/2005
import java.io.*;
import java.net.*;
import org.w3c.dom.*;
import org.w3c.dom.Node;
import oracle.xml.parser.v2.*;
public class DOMSample {
//public class eka ***
public static void main(String[] argv) {
// main method eka ###
try {
if (argv.length != 1) {
// Must pass in the name of the XML file...
System.err.println("Usage: java DOMSample filename");
System.exit(1);
// Get an instance of the parser
DOMParser parser = new DOMParser();
// Generate a URL from the filename.
URL url = createURL(argv[0]);
// Set various parser options: validation on,
// warnings shown, error stream set to stderr.
parser.setErrorStream(System.err);
parser.showWarnings(true);
// Parse the document.
parser.parse(url);
// Obtain the document.
Document doc = parser.getDocument();
// Print document elements
System.out.print("The elements are: ");
printElements(doc);
// Print document element attributes
System.out.println("The attributes of each element are: ");
printElementAttributes(doc);
} catch (Exception e) {
System.out.println(e.toString());
// main method eka ###
static void printElements(Document doc) {
NodeList nl = doc.getElementsByTagName("*");
Node n;
for (int i = 0; i < nl.getLength(); i++) {
n = nl.item(i);
System.out.print(n.getNodeName() + " ");
System.out.println();
static void printElementAttributes(Document doc) {
NodeList nl = doc.getElementsByTagName("*");
Element e;
Node n;
NamedNodeMap nnm;
String attrname;
String attrval;
int i, len;
len = nl.getLength();
for (int j = 0; j < len; j++) {
e = (Element)nl.item(j);
System.out.println(e.getTagName() + ":");
nnm = e.getAttributes();
if (nnm != null) {
for (i = 0; i < nnm.getLength(); i++) {
n = nnm.item(i);
attrname = n.getNodeName();
attrval = n.getNodeValue();
System.out.print(" " + attrname + " = " + attrval);
System.out.println();
static URL createURL(String filename) {
// podi 3 Start
URL url = null;
try {
url = new URL(filename);
} catch (MalformedURLException ex) {
/// BBBBBB
try {
File f = new File(filename);
url = f.toURL();
} catch (MalformedURLException e) {
System.out.println("Cannot create URL for: " + filename);
System.exit(0);
// BBBBBB
return url;
// podi 3 End
} //public class eka ***-Blaise -
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
SharatCan you paste your java code here ? I assume, you must have tried type-casting.
-
How to remove element namespaces in XML file using DOM or SAX?
Hi Guys,
I developed a JAVA mapping in XI to add name spaces for XML file, after mapping,name spaces xmlns="http://www.mro.com/mx/integration" and xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" were added correctly, but for some nodes, such as <Header> and <Content>, a name space xmlns="" was added automatically.Please check below files to compare.
It looks like be added automatically by XI. I didn't process anything for these nodes in JAVA program.
Now the issue is, how can I remove these redundant namespaces? Such as xmlns="".
Can I remove them using DOM or SAX in JAVA Mapping?
Thanks in advance.
====>Original XML file
<?xml version="1.0" encoding="UTF-8"?>
<LLYLPPInterface language="EN">
<Header>
<SenderID>GBIP</SenderID>
<CreationDateTime>2008-02-13T22:49:34-05:00</CreationDateTime>
<RecipientID/>
<MessageID/>
</Header>
<Content>
<LLY-LPP>
<INVOICE>
<INVOICELINE>
<PONUM>4780000008</PONUM>
<POLINENUM>1</POLINENUM>
<INVOICEQTY>1</INVOICEQTY>
<LOADEDCOST>68</LOADEDCOST>
</INVOICELINE>
</INVOICE>
</LLY-LPP>
</Content>
</LLYLPPInterface>
===>Target XML file after JAVA mapping
<?xml version="1.0" encoding="utf-8"?>
<LLYLPPInterface language="EN" xmlns="http://www.mro.com/mx/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Header xmlns="">
<SenderID>GBIP</SenderID>
<CreationDateTime>2008-02-13T23:11:55-05:00</CreationDateTime>
<RecipientID/>
<MessageID/>
</Header>
<Content xmlns="">
<LLY-LPP>
<INVOICE>
<INVOICELINE>
<PONUM>4780000008</PONUM>
<POLINENUM>0</POLINENUM>
<INVOICEQTY>1</INVOICEQTY>
<LOADEDCOST>68</LOADEDCOST>
</INVOICELINE>
</INVOICE>
</LLY-LPP>
</Content>
</LLYLPPInterface>
Edited by: Eddie Zhang on Feb 14, 2008 9:22 AM
Edited by: Eddie Zhang on Feb 14, 2008 9:24 AMHi Milan,
Thanks for your replay.
Actually when I used module XMLAnonymizerBean to convert namespaces, the header of XML, such as <?xml version="1.0" encoding="UTF-8"?> was converted to format <?xml version='1.0' encoding='UTF-8'?>, quote was converted to single quote. Although I set parameter anonymizer.quote = ", it still didn't work, single quote appeared instead of quote.
I'm not sure why this happened. Can anyone help to clarify this?
Thanks
Edited by: Eddie Zhang on Feb 15, 2008 2:11 AM -
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) -
XML Parsing in Java Stored Proc--Oracle XML Support Installation?
I am working with a third party product that is having difficulty running a java stored proc that is parsing a supplied XML file. The proc basically looks like:
import java.io.IOException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
InputStream is = getXMLAsInputStream(xml);
try {
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse( is );
... parse the document ....
catch (FactoryConfigurationError e) {
// unable to get a document builder factory
We are running on 9.2.0.6, HP-UX 64-bit. At first, when we would attempt to run the proc, a database hang would occur; now after attempting to install using loadjava jars for xerces2.6: ORA-29532: Java call terminated by uncaught Java exception:
javax.xml.parsers.FactoryConfigurationError: Provider
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not found)
The vendor says that the errors we are getting when running are not due to any dependency on xerces or jre1.4, and that we need to "install Oracle XML support", but I'm not certain what this means (I cannot find any documentation on what to install). I believe that there are jars that need to be loaded into the database to support the XML parsing, as jre1.3 does not include built-in XML support, and Oracle 9.2.0.6 uses jre1.3.
So...does anyone have any thoughts as to how to resolve the missing references? Is there a way to "install Oracle XML support", or is it to install the necessary jars?
Thanks,
CandiCandi,
The following resources should be of help:
Oracle9i Database Release 2 (9.2) Documentation Library
In particular, check out the following:
Java Developer's Guide
Java Stored Procedures Developer's Guide
XML API Reference - XDK and Oracle XML DB
XML Database Developer's Guide - Oracle XML DB
XML Developer's Kits Guide - XDK
If that doesn't help, then try the following:
OracleJVM and Java Stored Procedures
XML Technology Center
Good Luck,
Avi. -
Need help, oracle xml db jar conflicts with sup app server v9
I am trying to create a web service on sun app v9 that will work with calls to oracle xml db on oracle 10gr2. I have successfully created a web service on other application servers (weblogic and websphere) but sun was the app server of choice. The oracle jar xmlparserv2.jar is causing problems with the sun server as it seems to have bundled some java classes from the javax.xml.parsers, javax\xml\transform (and even from dom, sax and streams sub folders) packages.
If I put the oracle jar in my war the error I get in the log file when accessing my webservice tester is:
[#|2007-08-13T08:37:48.691-0400|INFO|sun-appserver-pe9.0|javax.enterprise.system.stream.out|_ThreadID=15;_ThreadName=httpWorkerThread-8080-0;|error: http://www.w3.org/TR/html4/loose.dtd<Line 31, Column 3>: XML-20100: (Fatal Error) Expected '>'.
line 31 of http://www.w3.org/TR/html4/loose.dtd|#]
[#|2007-08-13T08:37:48.738-0400|INFO|sun-appserver-pe9.0|javax.enterprise.system.stream.out|_ThreadID=15;_ThreadName=httpWorkerThread-8080-0;|
error: Expected '>'.
line ? of http://ann-griffithlap.jsc-eses.com:8080/TestWS/TestWSService?WSDL#types?schema1|#]
And the UI error from the tester call is:
javax.servlet.ServletException: java.lang.RuntimeException: Service Class not generated as expected at com.sun.enterprise.webservice.monitoring.WebServiceTesterServlet.initializePort(WebServiceTesterServlet.java:546) at com.sun.enterprise.webservice.monitoring.WebServiceTesterServlet.doGet(WebServiceTesterServlet.java:158) at com.sun.enterprise.webservice.monitoring.WebServiceTesterServlet.invoke(WebServiceTesterServlet.java:104) at
I had attempted to move the xmlparserv2.jar elsewhere in the classpath for classloading and one error I got while trying different spots was:
[#|2007-07-16T14:16:57.982-0400|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.tools.deployment|_ThreadID=10;_ThreadName=main;_RequestID=c9ffb261-2b6d-4dd2-bd8f-362e6b2af1a0;|INFO: JAXP SAXParser property not recognized: http://java.sun.com/xml/jaxp/properties/schemaLanguage|#]
[#|2007-07-16T14:16:57.982-0400|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.tools.deployment|_ThreadID=10;_ThreadName=main;_RequestID=c9ffb261-2b6d-4dd2-bd8f-362e6b2af1a0;|Check to see if parser conforms to JAXP 1.2 spec.|#]
which gets repeated for each deployment and then the server would not start up.
Is there any suggestions of where I can put the oracle jar to get sun to still start up as well as the jar to be available for use by the classes in my war that also contains the webservice that will call my underlying class? I have not found a way to eliminate the oracle jar if I want to do an xquery against oracle xml db.
Thanks,
D.GriffithHere's more information on the machines.
Machine where the Oracle Database 11g Express Edition: IP Address is 10.162.128.67
Machine where the SQL Server database: IP Address is 142.120.51.30.
I've modified the tnsnames.ora to the following:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.162.128.67)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
SQLSERVER =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 142.120.51.30)(PORT=1433))
(CONNECT_DATA =
(SID = SQLSERVER)
(HS = OK)
)But now I'm getting the following error:
C:\>tnsping sqlserver
TNS Ping Utility for 32-bit Windows: Version 11.2.0.2.0 - Production on 18-SEP-2
012 14:52:59
Copyright (c) 1997, 2010, Oracle. All rights reserved.
Used parameter files:
C:\oraclexe\app\oracle\product\11.2.0\server\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 142.120.51.30)(PORT=1434))) (CONNECT_DATA = (SID = SQLSERVER)) (HS = OK)
TNS-12541: TNS:no listener
C:\>Regards,
Allen -
ANN: Oracle XML Parser for Java v2.0.0.1
A new maintenance release of the Oracle Parser for Java is
available for download. It has the following fixes and changes:
Bug fixes for #920536, i.e. Cannot access element attributes via
XSLT; #898423. i.e. ElementDecl's in DTDs; #774774, i.e. DOM
extensions using XSL pattern matching; #863890 i.e. SAX
IOException not thrown.
New APIs in the following new interface:
1. oracle.xml.parser.v2.NSResolver
- resolveNamespacePrefix( find the namespace definition in scope
for a given namespace prefix )
New APIs in the following classes:
1. oracle.xml.parser.v2.XMLNode
- selectNodes( Selects nodes from the tree which match the given
pattern; client can provide an NSResolver implementation to
resolve namespace prefixes in the pattern ).
2. oracle.xml.parser.v2.ElementDecl
- getParseTree( Returns the root Node of Content Model parse
tree, which could then be traversed node by node using
getFirstChild() and getLastChild(). The Node types are: PLUS,
COMMA, ASTERISK, ELEMENT, QMARK ).
This is the first beta patch release for v2.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
nullunzip -l appsborg2.zip | grep 9.0.4
0 04-18-03 20:10 .xdkjava_version_9.0.4.0.0_production
do i still need to do that step?No, you do not have to since "XML Parser for Java v9.0.4" is already installed as part of appsborg2.zip -
I wrote a test application that reads a XML file. First method reads it via DOM in a Document object, second that reads it via SAX in a string. The output is almost the same but the character data is different:
while the dom outout is as expected:
<hap>EUSF</hap>
<name><![CDATA[WADDELL&REED ADV BOND CL Y]]></name>
the SAX output is different:
<hap>EUSF</hap>
<name>WADDELL&REED ADV BOND CL Y</name>
as both elements have text data, only the second is enclosed in a <![CDATA]> value. The DOM output is the same as when displayed the XML in internet explorer, so i guess this is the correct result. but my SAX reader does not display the <![CDATA]> value ...
to get the sax output i subclassed DefaultHandler and overwrote the methods like described in the Web Service Tutorial "Echoing an XML File with the SAX Parser" (http://java.sun.com/webservices/docs/ea2/tutorial/doc/JAXPSAX3.html#64190):
* Overwrites super.
* Receive notification of character data inside an element.
public void characters(char buf[], int offset, int len) {
String s = new String(buf, offset, len);
if (!s.trim().equals("")) { //suppress output of characters that are all whitespace
write(s);
}//characters()
the characters() method has the content of an element, but it has not the information if a CDATA is enclosing the data or not(?). How can this be done?There's a thing called a LexicalHandler (org.xml.sax.ext.LexicalHandler) that has startCDATA and endCDATA methods. The API documentation suggests that you could create your own LexicalHandler and use it somehow, but it doesn't give you a nicely packaged example. I don't have an example of it either, sorry.
However despite what you say, those two outputs are not different. In XML terms they are identical and parsers will treat them identically. -
Hi all,
i have a problem by solving an error in my code. The Code is mainly from Ian Darwin.
The code i am running works with j2sdk1.4.2_04. But now i have to bring it to work with jdk1.6.0_13.
The code parses xml documents. With small xml documents the code works. With large xml documents i get the following error while running the produced class file.
Exception in thread "main" java.lang.NullPointerException
at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.setChunkIndex(DeferredDocumentImpl.java:1944)
at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.appendChild(DeferredDocumentImpl.java:644)
at com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser.characters(AbstractDOMParser.java:1191)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.characters(XMLDTDValidator.java:862)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:463)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:208)
at XParse.parse(XParse.java:38)
at XParse$JFileChooserrv.<init>(XParse.java:119)
at XParse.main(XParse.java:213)
I know what a java.lang.NullPointerException mens. But i don't know where i have to look for. Specially i don't know what or where "com.sun.org.apache...." is.
Is there a package that a have to add to the environment? Can some one tell my where i can find this package?
I wrote the code for some years ago, 2006 or so. With the knew jdk1.6.0_13 some thinks chance in the environment. Couldn't find what exactly.
The code has only 215 lines, but some how i can't add it to this Message, because Maximum allowed is only 7500.
Is there an other Forum, which may is better for my question?Here is the code:
import java.io.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import javax.swing.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
import java.awt.Container;
import javax.swing.JTextArea;
* This code is mainly from @author Ian Darwin, [email protected]
public class XParse {
/** Convert the file */
public static void parse(File file, boolean validate) {
try {
System.err.println("");
String fileName = file.getAbsolutePath();
System.err.println("Parsing " + fileName + "...");
// Make the document a URL so relative DTD works.
//String uri = new File(fileName).getAbsolutePath();
//System.err.println(uri);
DocumentBuilderFactory f = DocumentBuilderFactory.newInstance();
if (validate)
f.setValidating(true);
DocumentBuilder p = f.newDocumentBuilder();
p.setErrorHandler(new MyErrorHandler(System.err));
//XmlDocument doc = XmlDocument.createXMLDocument(file);
boolean vaild = p.isValidating();
if (vaild) {
System.out.println("yes parsing");
Document doc = p.parse(file); // <<<< ERROR
System.out.println("Parsed OK");
} catch (SAXParseException ex) {
System.err.println("+================================+");
System.err.println("| *SAX Parse Error* |");
System.err.println("+================================+");
System.err.println(ex.toString());
System.err.println("At line " + ex.getLineNumber());
System.err.println("+================================+");
} /**catch (RuntimeException ex) {
System.err.println("+================================+");
System.err.println("| *SAX Parse Error* |");
System.err.println("+================================+");
System.err.println(ex.toString());
//System.err.println("At line " + ex.getLineNumber());
//System.err.println("At line " + ex.getMessage());
System.err.println("+================================+");
}**/ catch (SAXException ex) {
System.err.println("+================================+");
System.err.println("| *SAX Error* |");
System.err.println("+================================+");
System.err.println(ex.toString());
System.err.println("+================================+");
/*}} catch (SAXNotRecognizedException ex) {
System.err.println(" no SAX");*/
} catch (ParserConfigurationException ex) {
System.err.println(" ???");
} catch (IOException ex) {
System.err.println("+================================+");
System.err.println("| *XML Error* |");
System.err.println("+================================+");
System.err.println(ex.toString());
private static class JFileChooserrv {
JFileChooserrv(JFrame f, boolean vverabreiten) {
String openfile;
String verror;
boolean validate = true;
final JFrame frame = f;
String vFilename = "Z:\\Boorberg\\parsen_vista\\daten";
//String vFilename = "C:\\";
File vFile = new File(vFilename);
final JFileChooser chooser = new JFileChooser(vFile);
JFileFilter filter = new JFileFilter();
filter.addType("xml");
filter.addType("sgml");
filter.addType("html");
filter.addType("java");
filter.setDescription("strukturfiles");
chooser.addChoosableFileFilter(filter);
boolean vjeas = true;
chooser.setMultiSelectionEnabled(vjeas);
int returnVal = chooser.showOpenDialog(frame);
if (returnVal == JFileChooser.APPROVE_OPTION) {
//Array filearry[] = chooser.getSelectedFiles();
//if (vFile = chooser.getSelectedFiles()) {
//File file[] = chooser.getSelectedFiles();
File vfile[] = chooser.getSelectedFiles();
//String openfile = new String();
int vlenght = vfile.length;
if (vlenght>1) {
int x=0;
while (x< vlenght) {
parse(vfile[x], validate);
x = x +1;
if (vlenght<=1) {
File v2file = chooser.getSelectedFile();
parse(v2file, validate);
} else {
System.out.println("You did not choose a filesystem object.");
System.exit(0);
private static class JFileFilter extends javax.swing.filechooser.FileFilter {
protected String description, vnew;
protected ArrayList<String> exts = new ArrayList<String>();
protected boolean vtrue;
public void addType(String s) {
exts.add(s);
/** Return true if the given file is accepted by this filter. */
public boolean accept(File f) {
// Little trick: if you don't do this, only directory names
// ending in one of the extentions appear in the window.
if (f.isDirectory()) {
return true;
} else if (f.isFile()) {
Iterator it = exts.iterator();
while (it.hasNext()) {
if (f.getName().endsWith((String)it.next()))
return true;
// A file that didn't match, or a weirdo (e.g. UNIX device file?).
return false;
/** Set the printable description of this filter. */
public void setDescription(String s) {
description = s;
/** Return the printable description of this filter. */
public String getDescription() {
return description;
private static class MyErrorHandler implements ErrorHandler {
// Error handler output goes here
private PrintStream out;
MyErrorHandler(PrintStream out) {
this.out = out;
* Returns a string describing parse exception details
private String getParseExceptionInfo(SAXParseException spe) {
String systemId = spe.getSystemId();
if (systemId == null) {
systemId = "null";
String info = "URI=" + systemId +
" Line=" + spe.getLineNumber() +
": " + spe.getMessage();
return info;
// The following methods are standard SAX ErrorHandler methods.
// See SAX documentation for more info.
public void warning(SAXParseException spe) throws SAXException {
//System.exit(0);
//out.println("Warning: " + getParseExceptionInfo(spe));
public void error(SAXParseException spe) throws SAXException {
//System.exit(0);
String message = "Error: " + getParseExceptionInfo(spe);
throw new SAXException(message);
public void fatalError(SAXParseException spe) throws SAXException {
//System.exit(0);
String message = "Fatal Error: " + getParseExceptionInfo(spe);
throw new SAXException(message);
public static void main(String[] av) {
JFrame vframe = new JFrame("chose files to pars");
boolean vverabreiten = true;
boolean validate = true;
JFileChooserrv vdateienwaehlen = new JFileChooserrv(vframe, vverabreiten);
}The Stack Trace i posted in the last Message. But i couldn't read it, i am not a programmer. -
Hi All,
In a servlet I have created a SOAPMessage object based on the request received, and when I execute
message.getSOAPBody I get the message:
java.lang.NoSuchMethodError: javax.xml.parsers.SAXParserFactory.getSchema()
I am running tomcat with jdk 1.5 and I am using saaj-api.jar, saaj_imp.jar and Fastinfoset.jar from jwsdp 1.6
Anyone got any ideas what to do ?
Kind regards,
Marco LaponderAlong with jdk1.4.2, Sun has bundled a currently ancient version of JAXP.
So, get a recent version of a JAXP implementation (e.g. with JWSDP1.6), probably contained in jar-files called jaxp-api.jar, dom.jar, sax.jar, xalan.jar and xercesImpl.jar, and add these to your classpath when you're compiling/running.
You're not done yet! Because the old jaxp libraries are bundled with your JVM, the classloader will find them through your bootclasspath, and they will be prefered above the new implementation you just added to the classpath. To resolve this, the JVM creators came up with the endorsed mechanism. This allows you to provide new classes for a list of predefined packages. These classes are already included in the jvm distribution, but are foreseen to be updated. See for more information about the endorsed mechanism: http://java.sun.com/j2se/1.4.2/docs/guide/standards/ .
So to be short, you also have to make the jvm recognise them as endorsed libraries. E.g. by adding them to the <java-home>/lib/endorsed directory or by setting the java.endorsed.dirs property to the directories which include the new jar files.
Your commandline to run app.class would become: java -Djava.endorsed.dirs=/home/endorsedDir;/anotherDir app
Maybe you are looking for
-
How can I change the USER name of my i-cloud e-mail account? It was set up by my son and he used a silly / embarrassing user name. I would like to change this name OR set up another i-cloud e-mail account under my own name / reference. Help?
-
Group calendars on 10.6.4 client machines no longer work with iCal Server
After updating 2 client machines to 10.6.4 I realized my group calendars no longer work in iCal. I get "Server Responded With an Error" on all my group calendars, on both machines. Preferences>Accounts>Server Path reveles the server path has reverted
-
I've changed my printer settings to print only in greyscale, but when i use the eprint function, it prints in colour. The HP eprint site isn't accepting my code / ID details. How do I change it?
-
Is there any way to speed up the wireless router. I have a new Dell with the latest everything.
-
I have a OS X 10.4.11 and have just purchased a new IPhone 4 which I have just discovered is not compatable. How do I upgrade to 10.5 or 10.6 ?? Do I have to buy a new laptop?