Help!!! XML Parser and 8.1.6
Hello,
Is the XML parser certified on 8.1.6 for Solaris? I am getting an ORA-600 error when I use the call XMLDOM.WriteToClob.
Suggestions/ Comments????
Any help will be appreciated.
Thanks
Dinar
Hi,
Please post sample code listings that demonstrate this error so we can figure out what is the problem.
Thank you,
Oracle XML Team
Similar Messages
-
XML Parser and Content-type/encoding problem
I've write a little and simple XML parser and a simple "trasformer" that recive an XML file and an XSL one and return HTML, here is the code:
public static String toHTML(Document doc, String xslSource){
ByteArrayOutputStream testo = new ByteArrayOutputStream();
try{
DOMSource source = new DOMSource(doc);
TransformerFactory tFactory = TransformerFactory.newInstance();
System.out.println("----> " + xslSource);
Transformer transformer = tFactory.newTransformer(new StreamSource(xslSource));
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
transformer.setOutputProperty(OutputKeys.METHOD, "html");
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.transform(source, new StreamResult(testo));
}catch(Exception ioe){
System.out.println("2 XMLTool.toHTML " + new java.util.Date());
System.out.println(ioe);
return testo.toString();
}the problem is that I would like to put the HTML code its return into a JEditorPane; now I'm trying with this code:
JEditorPane jep1 = new JEditorPane();
jep1.setContentType("text/html");
jep1.setText(v);
// 'v' is the string returned by the code posted up (the XML/XSL transformer)but I can't see anything in my JEditorPane.
I think that the problem is this line of code that the transformer add automaticaly ad HTML code:
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">Infact if I try to delete this line from the code I can see what I want but is'n good delete a line of code without understend where is the problem.
So, can anyone help me?good.
when u set ur output properties to html , transformer
searches for all entity references and converts accordingly.
if u r using xalan these files will be used for conversion of
Character entity references for markup-significant
output_html.properties
(this should be in templates package)
and HTMLEntities.res(should be in serialize package)
vasanth-ct -
Hi,
I am trying to load the XML Parser and XSLT processor into the XDK that i have. Please can someone tell me how this is done. So far i keep hearing about classpath and .jar files. i have no idea what to do with these. Is there a manual which will tell me how to do this? Or can anyone explain to me?. Or can anyone tell me how to check if they are already there, the technican installed the software but does not know how to use it!, so i am very lost with this and am using it for my masters project.
Hope you can help.
ThanksHi,
I have checked the lib folder. xmlparsev2.jar is there. Is this the classpath? if not how do i get it to the classpath? and how do i do that?
Thanks for your help so far -
This is supposed to be an animated Help page. However, when Itry to click on it, it gives me the message:
Your browser does not seem to have the most updated XML parser.
Please use Microsoft Internet Explorer 5.5 or up for PointingTheWay features.
System Can Not Proceed any further.Unfortunately, it's a member-only page, with member id and password required. I'm trying to contact their IT dept., but without much luck, so far!
-
Xml parsing and report generation probs
Hello everyone,
I am facing with a peculiar problem.
I have an xml which contains special characters like �( cent) . So I parse it before i send it to the DOM parser. BufferedReader br = new BufferedReader(new InputStreamReader(inputFileName,"ISO-8859-1"));
and i have a function which replaces the cent with #xA2; .After i replace the special chars , i pass it to the parse method and i have some classes which update the database.the whole process works fine.
Now I have a report generation where i generate an HTML passing the string after the values are updated in the DB . So when i pass the string , and replace #xA2 with cent symbol, it is being interrupted as '?' in the windows and unix environment
This is something to do with the encoding.But my encoding is ISO-8859-1 as mentioned
Can you please help me out with this prob
Regards
KVI have some sympathy with you because I had problems with the cent sign in the XML world too. But not much... you have XML parsing going on, you're writing to a database, you're generating HTML, you have a manual hack for the cent sign. One or more of these things is causing you a problem. Do not try to test them all at once, like you are doing. Test only one thing at a time.
-
Oracle XML parser and IBM jdk bug
Hello,
From a few messages found in the XML forum it seems that IBM jvm could cause problems with oracle XML parser. ( see http://technet.oracle.com:89/ubb/Forum11/HTML/003823.html )
I am using IBM jvm (jdk 1.3) on a linux box, and problems are starting to arise:
I have
- 1 BC4J based jsp app which works fine.
- 2 XML parsing BC4J apps which cause strange errors (like parsing 40 documents fine and failing on the 41st for no apparent reason)
Hopefully, Steven Muench provided precious advice on this (basically, disabling the JIT), however some issues are still open:
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>You should file a bug with IBM to get this fixed, using your stylesheet as a testcase. Lots of people have hit this problem.<HR></BLOCKQUOTE>
Has anyone (from oracle or else) done this yet? I have gone (quickly) through IBM website but I didn't find any bug report utility or the like...
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Disable your JIT compiler (or switch JVM's) and you won't have the error.<HR></BLOCKQUOTE>
Turning off the JIT indeed made the errors vanish, thanks a lot for the tip!
I have a few more questions though :
* As the BC4J framework uses the xml parser, It is fairly possible that the ibm jvm bug will affect it...
I haven't had any problems (yet?) with the BC4J part of my applications, but I'm a bit concerned about having random bugs lurking around (I have more than enough of my own :) )
Has anyone stumbled upon IBM JVM vs oracle parser issues in BC4J? (oracle.xml.parser.v2.XXXXXX exceptions...)
* If BC4J is indeed affected, what's the solution?
- Disable the JIT? (And forget about performance?... hmmm... no)
- Switch parsers? (oracle parser is too tightly integrated in the BC4J Framework isn't it?.. hmm... not possible either)
- Wait for a patch from IBM (and use another one in the meantime) / switch JVM :
In either case, I'd really like to know what is the JVM that oracle people use / would advise.
Thanks for your help
nullFor those interested,
last week i reported this bug in the ibm jvm news forum.
They said that the problem had been investigated and would be fixed in their next service release.
FYI: the current release (SR7, labeled "build cx130-20010329) still has various problems wih oracle XML parser.
Remi
null -
SAX XML Parsing and Garbage Collection
I'm writing an XML parser that is running extremely slow while parsing large documents, I believe due to garbage collection. The implementation just overloads the DefaultHandler and hands that to a SAX Parser. This works fine on 2500 line XML document, taking on average a second or two, but becomes untennable when the document size is increased by a factor of 10 (often taking 5+ minutes).
I come from a C++ background and haven't dealt with automatic garbage collection at an expert level, so I'd appreciate any help. Below is a snapshot garbage collection done while a 25000 line document being parsed. It looks to me as the young objects are staying small, but older objects are going between 13M and 90M and back again. Is that what's happening? Can anyone give me leads as to what to look? Thanks in advance.
[GC [DefNew: 6234K->0K(7168K), 0.0057359 secs] 15517K->13022K(101696K), 0.0057907 secs]
[GC [DefNew: 6235K->0K(7168K), 0.0057748 secs] 19257K->16762K(101696K), 0.0060357 secs]
[GC [DefNew: 6235K->0K(7168K), 0.0023584 secs] 22997K->18009K(101696K), 0.0024123 secs]
[GC [DefNew: 6236K->0K(7168K), 0.0040785 secs] 24245K->20502K(101696K), 0.0041315 secs]
[GC [DefNew: 4990K->0K(7168K), 0.0041025 secs] 25492K->22996K(101696K), 0.0041544 secs]
[GC [DefNew: 4990K->0K(7168K), 0.0041486 secs] 27987K->25491K(101696K), 0.0042022 secs]
[GC [DefNew: 4991K->0K(7168K), 0.0040782 secs] 30481K->27985K(101696K), 0.0041299 secs]
[GC [DefNew: 4991K->0K(7168K), 0.0040935 secs] 32976K->30479K(101696K), 0.0046294 secs]
[GC [DefNew: 4991K->0K(7168K), 0.0041433 secs] 35471K->32974K(101696K), 0.0041958 secs]
[GC [DefNew: 4992K->0K(7168K), 0.0041114 secs] 37966K->35469K(101696K), 0.0041634 secs]
[GC [DefNew: 6240K->0K(7168K), 0.0024190 secs] 41709K->36717K(101696K), 0.0024729 secs]
[GC [DefNew: 6240K->0K(7168K), 0.0041377 secs] 42957K->39212K(101696K), 0.0041972 secs]
[GC [DefNew: 4993K->0K(7168K), 0.0041234 secs] 44205K->41707K(101696K), 0.0041762 secs]
[GC [DefNew: 4993K->0K(7168K), 0.0042827 secs] 46701K->44203K(101696K), 0.0046299 secs]
[GC [DefNew: 4994K->0K(7168K), 0.0043195 secs] 49197K->46699K(101696K), 0.0043751 secs]
[GC [DefNew: 4994K->0K(7168K), 0.0042740 secs] 51693K->49195K(101696K), 0.0043293 secs]
[GC [DefNew: 4995K->0K(7168K), 0.0042044 secs] 54190K->51692K(101696K), 0.0042575 secs]
[GC [DefNew: 4995K->0K(7168K), 0.0042237 secs] 56686K->54188K(101696K), 0.0042762 secs]
[GC [DefNew: 4996K->1K(7168K), 0.0040036 secs] 59183K->56685K(101696K), 0.0040550 secs]
[GC [DefNew: 4996K->1K(7168K), 0.0042095 secs] 61680K->59182K(101696K), 0.0045992 secs]
[GC [DefNew: 4997K->1K(7168K), 0.0042193 secs] 64178K->61679K(101696K), 0.0042715 secs]
[GC [DefNew: 4997K->1K(7168K), 0.0042301 secs] 66675K->64176K(101696K), 0.0042818 secs]
[GC [DefNew: 4997K->1K(7168K), 0.0042726 secs] 69173K->66674K(101696K), 0.0043251 secs]
[GC [DefNew: 4998K->1K(7168K), 0.0042564 secs] 71671K->69172K(101696K), 0.0043084 secs]
[GC [DefNew: 4998K->1K(7168K), 0.0040301 secs] 74169K->71669K(101696K), 0.0040812 secs]
[GC [DefNew: 4999K->1K(7168K), 0.0042656 secs] 76668K->74168K(101696K), 0.0047255 secs]
[GC [DefNew: 4999K->1K(7168K), 0.0043100 secs] 79166K->76666K(101696K), 0.0043737 secs]
[GC [DefNew: 5000K->1K(7168K), 0.0043492 secs] 81665K->79165K(101696K), 0.0044034 secs]
[GC [DefNew: 5000K->1K(7168K), 0.0043165 secs] 84164K->81664K(101696K), 0.0043693 secs]
[GC [DefNew: 5001K->1K(7168K), 0.0044196 secs] 86663K->84163K(101696K), 0.0044735 secs]
[GC [DefNew: 5001K->1K(7168K), 0.0044439 secs] 89163K->86662K(101696K), 0.0044967 secs]
[GC [DefNew: 5001K->1K(7168K), 0.0043983 secs] 91662K->89161K(101696K), 0.0045313 secs]
[GC [DefNew: 5002K->1K(7168K), 0.0043422 secs] 94162K->91661K(101696K), 0.0043944 secs]
[GC [DefNew: 5002K->1K(7168K), 0.0044223 secs] 96662K->94160K(101696K), 0.0044757 secs]
[GC [DefNew: 5002K->1K(7168K), 0.0048545 secs][Tenured: 96659K->9291K(97032K), 0.0863445 secs] 99162K->9291K(104200K), 0.0913954 secs]I don't think I'm creating megabytes of data, not using hashes or other expandable arrays. I've copied and pasted some code from my overriding of a DefaultHandler to give better definition to the problem.
I'm working with TPTP right now as a profiler. Are there any others you'd recommend?
public void startElement(String uri, String localname, String qName, Attributes attribs)
throws SAXException
if(qName.equals("Line"))
attributes = attribs;
else if(qName.equals("Note"))
attributes = attribs;
else if(qName.equals("Selection"))
String idValue = attribs.getValue("id");
String oValue = attribs.getValue("off");
String lValue = attribs.getValue("len");
if(idValue != null && oValue != null && lValue != null)
if(isImport)
issueSelectionContainer.addUnloadedSelection(Integer.parseInt(idValue), Integer.parseInt(oValue), Integer.parseInt(lValue));
else
issueSelectionContainer.addSelection(Integer.parseInt(idValue), Integer.parseInt(oValue), Integer.parseInt(lValue));
else if(qName.equals("Issue"))
attributes = attribs;
if(qName.equals("IsFinal"))
isFinal = true;
public void endElement(String uri, String localname, String qName)
throws SAXException
if(textElement.length() > 0)
if(qName.equals("Line"))
String qmValue = attributes.getValue("qm");
String lnValue = attributes.getValue("ln");
String pgValue = attributes.getValue("pg");
boolean qm = (qmValue != null && qmValue.equalsIgnoreCase("true"));
short ln = (lnValue != null) ? Short.parseShort(lnValue) : 0;
short pg;
if(pgValue != null)
pg = Short.parseShort(pgValue);
page = pg;
else
pg = page;
lineContainer.addLine(textElement + '\n', ln, pg, qm, null);
else if(qName.equals("Note"))
String lnValue = attributes.getValue("line");
if(lnValue != null)
int line = Integer.parseInt(lnValue);
try
lineContainer.getLine(line).setNote(textElement);
catch (IndexOutOfBoundsException e)
throw new SAXException("XML/Data mismatch. Note on line \"" + line + "\" out of \"" + lineContainer.lineCount() + "\" lines", e);
else if(qName.equals("Issue") && isImport)
String idValue = attributes.getValue("id");
String cValue = attributes.getValue("color");
if(idValue != null && cValue != null)
issueSelectionContainer.addUnloadedIssueSelection(Integer.parseInt(idValue), new Color(Integer.parseInt(cValue)), textElement);
else if(qName.equals("Name"))
name = textElement;
else if(qName.equals("Description"))
description = textElement;
else if(qName.equals("CreationDate"))
date = getCalendarFromString(textElement);
textElement = "";
attributes = null;
public void characters(char buf[], int offset, int len)
throws SAXException
textElement = new String(buf, offset, len);
} -
Hi-
I'm trying to use the latest Xercies/Xalan classes in OC4J 10.1.3 as described in the How-To swap XML Parsers document:
http://www.oracle.com/technology/tech/java/oc4j/1013/how_to/how-to-swapxmlparser/doc/readme.html
What I can see happening is that the oracle.xml shared library is successfully 'turned off', but the xalan libraries are not added. Instead, the default xml classes that are distributed with the JDK become visible. For instance, using a slightly modified version of the index.jsp page from the how-to, I get this result:
------ Output from JSP page ----------------
TransformerFactory Instance: org.apache.xalan.processor.TransformerFactoryImpl
Transformer Instance: org.apache.xalan.transformer.TransformerIdentityImpl
Transformer Version: Xalan Java 2.4.1 (!!)
What I expect is for that last line to say version 2.7.0, which is the version of the xalan.jar included in my shared library (code to add that line to the how-to shown below).
I suspect what is happening is that the class loader is simply not letting a shared library override a system library - to do that you probably need to place the jar files in system endorsed directory.
Has anyone gotten this how-to to work - actually replacing the XML parser/transform classes with the latest Xalan classes? Are you sure it is seeing the current version you placed in the shared library?
Thanks,
Eric Everman
---- My modified getXSLTDetails() method in the index.jsp page of the how-to -------
<!-- Additional Import -->
<%@ page import="org.apache.xalan.Version" %>
public static String getXSLTDetails()
Transformer transformer=null;
TransformerFactory transformerfactory = TransformerFactory.newInstance();
Version ver = null;
String br = "<" + "br" + ">"; //otherwise the otn forum chocks on the break.
try
transformer = transformerfactory.newTransformer();
ver = (Version) transformer.getClass().forName("org.apache.xalan.Version").newInstance();
String ret_val =
"TransformerFactory Instance: "+transformerfactory.getClass().getName() + br +
"Transformer Instance: "+transformer.getClass().getName() + br;
if (ver != null) {
ret_val = ret_val + "Transformer Version: " + ver.getVersion() + br;
} else {
ret_val = ret_val + "Transformer Version not Available" + br;
return ret_val;
catch (Exception e)
e.printStackTrace();
return e.getMessage();
}--------------------------------------------------------------------Steve - Thanks for responding on this.
The Xalan SQL extension is built into Xalan. The most painless way to try it out is to run it via JEdit: www.jedit.org
JEdit a OS Java application with a fairly painless install process (I'm assuming you already have a current JRE installed). Once its installed, you'll need to install the XSLT plugin - in JEdit goto Plugins | Plugin Manager | Install and pick the XSLT plugin. You'll need the Oracle JDBC classes on your classpath - this can be done by copying the oracle_jdbc4.jar into the [JEdit install directory]/jars directory.
Restart to load that jar and you should be all set.
I included a sample XSLT page at the bottom of this post that is somewhat of a template transform for the SQL extension - its more complicated then it needs to be, but it does some nice things with the results of the query. Save it as a file and make the appropriate changes to the 'datasource' parameter near the top of the file.
Then in JEdit, open the file and make sure the XSLT plugin is visible (Plugins | XSLT | XSLT Processor Toggle - or alternately dock it in the window via global prefs). In the XSLT plugin: Allow the current buffer to be used as the source, Add that same file as a stylesheet via the '+' button, and pick a result file at the bottom. Then click the 'Transform XML' button.
Troubleshooting: I seem to remember having some classpath errors when I tried this on windows, but others have had it work w/o issues. I do remeber that the XSLT plugin had a popup window that gave a pretty good explaintion of the problem, if it occurs. Also, for some reason the XSLT plugin will not create a new file for the output, so its often best to create a file first, then choose it as the output. Of course, you can always run a transformation from the command line or w/in an applicatoin. Full docs on the Xalan SQL extension can be found at: http://xml.apache.org/xalan-j/extensionslib.html#sql
Here is my sample XSLT transform using the SQL extension:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sql="http://xml.apache.org/xalan/sql"
xmlns:str="http://exslt.org/strings"
xmlns:xalan="http://xml.apache.org/xalan"
extension-element-prefixes="sql str xalan">
<xsl:output indent="yes"/>
<xsl:param name="driver">oracle.jdbc.OracleDriver</xsl:param>
<xsl:param name="datasource">jdbc:oracle:thin:jqpublic/jqpublic@server_name:1521:dbname</xsl:param>
<xsl:param name="jndiDatasource"><!-- jndi source for production use w/in enterprise environment --></xsl:param>
<xsl:param name="debug">true</xsl:param>
<xsl:variable name="connection" select="sql:new()"/>
<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
<xsl:variable name="lowercase" select="'abcdefghijklmnopqrstuvwxyz'"/>
<!--
The query: You could pass parameters in to this query to build a where clause, but here is a simple example.
Also, its nice to wrap the query with a max row number to prevent huge results.
-->
<xsl:param name="query">
select * from (
SELECT
'One' FIELD_1,
'Two' FIELD_2
FROM DUAL
) where rownum < 100
</xsl:param>
<!-- Essentially, create a XConnection object -->
<xsl:variable name="connection" select="sql:new()"/>
<xsl:template match="/">
<xsl:choose><!-- Connect using JNDI -->
<xsl:when test="$jndiDatasource != ''">
<xsl:if test="not(sql:connect($connection, $jndiDatasource))">
<xsl:message>Failed to connect to db via jndi connection</xsl:message>
<xsl:comment>Failed to connect to db via jndi connection</xsl:comment>
<xsl:if test="$debug = 'true'">
<xsl:copy-of select="sql:getError($connection)/ext-error"/>
</xsl:if>
</xsl:if>
</xsl:when>
<xsl:otherwise><!-- Connect using connection string -->
<xsl:if test="not(sql:connect($connection, $driver, $datasource))">
<xsl:message>Failed to connect to db via driver/url connection</xsl:message>
<xsl:comment>Failed to connect to db via driver/url connection</xsl:comment>
<xsl:if test="$debug = 'true'">
<xsl:copy-of select="sql:getError($connection)/ext-error"/>
</xsl:if>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<!--
The results of the query. The rowset is brought back in 'streaming' mode,
so its not possible to ask it for the number of rows, or to check for zero
rows. There is a switch to disable streaming mode, but this requires all
rows to be brought into memory.
-->
<xsl:variable name="table" select="sql:query($connection, $query)"/>
<xsl:if test="not($table)">
<xsl:message>Error in Query</xsl:message>
<xsl:copy-of select="sql:getError($connection)/ext-error"/>
</xsl:if>
<page>
<!-- Your xalan environment -->
<xsl:copy-of select="xalan:checkEnvironment()"/>
<!-- Build a bunch of metadata about the rows -->
<meta>
<cols>
<xsl:apply-templates select="$table/sql/metadata/column-header"/>
</cols>
</meta>
<rowset>
<!--
With streaming results, you must use the apply-temmplates contruct,
not for-each, since for-each seems to attempt to count the rows, which
returns zero.
-->
<xsl:apply-templates select="$table/sql/row-set"/>
</rowset>
</page>
<xsl:value-of select="sql:close($connection)"/><!-- Always close -->
</xsl:template>
<xsl:template match="row">
<row>
<xsl:apply-templates select="col"/>
</row>
</xsl:template>
<xsl:template match="column-header">
<col>
<xsl:attribute name="type">
<xsl:value-of select="@column-typename"/>
</xsl:attribute>
<xsl:attribute name="display-name">
<xsl:call-template name="create-display-name"/>
</xsl:attribute>
<xsl:value-of select="@column-name"/>
</col>
</xsl:template>
<!-- Convert column names to proper caps: MY_FIELD becomes My Field -->
<xsl:template name="create-display-name">
<xsl:variable name="col-name">
<xsl:for-each select="str:tokenize(@column-name, '_')">
<xsl:value-of
select="concat(translate(substring(., 1, 1), $lowercase, $uppercase), translate(substring(.,2), $uppercase, $lowercase), ' ')"/>
</xsl:for-each>
</xsl:variable>
<xsl:value-of select="substring($col-name, 1, string-length($col-name) - 1)"/>
</xsl:template>
<!-- Creates data columns named 'col' with a column-name attribute -->
<xsl:template match="col">
<col>
<xsl:attribute name="column-name"><xsl:value-of select="@column-name"/></xsl:attribute>
<xsl:value-of select="."/>
</col>
</xsl:template>
</xsl:stylesheet> -
Oracle XML parser and schema validation
Hi Forum,
I have problem parsing XML with validation against XML schema. I define location of schema (URL) in xml file and Oracle parser could not find the schema (xml file is correct - checked in other programs). When I point to xml schema directly from Java (using parser.setXMLSchema) before calling parser.parse, it works just fine. Where is the problem? Does oracle parser works correctly with XML Schema?
TIA,
AlexSAXParser saxParser=new SAXParser();
saxParser.setValidationMode(XMLParser.SCHEMA_VALIDATION);
Specify a Schema to validate a XML document with, for the SAXParser.
saxParser.setXMLSchema(SchemaUrl);
DefaultHandler handler=new DefaultHandler();
saxParser.setErrorHandler(handler);
Parse the XML document to validate with the XML schema.
saxParser.parse(XmlDocumentUrl); -
Help on parsing and storing XML data
Hi :
I have a huge file with a format similar to this.
<EmployeeDB>
<employee>
<name>Steve</name>
<salary>20000</salary>
<address>898 nobel drive</address>
<city>san diego</city>
</employee>
<employee>
<name>Ray</name>
<salary>20000</salary>
<address>898 nobel drive</address>
<city>san diego</city>
</employee>
<employee>
<name>Prag</name>
<salary>20000</salary>
<address>898 nobel drive</address>
<city>san diego</city>
</employee>
</EmployeeDB>
I have a table in my database with 2 columns one is a nsystem generated id and another column is of xmlType.
What I want to do is store each employee's XML as a seperate record.
For example: My table data should look like this
EmployeeID(Number) EmployeeXML (XMLType)
1 <employee>
<name>Steve</name>
<salary>20000</salary>
<address>898 nobel drive</address>
<city>san diego</city>
</employee>
2 <employee>
<name>Ray</name>
<salary>20000</salary>
<address>898 nobel drive</address>
<city>san diego</city>
</employee>
What I need is a code to take the document and insert the records as above.
Please send me the code if you have to [email protected]Yes, I am using oralce 9i release 2
-
Help on parsing and storing XML file
Hi :
I have a huge file with a format similar to this.
<EmployeeDB>
<employee>
<name>Steve</name>
<salary>20000</salary>
<address>898 nobel drive</address>
<city>san diego</city>
</employee>
<employee>
<name>Ray</name>
<salary>20000</salary>
<address>898 nobel drive</address>
<city>san diego</city>
</employee>
<employee>
<name>Prag</name>
<salary>20000</salary>
<address>898 nobel drive</address>
<city>san diego</city>
</employee>
</EmployeeDB>
I have a table in my database with 2 columns one is a nsystem generated id and another column is of xmlType.
What I want to do is store each employee's XML as a seperate record.
For example: My table data should look like this
EmployeeID(Number) EmployeeXML (XMLType)
1 <employee>
<name>Steve</name>
<salary>20000</salary>
<address>898 nobel drive</address>
<city>san diego</city>
</employee>
2 <employee>
<name>Ray</name>
<salary>20000</salary>
<address>898 nobel drive</address>
<city>san diego</city>
</employee>
What I need is a code to take the document and insert the records as above.
Please send me the code if you have to [email protected]Yes, I am using oralce 9i release 2
-
XML Parsing and creating objects..
I need to create objects with the value present in the XML file under a specific tag.
E.g.:
XML file:
<employees.
<employee>
<name>
<first>Chandan</first>
<last>Sharma</last>
</name>
<empid>1212</empid>
<dept>Telecom</dept>
</employee>
<employee>
<name>
<fitst>First</first>
<last>Last</last>
</name>
<empid>100</empid>
<dept>Dept</dept>
</employee>
</employees>
There may be tags other than <employees> in the XML file.
I need to parse this file and create objects of class
Employees{
String firstName,lastName,empid,dept;
Please help me.
As I am new with this, it would be better if you provide me some with code.
Thanks & Regards,
Chandan SharmaYou can od it using SAX of course but the implementation is completely different. As I haven't used any SAX approach for many years, I can't provide you any example but you should find many of them either with google or by downloading any java implementation (like Xerces, Xalan...)
The better solution depends on your needs. That's the standard answer, I know :)
when you use DOM, you load the entire content of the file in the memory. and then you travel through the JAVA structure that has been created by using the methods I gave you.
When you use SAX, you define a listener for your parser that will be called any time the parser finds something interesting. a new node, a new attribute, a new node content... sometimes it's a pain to implement.
In my opinion if your application will only handle one message at a time, you should keep the DOM approach because I don't think there will be any big difference in time processing. On the other hand if your application will potentially manage multiple messages at the same time, then your computer memory can be overloaded by a DOM approach and the you will face bad performances, in such case use the SAX approach.
as a conclusion, the best way to make a decision is to run benchmarks. good luck :)
Marc -
Xml parsing and checking for certain elements
Hi,
I need your help on how to parse an xml and check for certain elements
in the xm. Can any one help on this regard. If you can pls send me the sample code for this one.
Thanks and Regards,
Srinihttp://java.sun.com/xml/tutorial_intro.html
-
XML Parser and memory utilization
I am using the sample given with
the PL/SQL Parser to transform a
1.5M file. When the document is
parsed Oracle's memory resources
increase 50M until the system
runs out of virtual memory and
errors out. If I decrease the
size of the file to ~750K it
works ok. When I use Saxon to
transform the file it uses ~10M.
Is there anyway to get the Oracle
parser to better utilize memory,
or am I missing some point?
sgHi,
I have checked the lib folder. xmlparsev2.jar is there. Is this the classpath? if not how do i get it to the classpath? and how do i do that?
Thanks for your help so far -
hi,
i have a JSP.
this JSP has the following code..
Relevant code snippet...
<form name="myform" action="Parse.jsp" method="post" target="newWin" onsubmit="return doSubmit(this);">
<input type="hidden" name="xmldata" value=<%=array[1]%>> // array[1] is an XML string returned by a class method.
<input type="submit" value="Parse the xml">
</form>
<script>
function doSubmit(formObj) {
window.open('','newWin','scrollbars=0,menubar=0,toolbar=0,location=0,status=0');
return true;
</script>this Parse.jsp wants to perse the XML given to it....
the problem is this Parse.jsp never gets the proper xml....because you know i have the value=<%=array[1]%> in the above and this is corrupting the XML.
so, problem is how can open a pop up and send the XML string from its parent window ?please code sample ? demo code is enough to try
with.This has nothing to do with samples. You should know
which encodings you use. You decalre it in the HTML
i have not mentioned encoding in the HTML.
by html encoding , i think you mean this (bold letter)
// created by dreamweaver 2004
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
</body>
</html>if you mean that...NO, I DID NOT USE that thing in my JSP. i deleted that.
and XML headers. XML encoding, i have this at the start of XML....
<?xml version="1.0" encoding="ISO-8859-1" ?>
// XML data
Java, if nothing else is said, uses
UTF16.
in my form i have method="post".And what do you receive? What does "corrupted" mean?
Not well-formed? Garbage characters? Truncated?error message: [STDOUT] xmlStringelectric.xml.ParseException: java.io.IOException: could not find 59 line 1, char 46682:
NO, i dont blame my parser. if i provide the XML seperately, then my parser works fine.
but when i send the XML via JSP to the parser it does not work.
that means sending of XML is making some trouble.
Maybe you are looking for
-
This has to do with the comparison between the iPhone and the iPod Touch. I know all the features are the same, but what about the battery?! Does the iPod Touch have a battery that is not rechargable like the iPhone? Because I heard that is the main
-
HT1351 Why do I have ! next to some of my songs and they dont sync?
Why do I have ! next to some of my songs and they dont sync?
-
Smart Menu: I accidentally uninstalled this. How do I get it back?
I was uninstalling some malware which had piggy backed its way into my computer. I believe this is what gave me a gear shaped symbol in my lower left hand corner providing easy access to my documents, systems, etc. I would like it back. I located
-
App tabs are not working. I right click, but no app tab option appears.
I right clicked on a tab to create an app tab, but there was no option for an app tab. Just the name of the program on the tab.
-
I can't download 3.6 without up[grading
I have tried to download the 3.6 version of firefox and it always wants me to upgrade to Friefox 4 beta 12. I don't want the Firefox 4 Beta 12. I want the older version . How can I accomplish that ???