Document in org.w3c.dom.*??
Is Document in org.w3c.dom.* a file?what is its extension?
How can i write a file with it?
org.w3c.dom.Document is a class that represents an XML document.
It does not represent an XML stream as mlk says.
It doesn't have anything to do with files. You can use an XML parser to build up a Document in memory from an XML file or any other data source that produces XML. Class org.w3c.dom.Document does not have any methods by itself that you can use to write to an XML file.
XML files usually have the extension ".xml", but they can also have other extensions.
See this: Working with XML: The Java/XML Tutorial
Similar Messages
-
Covert org.jdom.Document to org.w3c.dom.Document
Hello,
How would I convert org.jdom.Document to org.w3c.dom.Document??
I'm creating org.jdom.Document from the servlet that reads from the database, which gets output like following.
// doc is org.jdom.Document
Document doc = new Document( root );
reportName = new Element( "REPORT_NAME" );
root.addContent( reportName );
reportName.setText( "Current Account Balance" );
// skip...
XMLOutputter outputter = new XMLOutputter(" ", true, "UTF-8");
outputter.output(doc, out);
And in my caller servlet, I read from the previous servlet using URL and parse it, trying to get Document, but it
InputSource xmlSource = new InputSource( url.openStream());
//Use a DOM Parser (org.apache.xerces.parsers.DOMParser)
DOMParser parser = new DOMParser();
parser.parse( xmlSource );
Document doc = parser.getDocument();
// and I do transformation.
DOMSource inXML = new DOMSource( doc );
StreamResult outXML = new StreamResult( out );
transformer.transform( inXML, outXML )
I'd like to skip passing around XML and share the same Document object so that I don't have parse it again...
Help!Convert jdom document to dom document with class DOMOutputter.
org.jdom.output.DOMOutputter domOut=new DOMOutputter();
org.w3c.dom.Document domDocument=domOut.output(org.jdom.Document jdomDocument); -
Hi,
I have done googling for how to convert org.dom4j.Document into org.w3c.dom.Document , but could not get any usefull data.
If any one is having solution or any idea, please reply.
Thanks in advance
<!--Session data-->Note: This thread was originally posted in the [Java Programming|http://forums.sun.com/forum.jspa?forumID=31] forum, but moved to this forum for closer topic alignment.
-
How to create org.w3c.dom.Document.
Hi,
I have my complete xml file in a String variable like
String strXml = " <?xml version="1.0"?>
<report>
<name>testReport & report
<duration>Jan to Feb</duration>
<reportId>1</reportId>
</report> "
I need to create a "org.w3c.dom.Document" object from the above "strXml" variable.
Thanks in advance for your answers,
Sha S.this is the code snippet that would answer u r question
import org.apache.xml.serialize.XMLSerializer;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import org.w3c.dom.ProcessingInstruction;
import org.xml.sax.InputSource;
import com.exel.businessobjects.*;
StringReader srxml = new StringReader(xmlcontent);
Reader rxml = (Reader)srxml;
InputSource isxml = new InputSource(rxml);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(isxml); -
I use oc4j903 and win2k. I write a document style web service following Demo for Stateless Java Document Web Services.
I Create an EAR file using WebServicesAssembler and deploy it .and my config.xml:
<web-service>
<display-name>Stateful Java Document milkdemo Web Service</display-name>
<description>Stateful Java Document milkdemo Web Service Example</description>
<!-- Specifies the resulting web service archive will be stored in ./docws.ear -->
<destination-path>./milkdemo.ear</destination-path>
<!-- Specifies the temporary directory that web service assembly tool can create temporary files. -->
<temporary-directory>./temp</temporary-directory>
<!-- Specifies the web service will be accessed in the servlet context named "/docws". -->
<context>/milkdemo</context>
<!-- Specifies the web service will be stateful -->
<stateful-java-service>
<interface-name>com.brightdairy.client.sync.SyncServerDoc</interface-name>
<class-name>com.brightdairy.client.sync.SyncServerDocImpl</class-name>
<!-- Specifies the web service will be accessed in the uri named "/docService" within the servlet context. -->
<uri>/milkdemo</uri>
<!-- Specifies the location of Java class files ./classes -->
<java-resource>./classes</java-resource>
<!-- Specifies that it uses document style SOAP messaging -->
<message-style>doc</message-style>
</stateful-java-service>
<!-- generate the wsdl -->
<wsdl-gen>
<wsdl-dir>wsdl</wsdl-dir>
<!-- over-write a pregenerated wsdl , turn it 'false' to use the pregenerated wsdl-->
<option name="force">true</option>
<option name="httpServerURL">http://localhost:8888</option>
</wsdl-gen>
<!-- generate the proxy -->
<proxy-gen>
<proxy-dir>proxy</proxy-dir>
<option name="include-source">true</option>
</proxy-gen>
</web-service>
my webservice java file:
* Title: BrightDairy SOAP demo
* Description:
* Copyright: Copyright (c) 2002
* Company: ufoasia
* @author
* @version 1.0
package com.brightdairy.client.sync;
import java.sql.*;
import java.util.Vector;
import java.util.Iterator;
import org.w3c.dom.Element;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import oracle.xml.parser.v2.XMLDocument;
import oracle.xml.parser.v2.XMLElement;
//import com.brightdairy.client.object.Product;
import com.brightdairy.client.sync.SyncServerDoc;
public class SyncServerDocImpl implements SyncServerDoc {
public SyncServerDocImpl() {
public Element getProductIDList() {
Connection connServer = null;
PreparedStatement stmtServerProduct = null;
ResultSet rsServerProduct = null;
Document doc = new XMLDocument();
Element elProduct = doc.createElement("product");
doc.appendChild(elProduct);
long m_msec;
m_msec = System.currentTimeMillis();
try {
connServer = makeConnection();
System.out.println("1");
stmtServerProduct = connServer.prepareStatement(
"SELECT ID FROM " + SERVER_TABLE_PRODUCT );
System.out.println("");
rsServerProduct = stmtServerProduct.executeQuery();
System.out.println("2");
while(rsServerProduct.next()) {
Element elID = doc.createElement("id");
elID.appendChild(doc.createTextNode(rsServerProduct.getString("ID")));
elProduct.appendChild(elID);
System.out.println("3");;
System.out.println("4");
return doc.getDocumentElement();
} catch(SQLException e) {
e.printStackTrace();
System.out.println("SQL exception has occured");
System.out.println(e.getMessage());
return doc.getDocumentElement();
}finally {
try {
rsServerProduct.close();
stmtServerProduct.close();
connServer.close();
m_msec = System.currentTimeMillis() - m_msec;
System.out.println("6");
System.out.println("getProductIDList:It take time:" m_msec/1000 "s");
} catch(Exception e1) {}
Now my firts question: when i generate the proxy WebServicesAssembler will failure (couldn't import jar.....) and i had imported all jar files,But if i commented proxy-gen , no error.
and my second question: I commented proxy-gen and deployed ite and success. when i invoked it through web page , then error:
java.lang.IllegalArgumentException: No Serializer found to serialize a 'org.w3c.
dom.Element' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.
at org.apache.soap.util.xml.XMLJavaMappingRegistry.querySerializer(XMLJa
vaMappingRegistry.java:157)
at org.apache.soap.encoding.soapenc.ParameterSerializer.marshall(Paramet
erSerializer.java:106)
at org.apache.soap.rpc.RPCMessage.marshall(RPCMessage.java:265)
at org.apache.soap.Body.marshall(Body.java:148)
at org.apache.soap.Envelope.marshall(Envelope.java:203)
at org.apache.soap.Envelope.marshall(Envelope.java:161)
at oracle.j2ee.ws.InvocationWrapper.invoke(InvocationWrapper.java:309)
at oracle.j2ee.ws.RpcWebService.doGetRequest(RpcWebService.java:540)
at oracle.j2ee.ws.BaseWebService.doGet(BaseWebService.java:1106)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletReque
stDispatcher.java:721)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(Ser
vletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpReques
tHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
va:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
va:106)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExec
utor.java:803)
at java.lang.Thread.run(Thread.java:484)
I took much time and couln't get answer ,please help me!!!!!!!!!!!!Yeah!
I have resolved it .
It take me one day time!
my error is 1: Element which I used is no namespace.
2: no import enough jar files
just so so .
sorry! I am poor in English -
Org.w3c.dom.Document to/from String ?
I need to be able to parse (once) an XML string, and then pass the parsed object around to/from different objects.
I tried to use org.w3c.dom.Document,
generated by javax.xml.parsers.DocumentBuilder .
HOWEVER - I don't see any way to parse an xml String!
The doc-builder parse() method accepts either a file/url, or an InputStream.
When I tried to use the StringBufferInputStream I found-out it is deprecated, and that I should use StringReader.
BUT I cannot parse using StringReader ! (the method parse() doesn't work with it)
Is there anyway to parse a String to create a Document ?
========================================================
And that's only HALF my problem:
I did parse an input file into a Document, to experiment a little.
I then wanted to convert it to an XML String - but couldn't.
How do I get the xml String from a Document ?
I cannot: How do I save it to a file ?
I must say that under .NET both tasks are TRIVIAL:
XmlDocument.LoadXML()
XmlDocument.OuterXml
Thanks
MeirThe doc-builder parse() method accepts either a file/url, or an InputStream.This isn't true. Look it up again. There are overridden versions of parse() that use File, InputSource, InputStream, or String. The String one isn't what you want, because the String it takes is a URL pointing to the XML and not the XML itself. The File one doesn't work for you because you don't have a file, and you've already said why the InputStream one doesn't work for you.
So that leaves the version that takes an InputSource. So, what is an InputSource anyway? You could look it up just by clicking on the link in the API docs... -
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) -
Hi Chaps,
I have Oracle 11g1 server side and am using the Oracle XDK 10.1.0.2.0 for Windows client side with Sun Java JDK 6 (1.6.0_06-b02).
(I couldnt find an XDK for 11g1???)
I have a table in my database that has an XMLType, its a very simple table -
CREATE TABLE hcr_xml_test
RRN VARCHAR(24) PRIMARY KEY,
ClipID VARCHAR2(27),
Lodgement XMLType
XMLTYPE COLUMN Lodgement
STORE AS OBJECT RELATIONAL
ELEMENT "/www.hcrregister.com/RequestServices/Messages/ConditionReportCreateRequest_1.xsd#ConditionReportCreateRequest_1"
Thats all fine, however with the XDK I am trying to construct an XMLType for use with JDBC from a valid org.w3c.dom.Document so that I can insert a row into my table. My code looks like this -
XMLType xml = new XMLType(realCon, doc);
stmt = (OraclePreparedStatement) realCon.prepareStatement(sql);
stmt.setString(1, id.getRRN());
stmt.setString(2, id.getCenteraClipID());
stmt.setObject(3, xml);
stmt.execute();
doc is a org.w3c.dom.Document
realCon is a java.sql.Connection
That code throws a SQLException at the line "stmt.setObject(3, xml);" -
java.sql.SQLException: Fail to convert to internal representation
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:403)
at oracle.sql.OPAQUE.<init>(OPAQUE.java:85)
at oracle.xdb.XMLType.toDatum(XMLType.java:480)
at oracle.jdbc.driver.OraclePreparedStatement.setORADataInternal(OraclePreparedStatement.java:7437)
at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8158)
at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:8149)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObject(OraclePreparedStatementWrapper.java:229)
at uk.co.landmarkinfo.registers.datawarehouse.tools.oracle.lodgementloader.DocumentProcessor.run(DocumentProcessor.java:232)
Inspecting the exception I can see that the vendorCode is 17059.
If I use "XMLType xml = XMLType.createXML(realCon, doc);" then xml is null instead of throwing a SQLException, so something isnt working here...
However, if I serialize my Document to a String first and give that String to either the XMLType Constructor or XMLType.createXML() then it all works fine -
/////TEMP
Transformer transformer = saxTransformerFactory.newTransformer();
transformer.setOutputProperty("omit-xml-declaration", "no");
transformer.setOutputProperty("indent", "yes");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
transformer.transform(new DOMSource(doc), new StreamResult(baos));
XMLType stringXML = new XMLType(realCon, new String(baos.toByteArray()));
////END TEMP
stmt = (OraclePreparedStatement) realCon.prepareStatement(sql);
stmt.setString(1, id.getRRN());
stmt.setString(2, id.getCenteraClipID());
stmt.setObject(3, stringXML);
stmt.execute();
But why do I need to serialize to a String first??? Looking at the javadoc I dont think I should have to do this. So is there a problem in Oracles XDB handling of Document or have I missed something?Anyone has any idea? Please help!!!
xu -
Hello,
I hope someone can help me with this.
I have a stateless session bean, which is returning a
org.w3c.dom.Document object. The whole object is getting created
but at the client side I am getting the following exception:
java.rmi.RemoteException: ; nested exception is:
weblogic.rmi.ServerError: A RemoteException occurred in the server method
- with nested exception:
[java.lang.StackOverflowError:
Start server side stack trace:
java.lang.StackOverflowError
at java.lang.Exception.<init>(Compiled Code)
at java.lang.reflect.InvocationTargetException.<init>(InvocationTargetEx
ception.java:58)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Compiled Code)
at java.io.ObjectOutputStream.invokeObjectWriter(Compiled Code)
at java.io.ObjectOutputStream.outputObject(Compiled Code)
at java.io.ObjectOutputStream.writeObject(Compiled Code)
at java.io.ObjectOutputStream.outputClassFields(Compiled Code)
at java.io.ObjectOutputStream.defaultWriteObject(Compiled Code)
Then multiple occurences of the last few lines followed by
at org.apache.xerces.dom.ParentNode.writeObject(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Compiled Code)
at java.io.ObjectOutputStream.invokeObjectWriter(Compiled Code)
at java.io.ObjectOutputStream.outputObject(Compiled Code)
at java.io.ObjectOutputStream.writeObject(Compiled Code)
at java.io.ObjectOutputStream.outputClassFields(Compiled Code)
at java.io.ObjectOutputStream.defaultWriteObject(Compiled Code)
at org.apache.xerces.dom.ParentNode.writeObject(Compiled Code)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Compiled Code)
at java.io.ObjectOutputStream.invokeObjectWriter(Compiled Code)
at java.io.ObjectOutputStream.outputObject(Compiled Code)
at java.io.ObjectOutputStream.writeObject(Compiled Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeObject(Compiled
Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeSpecial(Compiled
Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeObject(Compiled
Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeObjectWL(Compiled
Code)
at weblogic.rmi.extensions.AbstractOutputStream2.writeObject(Compiled
Code)
at com.ssmb.teams.model.CMSInterestDataEJBEOImpl_WLSkel.invoke(Compiled
Code)
at weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(Compiled Code
at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(Compiled
Code)
at weblogic.rmi.internal.BasicExecuteRequest.execute(Compiled Code)
at weblogic.kernel.ExecuteThread.run(Compiled Code)
End server side stack trace
at weblogic.rmi.extensions.AbstractRequest.sendReceive(AbstractRequest.j
ava:76)
at com.ssmb.teams.model.CMSInterestDataEJBEOImpl_WLStub.getRegionAnalyst
Data(CMSInterestDataEJBEOImpl_WLStub.java:558)
at com.ssmb.teams.model.CMSInterestDataEJBEOImpl_ServiceStub.getRegionAn
alystData(CMSInterestDataEJBEOImpl_ServiceStub.java, Compiled Code)
at CMSJavaScript.main(CMSJavaScript.java:87)
The structure of the XML document is
<Maillist>
<Region>
<RegionCode>7</RegionCode>
<RegionName>Asia Pacific</RegionName>
<Analyst>
<Id>11111</Id>
<Name>AAAAAAAAAAAAAAAAA</Name>
</Analyst>
<Analyst>
<Id>22222</Id>
<Name>BBBBBBBBBBBBBBBBBB</Name>
</Analyst>
</Region>
</Maillist>
If the no. of Anlayst elements are 219, I am getting this error ( the same thing
is working for less no. of analyst).
Surprisingly when I access this ejb, by deploying it on my local server instance
on Win-NT, it works fine. I am getting this
exception, when the server is running on Sun Solaris.
The weblogic version is 5.1.
It will be really helpful if someone can reply to mee ASAP
Thanks.
Suren.Thanks a lot guys for all that information.
Rajesh Mirchandani <[email protected]> wrote:
Suren,
More info at
http://edocs.bea.com/wls/docs60/faq/java.html#251197
Rob Woollen wrote:
The quick fix is probably to use the -Xss argument on the Solaris JVMto increase the
thread stack size.
-- Rob
Suren wrote:
Thanks for your quick response.
But how do we overcome with this?
I tried to look for some help with this, but if you have any idea,
can you suggest
something ?
Thanks
Suren.
Rob Woollen <[email protected]> wrote:
It looks like the stack is overflowing when your DOM Tree is being
serialized.
Perhaps the Solaris JVM has a lower stack size by default.
-- Rob
Suren wrote:
Hello,
I hope someone can help me with this.
I have a stateless session bean, which is returning a
org.w3c.dom.Document object. The whole object is getting created
but at the client side I am getting the following exception:
java.rmi.RemoteException: ; nested exception is:
weblogic.rmi.ServerError: A RemoteException occurred in
the
server method
- with nested exception:
[java.lang.StackOverflowError:
Start server side stack trace:
java.lang.StackOverflowError
at java.lang.Exception.<init>(Compiled Code)
at java.lang.reflect.InvocationTargetException.<init>(InvocationTargetEx
ception.java:58)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Compiled Code)
at java.io.ObjectOutputStream.invokeObjectWriter(Compiled
Code)
at java.io.ObjectOutputStream.outputObject(Compiled Code)
at java.io.ObjectOutputStream.writeObject(Compiled Code)
at java.io.ObjectOutputStream.outputClassFields(CompiledCode)
at java.io.ObjectOutputStream.defaultWriteObject(CompiledCode)
Then multiple occurences of the last few lines followed by
at org.apache.xerces.dom.ParentNode.writeObject(CompiledCode)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Compiled Code)
at java.io.ObjectOutputStream.invokeObjectWriter(CompiledCode)
at java.io.ObjectOutputStream.outputObject(Compiled Code)
at java.io.ObjectOutputStream.writeObject(Compiled Code)
at java.io.ObjectOutputStream.outputClassFields(CompiledCode)
at java.io.ObjectOutputStream.defaultWriteObject(CompiledCode)
at org.apache.xerces.dom.ParentNode.writeObject(CompiledCode)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Compiled Code)
at java.io.ObjectOutputStream.invokeObjectWriter(CompiledCode)
at java.io.ObjectOutputStream.outputObject(Compiled Code)
at java.io.ObjectOutputStream.writeObject(Compiled Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeObject(Compiled
Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeSpecial(Compiled
Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeObject(Compiled
Code)
at weblogic.common.internal.WLObjectOutputStreamBase.writeObjectWL(Compiled
Code)
at weblogic.rmi.extensions.AbstractOutputStream2.writeObject(Compiled
Code)
at com.ssmb.teams.model.CMSInterestDataEJBEOImpl_WLSkel.invoke(Compiled
Code)
at weblogic.rmi.extensions.BasicServerObjectAdapter.invoke(CompiledCode
at weblogic.rmi.extensions.BasicRequestHandler.handleRequest(Compiled
Code)
at weblogic.rmi.internal.BasicExecuteRequest.execute(CompiledCode)
at weblogic.kernel.ExecuteThread.run(Compiled Code)
End server side stack trace
at weblogic.rmi.extensions.AbstractRequest.sendReceive(AbstractRequest.j
ava:76)
at com.ssmb.teams.model.CMSInterestDataEJBEOImpl_WLStub.getRegionAnalyst
Data(CMSInterestDataEJBEOImpl_WLStub.java:558)
at com.ssmb.teams.model.CMSInterestDataEJBEOImpl_ServiceStub.getRegionAn
alystData(CMSInterestDataEJBEOImpl_ServiceStub.java, Compiled
Code)
at CMSJavaScript.main(CMSJavaScript.java:87)
The structure of the XML document is
<Maillist>
<Region>
<RegionCode>7</RegionCode>
<RegionName>Asia Pacific</RegionName>
<Analyst>
<Id>11111</Id>
<Name>AAAAAAAAAAAAAAAAA</Name>
</Analyst>
<Analyst>
<Id>22222</Id>
<Name>BBBBBBBBBBBBBBBBBB</Name>
</Analyst>
</Region>
</Maillist>
If the no. of Anlayst elements are 219, I am getting this error( the
same thing
is working for less no. of analyst).
Surprisingly when I access this ejb, by deploying it on my local
server
instance
on Win-NT, it works fine. I am getting this
exception, when the server is running on Sun Solaris.
The weblogic version is 5.1.
It will be really helpful if someone can reply to mee ASAP
Thanks.
Suren. -
How to convert clobDomain to org.w3c.dom.Document
Hi
We have store the xml data into oracle database as clobDomain.We are reading the same data from db and want to convert it into org.w3c.dom.Document type.We used the method getXMLContentNode() but its doesn't help us.See the below code.
ClobDomain pedigreeXML = (ClobDomain) pedigreeDocumentRow.getAttribute("PedigreeDocument");
DocumentBuilderFactory docBuildFactory= DocumentBuilderFactory.newInstance();
Document containerDoc = docBuildFactory.newDocumentBuilder().newDocument();
System.out.println(containerDoc.toString()); // this sop statement printing the xml fine
Node node= pedigreeXML.getXMLContentNode(containerDoc);
System.out.println(node); // this sop statement is printing data as "oracle.xml.parser.v2.XMLCDATA@1de6ded"
Please let me know can we convert clobDomain to Document type.
Thanks
BajiBaji,
it would help if you give the jdev version you are working on...
I don't see a problem with the output you get from System.out.println(node); // this sop statement is printing data as "oracle.xml.parser.v2.XMLCDATA@1de6ded"as it only prints you the address of the node, but not the content. Try
String str = node.getTextContent();and check if this get you the content.
Timo -
Security Exception in trying to get a org.w3c.dom.Document
Hi,
I'm trying to get an org.w3c.dom.Document using the following code----
String configFileName = "discoveryconsts.xml";
DocumentBuilder db = null;
Document xmlDocument = null;
DocumentBuilderFactory dbf = null;
dbf = DocumentBuilderFactory.newInstance();
System.out.println("The DocumentBuilderFactory is :" + dbf);
//the exception happens here,while building the DocumentBuilder.
db = dbf.newDocumentBuilder();
System.out.println("The DocumentBuilder is :" + db); try
xmlDocument = db.parse(configFileName);
System.out.println("The Document Builder is :" + db);
catch(Exception e)
System.out.println("The Exception is :"+ e);
System.out.println("The XML Document is :" + xmlDocument);
The error obtained is in the ---
java.lang.SecurityException: sealing violation
at java.net.URLClassLoader.defineClass(URLClassLoader.java:234)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(DocumentBuilderImpl.java:98)
atorg.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(DocumentBuilderFactoryImpl.java:87)
at Prototype.ChangingDiscConstsFile.discoveryConstants(ChangingDiscConstsFile.java:36)
at Prototype.ChangingDiscConstsFile.main(ChangingDiscConstsFile.java:74)
This error is obtained at runtime(ie.The file gets compiled).
Kindly let me know the reason for the exception.
regards,
Karan.Hello Satya,
Have you checked if the cross domain security between the domain WLS 10.3.5 and the backend server is enabled?
Trust between domains is established so that principals in a Subject from one WebLogic domain can make calls in another domain. In previous releases of WebLogic Server, there was only one type of domain trust that is now referred to as Global Trust. WebLogic Server now supports a type of domain trust that is referred to as Cross Domain Security. The following sections explain how to configure each domain trust type:
Enabling Cross Domain Security Between WebLogic Server Domains
Enabling Global Trust
http://docs.oracle.com/cd/E21764_01/web.1111/e13707/domain.htm#i1176046 -
Save org.w3c.dom.Document to File
Hi all,
I can save org.jdom.Document to a file but I don't know how do it with org.w3c.dom.Document.
My code Java can convert org.w3c.dom.Document to org.jdom.Document but I want to save org.w3c.dom.Document direct.
thanks a lot
best regards
dseaAs an xml file?
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPXSLT4.html -
Org.w3c.dom.Document not found
I'm using jdk 1.6 and I'm getting "cannot find symbol" element when I try to compile to following simple code:
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Element;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
public class TestXml {
public static void main(String[] args) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document = builder.newDocument();
Element root = (Element) document.createElement("gene");
}What do I need to get this to compile? I thought jaxp was built into jdk1.6, so why is it not being found?javac TestXml.java
TestXml.java:14: cannot find symbol
symbol : variable Document
location: class TestXml
Document = builder.newDocument();
^
TestXml.java:15: cannot find symbol
symbol : variable document
location: class TestXml
Element root = (Element) document.createElement("gene");
^
2 errorsIn eclipse, the problem is shown as "Document cannot be resolved." -
Org.w3c.dom.Document -- text
Hello.
I have parsed org.w3c.dom.Document.
Is here a library that can print it to a xml file?
Secondly I wish print it as .html, so output should a bit differ from standard .xml output.Yes. In both cases you use a Transformer. (That's in package javax.xml.transform.) You get it via one of the TransformerFactory.newTransformer() methods. To do a straight copy you use the method with no parameters, which does an "identity transformation". To transform to HTML, you use the method with an XSLT for its parameter.
-
Org.w3c.dom Document newbie question
hello
I have a string of an XML document that i want to make into a dom.Document. i can't seem to create it though.
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
org.w3c.dom.Document doc = db.parse(new StringBufferInputStream(s.substring(s.indexOf("?>") + 2).trim()));the String s has a xml header with <? and ?> and you see here i am stripping that off the top... i tried with it on, and w/o, but i keep getting back a Document that is null. what is required for a document to be made? can't i just do <sometag>blah</sometag>
and thats good enough?getting back a Document that is nullIf that means that the variable doc contains a null reference after you execute that statement, then most likely the statement is throwing an exception that you are ignoring. And that exception is probably because you're passing malformed XML to the parser... you have done some debugging to see what string you are passing to it, haven't you?
And why StringBufferInputStream? The whole class is deprecated. Better to use a StringReader instead:doc = db.parse(new InputSource(new StringReader(...)));(This is posted frequently on this forum but here it is yet again.)
Maybe you are looking for
-
Cannot send email from my iPad
The last few days I cannot send email from my iPad. I can receive normaly. Here is an image of the error I get. I get this error with every receipent... Please help
-
I can't get home sharing to turn on on my computers. I have a PC running windows XP that has a large library on it that I want to access from a newer windows 7 PC. I have turned home sharing on in both, same apple ID. I just will not come up. Any ide
-
I have two Macbooks that are connected to the same Comcast Wi-Fi network modem. One of the computers has become very sporadic in receiving the WI-FI signal while the other is unaffected. Both have same operating system (10.5.8). I have restarted comp
-
Error when running clone for app tier
Has anyone seen this? I'm getting the same error on each tier (seperate servers). I get a hit on Metalink but it does not match my situation. It states I'm missing a tag in the source context file but it is there. Any assistance would be appreciated.
-
Pre-Built EBS Analytics with BAM and EBS adapters on FM
Are there any pre-built business analytics dashboards/ reports installable in BAM SOA 11g for Oracle EBS 11.5.10? If so, where do I download and what other components are required to publish these? Thanks Edited by: user6739500 on May 21, 2010 3:08 P