Importing/Parsing XML
I have posted the following thread in the SQL/PLSQL forum and would appreciate your input as it is realted to XML.
Re: Importing/Parsing XML using SQL and/or PL/SQL
Thanks in advance for your help
David
Message was edited by:
David Ferguson
Hi David, please do visit the XML DB forum. There is an Oracle guy named Mark Drake and he is very good at this stuff. To your questions, yes, Oracle XML DB can handle any type of XML no matter how many levels you have. Check out the XMLTable function in the Oracle XML user's guide and it is pretty powerful. The trick is that it is hard if not impossible to combine singletons and multiples, because multiples require its own handling. I have to deal with this a lot. In some cases, I can use two xmltables, one for the multiples and one for the singlton, repeating the singleton for each of the multiples in one table. In other cases I just do two steps: get the multiples and singltons separately. You will find that using the global temporary table for this type of xml processing comes handy. At our place, some people use BizTalk to "map, orchestrate, factor and re-factor" xml messages from a partner, but I use Oracle XML DB. I have completed all available xml messages (more than 20) in just a short time, but it took the BizTalk consultants almost 5 months to finish one simple xml message! When I say Oracle does a beautiful job, they are not happy so they tell me that I should have been an Oracle salesman.
Ben
Similar Messages
-
Importing/Parsing XML using SQL and/or PL/SQL
What is the recomended way of importing/parsing XML data using SQL and/or PL/SQL?
I have an XSD that defines the structure of the file, and an XML file that has the content in the appropriate structure. I have parsed (checked) the structure of the XML file using JDOM in my java application, and then passed it to a function in a package on the database as a CLOB.
What I need to do is parse the contents of the XML file that is passed into the function and extract the values of each XML element so that I can then do some appropriate validation before inserting and committing the data to the database (hence completing the import function).
A DBA colleague of mine has been experimenting with various ways of acheiving this, but has encountered a number of problems along the way, one of which being that he thinks that it is not possible to parse XML elements that are nested more than four levels deep - is this the case?
The structure of the XSD/XML that the database function needs to manipulate and import data from is very complex (and recursive by it's nature).
I would appreciate any suggestions as to how I can achieve the above in the most efficient manner.
Thanks in advance for your help
DavidThis is the forum for the SQLDeveloper tool. You will get better answers in the SQL and PL/SQL forum, and especially the XML DB forum.
Oracle has comprehensive and varied support for XML, including a PL/SQL parser. -
How to parse xml and import to execel
pls let me know how to parse XML file and import all data to execel sheet.
Hi Mandya,
This is outside of the normal use case for TestStand. It would be best to use a code module (developed in LabVIEW, C, or any other language) to accomlish this and then call it from a step in TestStand. You can find examples on ActiveX here:
http://forums.ni.com/t5/NI-TestStand/Controlling-Excel-from-TestStand-with-Activex-Automation/td-p/1...
I hope this helps.
Frank L.
Software Product Manager
National Instruments -
Parsing XML and Storing values in instance variable
hi,
i'm new to XML.
here i'm trying to parse an XML and store their element data to the instance variable.
in my main method i'm tried to print the instance variable. but it shows "" (ie it print nothing ).
i know the reason, its becas of the the endElement() event generated and it invokes the characters() and assigns "" to the instance variable.
my main perspective is to store the element data in instance variable.
thanks in advance.
praks
import java.io.*;
import java.net.*;
import java.util.*;
import javax.xml.parsers.*;
import org.xml.sax.*;
import org.xml.sax.helpers.*;
public class mysax extends DefaultHandler
String ctelement;
CharArrayWriter contents;
String vname1,vrcbreg1,vaddress1,vcountry1,vtelephone1,vfax1;
String vname,vrcbreg,vaddress,vcountry,vtelephone,vfax;
public mysax()
vname1 = null;
vrcbreg1 = null;
vaddress1 = null;
vcountry1 = null;
vtelephone1 = null;
vfax1 = null;
contents= new CharArrayWriter();
public void doparse(String url) throws Exception
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
ParserAdapter pa = new ParserAdapter(sp.getParser());
pa.setContentHandler(this);
pa.parse(url);
public void startElement(String namespace,String localName,String qName,Attributes atts)
ctelement = localName;
public void endElement(String uri,String localName,String qName) throws SAXException
public void characters(char[] ch,int start, int length) throws SAXException
try
if(ctelement.equals("name"))
vname = new String (ch,start,length);
System.out.println("The method "+vname1);
}catch (Exception e)
System.out.println("The exception "+e);
public static void main(String args[])
try
mysax ms = new mysax();
ms.doparse(args[0]);
System.out.println("the contents name "+ms.vname1);
catch(Exception e)
System.out.println("this is exception at main" +e);
my XML looks like
<coyprofile_result>
<company>
<name>abcTech</name>
<rcbreg>123456789</rcbreg>
<address>Singapore</address>
<country>sg</country>
<telephone>123456</telephone>
<fax>123155</fax>
</company>
</coyprofile_result>I believe that the problem has to do with the value you assign to ctelement. You are assigning the value of localName to ctElement, however for the element: <name>...</name> the localname is empty string i.e. "", but qName equals "name". Because you are assigning empty string to ctElement, when you do the comparison in characters of ctElement to "name" it will always be false. So in startElement change it to ctElement = qName; Try it and see if it works. I have produced similar programs and it works for me.
Hope this helps. -
Getting Error while creating Document object after parsing XML String
Hi All,
I have been trying to parse an XML string using the StringReader and InputSource interface but when I am trying to create Document Object using Parse() method getting error like
[Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
Please find the code below which i have been experimenting with:
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.StringReader;
import java.util.List;
import java.util.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import java.io.*;
public class TestMain {
public static void main(String[] args) {
String file = "";
file = loadFileContent("C:\\Test.xml");
System.out.println("contents >> "+file);
parseQuickLinksFileContent(file);
public static void parseQuickLinksFileContent(String fileContents) {
PWMQuickLinksModelVO objPWMQuickLinksModelVO = new PWMQuickLinksModelVO();
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
StringReader objRd = new StringReader(fileContents);
InputSource objIs = new InputSource(objRd);
Document document = builder.parse(objIs); // HERE I am getting Error.
System.out.println(document.toString());
What is happening while I am using builder.parse() method ???
Thanks,
Rajendra.Getting following error
[Fatal Error] :2:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
seorg.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed. -
Getting Error while importing catalog xml
Hi ,
i am new to ATG.
I am getting the below error when i tried to import the xml.
D:\ATG\ATG9.0\home>bin\startSQLRepository -m DynamusicB2C -import ..\DynamusicB2C\config\dynamusic\DynamusicB2CData.xml -repository /atg/commerce/catalog/ProductCatalog
**** info Thu Oct 25 18:05:27 GMT+05:30 2012 1351168527562 /DPSLicense atg.service.ServiceResources->dynamoPrintM
axSessions : Only 20 concurrent sessions can be managed with this license
**** info Thu Oct 25 18:05:27 GMT+05:30 2012 1351168527578 /DPSLicense atg.service.ServiceResources->dynamoPrintM
axDynamoServers : Only 3 Dynamo server(s) can be used concurrently with this license
**** info Thu Oct 25 18:05:27 GMT+05:30 2012 1351168527593 /DPSLicense DPS is licensed to Sprint/United Managemen
t Company - Development
**** info Thu Oct 25 18:05:27 GMT+05:30 2012 1351168527593 /DPSLicense atg.service.ServiceResources->unlimitedLic
enseMsg : This product is licensed for an unlimited number of CPUs.
Nucleus running
*** unable to find GSARepository component: /atg/commerce/catalog/ProductCatalog in configpath: D:\ATG\ATG9.0\DAS\config\config.ja
r;D:\ATG\ATG9.0\DAS\config\oca-ldap.jar;vfs[localconfig-1]=/atg/dynamo/service/groupconfig/ClientNodeTypeVirtualFileSystem;vfs[loc
alconfig-1]=/atg/dynamo/service/groupconfig/ClientInstanceVirtualFileSystem;D:\ATG\ATG9.0\DPS\config\targeting.jar;D:\ATG\ATG9.0\D
PS\config\oca-cms.jar;D:\ATG\ATG9.0\DPS\config\oca-html.jar;D:\ATG\ATG9.0\DPS\config\oca-xml.jar;D:\ATG\ATG9.0\DPS\config\userprof
iling.jar;D:\ATG\ATG9.0\DPS\config\profile.jar;D:\ATG\ATG9.0\DSS\config\config.jar;..\DAS\config\dtmconfig.jar;localconfig;..\DAF\
config\dafconfig.jar
Usage: startSQLRepository <xml-file1> ... <xml-filen> [args]
Starts a GSA repository and executes a set of XML commands.
The startSQLRepository command instantiates a repository and
optionally parses one or more XML files you specify. You
can use it to validate your template definition files,
generate default SQL for your template and import or export
data from your repository. You must specify the -repository
option. All other options are optional.
Pls guide me to succeed the above one.
Thanks and Regards,
Bala P.
Edited by: 967647 on Oct 25, 2012 6:08 AMIn place of ..\DynamusicB2C\config\dynamusic\DynamusicB2CData.xml just use \dynamusic\DynamusicB2CData.xml [path after config].
-RMishra -
Need help on parsing xml file...
Hi all,
I need to collect some data from an Xml file using java. I have the following code with me but I am unable to get the required result. I am unable to get the data from the tags belonging to the header and footer elements. Please find the code and the sample xml file below.
Program to parse XML:
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class JobLogDetails3{
//No generics
List myJobs;
Document dom;
public JobLogDetails3(){
//create a list to hold the job objects
myJobs = new ArrayList();
public void runJobDetails() {
//parse the xml file and get the dom object
parseXmlFile();
//get each joblog element and create a job object
parseDocument();
//Iterate through the list and print the data
printData();
private void parseXmlFile(){
//get the factory
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
//Using factory get an instance of document builder
DocumentBuilder db = dbf.newDocumentBuilder();
//parse using builder to get DOM representation of the XML file
dom = db.parse("test.xml");
}catch(ParserConfigurationException pce) {
pce.printStackTrace();
}catch(SAXException se) {
se.printStackTrace();
}catch(IOException ioe) {
ioe.printStackTrace();
private void parseDocument(){
//get the root elememt
Element docEle = dom.getDocumentElement();
//get a nodelist of <joblog> elements
NodeList nl = dom.getElementsByTagName("*");
if(nl != null && nl.getLength() > 0) {
for(int i = 0 ; i < nl.getLength();i++) {
//get the joblog element
Element el = (Element)nl.item(i);
//get the joblog object
Job J = getJob(el);
//add it to list
myJobs.add(J);
* I take an joblog element and read the values in, create
* an joblog object and return it
* @param JobEl
* @return
private Job getJob(Element JobEl) {
//for each <joblog> element get text or int values of
//name ,id, age and name
String jobServer = getTextValue(JobEl,"server");
String jobName = getTextValue(JobEl,"name");
String jobClient = getTextValue(JobEl,"machine_name");
String jobStart = getTextValue(JobEl,"start_time");
String jobType = getTextValue(JobEl,"type");
String jobEnd = getTextValue(JobEl,"end_time");
String jobSize = getTextValue(JobEl,"new_processed_bytes");
//Create a new Job with the value read from the xml nodes
Job J = new Job(jobServer,jobName,jobClient,jobStart,jobType,jobEnd,jobSize);
return J;
* I take a xml element and the tag name, look for the tag and get
* the text content
* i.e for <employee><name>John</name></employee> xml snippet if
* the Element points to employee node and tagName is name I will return John
* @param ele
* @param tagName
* @return
private String getTextValue(Element ele, String tagName) {
String textVal = null;
NodeList nl = ele.getElementsByTagName(tagName);
if(nl != null && nl.getLength() > 0) {
Element el = (Element)nl.item(0);
textVal = el.getFirstChild().getNodeValue();
return textVal;
* Calls getTextValue and returns a int value
* @param ele
* @param tagName
* @return
private int getIntValue(Element ele, String tagName) {
//in production application you would catch the exception
return Integer.parseInt(getTextValue(ele,tagName));
* Iterate through the list and print the
* content to console
private void printData(){
System.out.println("No of Jobs '" + myJobs.size() + "'.");
Iterator it = myJobs.iterator();
while(it.hasNext()) {
System.out.println(it.next().toString());
public static void main(String[] args){
//create an instance
JobLogDetails JLD = new JobLogDetails();
//call run example
JLD.runJobDetails();
Job Class
public class Job {
private String jobServer;
private String jobName;
private String jobClient;
private String jobStart;
private String jobType;
private String jobEnd;
private String jobSize;
public Job(){
public Job(String jobServer,String jobName,String jobClient,String jobStart,String jobType,String jobEnd,String jobSize ) {
this.jobServer = jobServer;
this.jobName = jobName;
this.jobClient = jobClient;
this.jobStart = jobStart;
this.jobType = jobType;
this.jobEnd = jobEnd;
this.jobSize = jobSize;
public String getjobServer() {
return jobServer;
public void setjobServer(String jobServer) {
this.jobServer = jobServer;
public String getjobName() {
return jobName;
public void setjobname(String jobName) {
this.jobName = jobName;
public String getjobClient() {
return jobClient;
public void setjobClient(String jobClient) {
this.jobClient = jobClient;
public String getjobStart() {
return jobStart;
public void setjobStart(String jobStart) {
this.jobStart = jobStart;
public String getjobType() {
return jobType;
public void setjobType(String jobType) {
this.jobType = jobType;
public String getjobEnd() {
return jobEnd;
public void setjobEnd(String jobEnd) {
this.jobEnd = jobEnd;
public String getjobSize() {
return jobSize;
public void setjobSize(String jobSize) {
this.jobSize = jobSize;
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(getjobServer());
sb.append(",");
sb.append(getjobName());
sb.append(",");
sb.append(getjobClient());
sb.append(",");
sb.append(getjobType());
sb.append(",");
sb.append(getjobStart());
sb.append(",");
sb.append(getjobEnd());
sb.append(",");
sb.append(getjobSize());
sb.append(",");
return sb.toString();
Sample XML File:
<?xml version="1.0" encoding="UTF-16" ?>
- <joblog>
<job_log_version version="2.0" />
- <header>
<filler>======================================================================</filler>
<server>Job server: TGBBAK</server>
<name>Job name: TGBSAP4-SQL-SQL DB Servers S2T - High-Weekly Full Backup</name>
<start_time>Job started: 26 September 2011 at 01:00:04</start_time>
<type>Job type: Backup</type>
<log_name>Job Log: GFD_TGBBAK_71887.xml</log_name>
<filler>======================================================================</filler>
</header>
<media_mount_date>Drive and media mount requested: 26/09/2011 01:00:04</media_mount_date>
- <media_drive_and_media_info>
<media_mount_date>Drive and media information from media mount: 26/09/2011 01:00:39</media_mount_date>
<robotic_library_name>Robotic Library Name: HP 1</robotic_library_name>
<drive_name>Drive Name: LTO4_2</drive_name>
<slot>Slot: 43</slot>
<media_label>Media Label: 000059L</media_label>
<media_guid>Media GUID: {a6ca0062-7a6f-4b4b-8144-732ca25f2f9d}</media_guid>
<media_overwrite_date>Overwrite Protected Until: 25/10/2011 19:24:58</media_overwrite_date>
<media_append_date>Appendable Until: 02/10/2011 14:00:30</media_append_date>
<media_set_target>Targeted Media Set Name: Weekly Tape</media_set_target>
</media_drive_and_media_info>
- <backup>
<filler>======================================================================</filler>
<title>Job Operation - Backup</title>
<append_or_overwrite>Media operation - append.</append_or_overwrite>
<compression>Compression Type: Hardware [if available, otherwise none]</compression>
<verify_option>WARNING: The option 'Verify after backup completes' was not selected. Performing a verify operation to make sure that media can be read after the backup has completed is recommended.</verify_option>
<filler>======================================================================</filler>
- <machine>
<machine_name>TGBSAP4.Tetley.Grp</machine_name>
<info>Network control connection is established between 10.22.2.18:3271 <--> 10.22.2.4:10000</info>
<info>Network data connection is established between 10.22.2.18:3301 <--> 10.22.2.4:3094</info>
- <set>
<set_resource_name>TGBSAP4.Tetley.Grp</set_resource_name>
<tape_name>Family Name: "Media created 25/09/2011 13:59:55"</tape_name>
- <volume>
<display_volume>Backup of "TGBSAP4.Tetley.Grp "</display_volume>
</volume>
<description>Backup set #45 on storage media #1 Backup set description: "Weekly Full Backup"</description>
<backup_type>Backup Method: Full - Back up entire database or filegroup</backup_type>
<agent_started>Microsoft SQL Server Agent: Started</agent_started>
<start_time>Backup started on 26/09/2011 at 01:01:45.</start_time>
- <database>
<database>Database PRD</database>
</database>
- <database>
<database>Database master</database>
</database>
- <database>
<database>Database model</database>
</database>
- <database>
<database>Database msdb</database>
</database>
<end_time>Backup completed on 26/09/2011 at 02:42:25.</end_time>
- <summary>
<backed_up_database>Backed up 4 databases</backed_up_database>
<new_processed_bytes>Processed 573363576542 bytes in 1 hour, 40 minutes, and 40 seconds.</new_processed_bytes>
<vlm_hist_rateformat2>Throughput rate: 5432 MB/min</vlm_hist_rateformat2>
</summary>
<filler>----------------------------------------------------------------------</filler>
</set>
</machine>
</backup>
- <footer>
<filler>======================================================================</filler>
<end_time>Job ended: 26 September 2011 at 02:43:12</end_time>
<engine_completion_status>Job completion status: Successful</engine_completion_status>
<filler>======================================================================</filler>
<completeStatus>19</completeStatus>
</footer>
</joblog>1. your code does not compile (in your main method you try to create an instance of a class which does not exist).
2. your XML document is not well formed.
+[Fatal Error] test.xml:34:74: The content of elements must consist of well-formed character data or markup.+
org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.
Maybe there are other problems but you can start by fixing these. -
Error handling in parsing XML files.
Hi.
Is it possible to handle the error generated by DocumentBuilder elsewhere, as it parses down an XML file? In my test-program, I am parsing (using SAX) an XML file, and testing whether it is valid under a certain schema. If it is valid, I would then generate a console-output tree of the XML file. Otherwise, it would just display the error messages (wherever they are in the XML file).
This is what I have.
import java.io.IOException;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import java.util.*;
public class XMLTester {
private Document document;
private boolean state = true;
public XMLTester() { }
public static final void main(String[] args) {
if ( args.length != 1 ) {
System.out.println("Usage: java XmlTester myFile.xml");
System.exit(-1);
String xmlFile = args[0];
XMLTester xmltester ;
xmltester = new XMLTester();
xmltester.parseFile(xmlFile);
if (xmltester.isValidXML() ) {
xmltester.printContents());
public void parseFile(String xmlFile)/* throws ParserConfigurationException,
SAXException, IOException */{
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
factory.setAttribute(
"http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema");
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(xmlFile);
} catch (Exception ex) {
//ex.printStackTrace();
state = false;
public boolean isValidXML() {
return state;
//..print-out methods here..
}Thanks!Nevermind.. I figured it out after a few thoughts.
-
Parse XML in a java stored proc
I am trying to parse an xml document in a java stored procedure. Just following my nose, I have developed a stored proc that works fine in development (outside the database using JRE 1.4.1) using the Xerces 2.5 parser. But, after having transferred the xerces xercesImpl.jar, xmlapis.jar, and my implementation class into oracle using loadjava when I call my stored proc the code throws an exception trying to build the document with an error like:
NoClassDef exception org.apache.xerces.jaxp.DocumentFactoryBuilderImpl
My Code looks like this:
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
The exception caught is a FactoryConfigurtionError.
I'm not particularly attached to xerces, I'm really just looking for a way to parse XML inside my java stored proc, so any help to solve my problem, or an alternative suggestion will be greatly appreciated.
thanks
DaleI looked again and sure enough the xerces implementation classes were missing. I had run a .cmd file containing these two lines, but it looks like only the first one ran...
loadjava -u ncc/xyz@usd -v -r M:\Database\JavaGeocode\Xerces2_5_0\xml-apis.jar
loadjava -u ncc/xyz@usd -v -r M:\Database\JavaGeocode\Xerces2_5_0\xercesImpl.jar
Now I've got everything working fine with Xerces!
Dale -
Hi,
I am having an XML file which is having set of repeated tags like
<gender>
<male>
<name>sk</name>
<age>19</age>
</male>
<male>
<name>raj</name>
<age>20</age>
</male>
<male>
<name>kris</name>
<age>18</age>
</male>
</gender>
Like this i am having the xml file, i have to read the values from this xml file, here we are having male tag is repeated, from this i have to take the name, and age values. can you tell me how to take these values. If you are having the sample send me.
Thanks,Hai
It may be a bit late to reply but i hope this code will help you
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.*;
import java.io.File;
import org.w3c.dom.*;
class DomParse
public void func()
try
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
//File f =new File("trial.xml");
Document doc = db.parse(new File("trial.xml")); //your xml file name here
//Document doc = db.parse(f);
NodeList nl1 = doc.getElementsByTagName("male");
for(int i=0;i<nl1.getLength();i++)
Node nd = nl1.item(i);
NodeList tmplist = nd.getChildNodes();
for(int j=0;j<tmplist.getLength();j++)
Node tmpNode = tmplist.item(j);
String locStr = tmpNode.getTextContent();
System.out.println(""+tmpNode.getTextContent());
catch(Exception e)
System.out.println("Error: "+e);
e.printStackTrace();
public static void main(String[] args) //throws
new DomParse().func();
with regards
shan -
How to parse XML to Java object... please help really stuck
Thank you for reading this email...
If I have a **DTD** like:
<!ELEMENT person (name, age)>
<!ATTLIST person
id ID #REQUIRED
>
<!ELEMENT name ((family, given) | (given, family))>
<!ELEMENT age (#PCDATA)>
<!ELEMENT family (#PCDATA)>
<!ELEMENT given (#PCDATA)>
the **XML** like:
<person id="a1">
<name>
<family> Yoshi </family>
<given> Samurai </given>
</name>
<age> 21 </age>
</person>
**** Could you help me to write a simple parser to parse my DTD and XML to Java object, and how can I use those objects... sorry if the problem is too basic, I am a beginner and very stuck... I am very confuse with SAXParserFactory, SAXParser, ParserAdapter and DOM has its own Factory and Parser, so confuse...
Thank you for your help, YoHi, Yo,
Thank you very much for your help. And I Wish you are there...I'm. And I plan to stay - It's sunny and warm here in Honolulu and the waves are up :)
A bit more question for dear people:
In the notes, it's mainly focus on JAXB,
1. Is that mean JAXB is most popular parser for
parsing XML into Java object? With me, definitely. There are essentially 3 technologies that allow you to parse XML documents:
1) "Callbacks" (e.g. SAX in JAXP): You write a class that overrides 3 methods that will be called i) whenever the parser encounters a start tag, ii) an end tag, or iii) PCDATA. Drawback: You have to figure out where the heck in the document hierarchy you are when such a callback happens, because the same method is called on EACH start tag and similarly for the end tag and the PCDATA. You have to create the objects and put them into your own data structure - it's very tedious, but you have complete control. (Well, more or less.)
2) "Tree" (e.g. DOM in JAXP, or it's better cousin JDOM): You call a parser that in one swoop creates an entire hierarchy that corresponds to the XML document. You don't get called on each tag as with SAX, you just get the root of the resulting tree. Drawback: All the nodes in the tree have the same type! You probably want to know which tags are in the document, don't you? Well, you'll have to traverse the tree and ask each node: What tag do you represent? And what are your attributes? (You get only strings in response even though your attributes often represent numbers.) Unless you want to display the tree - that's a nice application, you can do it as a tree model for JTree -, or otherwise don't care about the individual tags, DOM is not of much help, because you have to keep track where in the tree you are while you traverse it.
3) Enter JAXB (or Castor, or ...): You give it a grammar of the XML documents you want to parse, or "unmarshall" as the fashion dictates to call it. (Actually the name isn't that bad, because "parsing" focuses on the input text while "unmarshalling" focuses on the objects you get, even though I'd reason that it should be marshalling that converts into objects and unmarshalling that converts objects to something else, and not vice versa but that's just my opinion.) The JAXB compiler creates a bunch of source files each with one (or now more) class(es) (and now interfaces) that correspond to the elements/tags of your grammar. (Now "compiler" is a true jevel of a misnomer, try to explain to students that after they run the "compiler", they still need to compile the sources the "compiler" generated with the real Java compiler!). Ok, you've got these sources compiled. Now you call one single method, unmarshall() and as a result you get the root node of the hierarchy that corresponds to the XML document. Sounds like DOM, but it's much better - the objects in the resulting tree don't have all the same type, but their type depends on the tag they represent. E.g if there is the tag <ball-game> then there will be an object of type myPackage.BallGame in your data structure. It gets better, if there is <score> inside <ball-game> and you have an object ballGame (of type BallGame) that you can simply call ballGame.getScore() and you get an object of type myPackage.Score. In other words, the child tags become properties of the parent object. Even better, the attributes become properties, too, so as far as your program is concerned there is no difference whether the property value was originally a tag or an attribute. On top of that, you can tell in your schema that the property has an int value - or another primitive type (that's like that in 1.0, in the early release you'll have to do it in the additional xjs file). So this is a very natural way to explore the data structure of the XML document. Of course there are drawbacks, but they are minor: daunting complexity and, as a consequence, very steep learning curve, documentation that leaves much to reader's phantasy - read trial and error - (the user's guide is too simplicistic and the examples too primitive, e.g. they don't even tell you how to make a schema where a tag has only attributes) and reference manual that has ~200 pages full of technicalities and you have to look with magnifying glas for the really usefull stuff, huge number of generated classes, some of which you may not need at all (and in 1.0 the number has doubled because each class has an accompanying interface), etc., etc. But overall, all that pales compared to the drastically improved efficiency of the programmer's efforts, i.e. your time. The time you'll spend learning the intricacies is well spent, you'll learn it once and then it will shorten your programming time all the time you use it. It's like C and Java, Java is order of magnitude more complex, but you'd probably never be sorry you gave up C.
Of course the above essay leaves out lots and lots of detail, but I think that it touches the most important points.
A word about JAXB 1.0 vs. Early Release (EA) version. If you have time, definitively learn 1.0, they are quite different and the main advantage is that the schema combines all the info that you had to formulate in the DTD and in the xjs file when using the EA version. I suggested EA was because you had a DTD already, but in retrospect, you better start from scratch with 1.0. The concepts in 1.0 are here to stay and once your surmounted the learning curve, you'll be glad that you don't have to switch concepts.
When parser job is done,
what kind of Java Object we will get? (String,
InputStream or ...)See above, typically it's an object whose type is defined as a class (and interface in 1.0) within the sources that JABX generates. Or it can be a String or one of the primitive types - you tell the "compiler" in the schema (xjs file in EA) what you want!
2. If we want to use JAXB, we have to contain a
XJS-file? Something like:In EA, yes. In 1.0 no - it's all in the schema.
I am very new to XML, is there any simpler way to get
around them? It has already take me 4 days to find a
simple parser which give it XML and DTD, then return
to me Java objects ... I mean if that kind of parser
exists....It'll take you probably magnitude longer that that to get really familiar with JAXB, but believe me it's worth it. You'll save countless days if not weeks once you'll start developing serious software with it. How long did it take you to learn Java and it's main APIs? You'll either invest the time learning how to use the software others have written, or you invest it writing it yourself. I'll take the former any time. But it's only my opinion...
Jan -
How to parse xml data into java component
hi
everybody.
i am new with XML, and i am trying to parse xml data into a java application.
can anybody guide me how to do it.
the following is my file.
//MyLogin.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
class MyLogin extends JFrame implements ActionListener
JFrame loginframe;
JLabel labelname;
JLabel labelpassword;
JTextField textname;
JPasswordField textpassword;
JButton okbutton;
String name = "";
FileOutputStream out;
PrintStream p;
Date date;
GregorianCalendar gcal;
GridBagLayout gl;
GridBagConstraints gbc;
public MyLogin()
loginframe = new JFrame("Login");
gl = new GridBagLayout();
gbc = new GridBagConstraints();
labelname = new JLabel("User");
labelpassword = new JLabel("Password");
textname = new JTextField("",9);
textpassword = new JPasswordField(5);
okbutton = new JButton("OK");
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 1;
gbc.gridy = 5;
gl.setConstraints(labelname,gbc);
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 2;
gbc.gridy = 5;
gl.setConstraints(textname,gbc);
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 1;
gbc.gridy = 10;
gl.setConstraints(labelpassword,gbc);
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 2;
gbc.gridy = 10;
gl.setConstraints(textpassword,gbc);
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 1;
gbc.gridy = 15;
gl.setConstraints(okbutton,gbc);
Container contentpane = getContentPane();
loginframe.setContentPane(contentpane);
contentpane.setLayout(gl);
contentpane.add(labelname);
contentpane.add(labelpassword);
contentpane.add(textname);
contentpane.add(textpassword);
contentpane.add(okbutton);
okbutton.addActionListener(this);
loginframe.setSize(300,300);
loginframe.setVisible(true);
public static void main(String a[])
new MyLogin();
public void reset()
textname.setText("");
textpassword.setText("");
public void run()
try
String text = textname.getText();
String blank="";
if(text.equals(blank))
System.out.println("First Enter a UserName");
else
if(text != blank)
date = new Date();
gcal = new GregorianCalendar();
gcal.setTime(date);
out = new FileOutputStream("log.txt",true);
p = new PrintStream( out );
name = textname.getText();
String entry = "UserName:- " + name + " Logged in:- " + gcal.get(Calendar.HOUR) + ":" + gcal.get(Calendar.MINUTE) + " Date:- " + gcal.get(Calendar.DATE) + "/" + gcal.get(Calendar.MONTH) + "/" + gcal.get(Calendar.YEAR);
p.println(entry);
System.out.println("Record Saved");
reset();
p.close();
catch (IOException e)
System.err.println("Error writing to file");
public void actionPerformed(ActionEvent ae)
String str = ae.getActionCommand();
if(str.equals("OK"))
run();
//loginframe.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}hi, thanks for ur reply.
i visited that url, i was able to know much about xml.
so now my requirement is DOM.
but i dont know how to code in my existing file.
means i want to know what to link all my textfield to xml file.
can u please help me out. i am confused.
waiting for ur reply -
i've searched on how to parse xml against xsd,dtd,etc.. without the needs of internet connection..
but unfortunately, only the xsd file can be set locally and still there needs the internet connection for the other features, properties.
XML: GML file input from gui
XSD: input from gui
javax.xml
package demo;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.XMLConstants;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.xml.sax.SAXException;
public class Sample1WithJavaxXML {
public static void main(String[] args) {
URL schemaFile = null;
try {
//schemaFile = new URL("http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd");
File file0 = new File("AppSchema-C01-v1_0.xsd");
schemaFile = new URL(file0.toURI().toString());
} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
//Source xmlFile = new StreamSource(new File("web.xml"));
Source xmlFile = new StreamSource(new File("C01.xml"));
SchemaFactory schemaFactory = SchemaFactory
.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
//File file1 = new File("XMLSchema.dtd");
//SchemaFactory schemaFactory = SchemaFactory
//.newInstance("javax.xml.validation.SchemaFactory:XMLSchema.dtd");
Schema schema = null;
try {
schema = schemaFactory.newSchema(schemaFile);
} catch (SAXException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
Validator validator = schema.newValidator();
try {
validator.validate(xmlFile);
System.out.println(xmlFile.getSystemId() + " is valid");
} catch (SAXException e) {
System.out.println(xmlFile.getSystemId() + " is NOT valid");
System.out.println("Reason: " + e.getLocalizedMessage());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}Xerces
package demo;
import java.io.File;
import java.util.Date;
import org.apache.xerces.parsers.DOMParser;
public class SchemaTest {
private String xmlFile = "";
private String xsdFile = "";
public SchemaTest(String xmlFile, String xsdFile) {
this.xmlFile = xmlFile;
this.xsdFile = xsdFile;
public static void main (String args[]) {
File file0 = new File("AppSchema-C01-v1_0.xsd");
String xsd = file0.toURI().toString();
SchemaTest testXml = new SchemaTest("C01.xml",xsd);
testXml.process();
public void process() {
File docFile = new File(xmlFile);
DOMParser parser = new DOMParser();
try {
parser.setFeature("http://xml.org/sax/features/validation", true);
parser.setFeature("http://apache.org/xml/features/validation/schema", true);
parser.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
xsdFile);
ErrorChecker errors = new ErrorChecker();
parser.setErrorHandler(errors);
System.out.println(new Date().toString() + " START");
parser.parse(docFile.toString());
} catch (Exception e) {
System.out.print("Problem parsing the file.");
System.out.println("Error: " + e);
System.out.println(new Date().toString() + " ERROR");
return;
System.out.println(new Date().toString() + " END");
}Thanks a lot Sir DrClap..
I tried to use and implement the org.w3c.dom.ls.LSResourceResolver Interface which is based on the SAX2 EntityResolver.
please give comments the way I implement it. Here's the code:
LSResourceResolver Implementation
import org.w3c.dom.ls.LSInput;
import org.w3c.dom.ls.LSResourceResolver;
import abc.xml.XsdConstant.Path.DTD;
import abc.xml.XsdConstant.Path.XSD;
public class LSResourceResolverImpl implements LSResourceResolver {
public LSResourceResolverImpl() {
* {@inheritDoc}
@Override
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
LSInput input = new LSInputImpl(publicId, systemId, baseURI);
if ("http://www.w3.org/2001/xml.xsd".equals(systemId)) {
input.setByteStream(classLoader.getResourceAsStream(XSD.XML));
} else if (XsdConstant.PUBLIC_ID_XMLSCHEMA.equals(publicId)) {
input.setByteStream(classLoader.getResourceAsStream(DTD.XML_SCHEMA));
} else if (XsdConstant.PUBLIC_ID_DATATYPES.equals(publicId)) {
input.setByteStream(classLoader.getResourceAsStream(DTD.DATATYPES));
return input;
}I also implement org.w3c.dom.ls.LSInput
import java.io.InputStream;
import java.io.Reader;
import org.w3c.dom.ls.LSInput;
public class LSInputImpl implements LSInput {
private String publicId;
private String systemId;
private String baseURI;
private InputStream byteStream;
private String stringData;
public LSInputImpl(String publicId, String systemId, String baseURI) {
super();
this.publicId = publicId;
this.systemId = systemId;
this.baseURI = baseURI;
//getters & setters
}Then, here's the usage/application:
I create XMLChecker class (SchemaFactory implementation is Xerces)
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.xml.XMLConstants;
import javax.xml.stream.FactoryConfigurationError;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import abc.xml.XsdConstant.Path.XSD;
public class XMLChecker {
private ErrorMessage errorMessage = new ErrorMessage();
public boolean validate(String filePath){
final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
List<Source> schemas = new ArrayList<Source>();
schemas.add(new StreamSource(classLoader.getResourceAsStream(XSD.XML_SCHEMA)));
schemas.add(new StreamSource(classLoader.getResourceAsStream(XSD.XLINKS)));
schemas.add(new StreamSource(classLoader.getResourceAsStream("abc/xml/AppSchema.xsd")));
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
schemaFactory.setResourceResolver(new LSResourceResolverImpl());
try {
Schema schema = schemaFactory.newSchema(schemas.toArray(new Source[schemas.size()]));
Validator validator = schema.newValidator();
validator.setErrorHandler(new ErrorHandler() {
@Override
public void error(SAXParseException e) throws SAXException {
errorMessage.setErrorMessage(e.getMessage());
errorMessage.setLineNumber(e.getLineNumber());
errorMessage.setColumnNumber(e.getLineNumber());
throw e;
@Override
public void fatalError(SAXParseException e) throws SAXException {
errorMessage.setErrorMessage(e.getMessage());
errorMessage.setLineNumber(e.getLineNumber());
errorMessage.setColumnNumber(e.getLineNumber());
throw e;
@Override
public void warning(SAXParseException e) throws SAXException {
errorMessage.setErrorMessage(e.getMessage());
errorMessage.setLineNumber(e.getLineNumber());
errorMessage.setColumnNumber(e.getLineNumber());
throw e;
StreamSource source = new StreamSource(new File(filePath));
validator.validate(source);
} catch (SAXParseException e) {
return false;
} catch (SAXException e) {
errorMessage.setErrorMessage(e.getMessage());
return false;
} catch (FactoryConfigurationError e) {
errorMessage.setErrorMessage(e.getMessage());
return false;
} catch (IOException e) {
errorMessage.setErrorMessage(e.getMessage());
return false;
return true;
public ErrorMessage getErrorMessage() {
return errorMessage;
}Edited by: erossy on Aug 31, 2010 1:56 AM -
How to Parse XML with SAX and Retrieving the Information?
Hiya!
I have written this code in one of my classes:
/**Parse XML File**/
SAXParserFactory factory = SAXParserFactory.newInstance();
GameContentHandler gameCH = new GameContentHandler();
try
SAXParser saxParser = factory.newSAXParser();
saxParser.parse(recentFiles[0], gameCH);
catch(javax.xml.parsers.ParserConfigurationException e)
e.printStackTrace();
catch(java.io.IOException e)
e.printStackTrace();
catch(org.xml.sax.SAXException e)
e.printStackTrace();
/**Parse XML File**/
games = gameCH.getGames();And here is the content handler:
import java.util.ArrayList;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
class GameContentHandler extends DefaultHandler
private ArrayList<Game> games = new ArrayList<Game>();
public void startDocument()
System.out.println("Start document.");
public void endDocument()
System.out.println("End document.");
public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes atts) throws SAXException
public void endElement(String namespaceURI, String localName, String qualifiedName) throws SAXException
public void characters(char[] ch, int start, int length) throws SAXException
/**for (int i = start; i < start+length; i++)
System.out.print(ch);
public ArrayList<Game> getGames()
return games;
}And here is the xml i am trying to parse:<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<Database>
<Name></Name>
<Description></Description>
<CurrentGameID></CurrentGameID>
<Game>
<gameID></gameID>
<name></name>
<publisher></publisher>
<platform></platform>
<type></type>
<subtype></subtype>
<genre></genre>
<serial></serial>
<prodReg></prodReg>
<expantionFor></expantionFor>
<relYear></relYear>
<expantion></expantion>
<picPath></picPath>
<notes></notes>
<discType></discType>
<owner></owner>
<location></location>
<borrower></borrower>
<numDiscs></numDiscs>
<discSize></discSize>
<locFrom></locFrom>
<locTo></locTo>
<onLoan></onLoan>
<borrowed></borrowed>
<manual></manual>
<update></update>
<mods></mods>
<guide></guide>
<walkthrough></walkthrough>
<cheats></cheats>
<savegame></savegame>
<completed></completed>
</Game>
</Database>I have been trying for ages and just can't get the content handler class to extract a gameID and instantiate a Game to add to my ArrayList! How do I extract the information from my file?
I have tried so many things in the startElement() method that I can't actually remember what I've tried and what I haven't! If you need to know, the Game class instantiates with asnew Game(int gameID)and the rest of the variables are public.
Please help someone...OK, how's this?
public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes atts) throws SAXException
current = "";
public void endElement(String namespaceURI, String localName, String qualifiedName) throws SAXException
try
if(qualifiedName.equals("Game") || qualifiedName.equals("Database"))
{return;}
else if(qualifiedName.equals("gameID"))
{games.add(new Game(Integer.parseInt(current)));}
else if(qualifiedName.equals("name"))
{games.get(games.size()-1).name = current;}
else if(qualifiedName.equals("publisher"))
{games.get(games.size()-1).publisher = current;}
etc...
else
{System.out.println("ERROR - Qualified Name found in xml that does not exist as databse field: " + qualifiedName);}
catch (Exception e) {} //Ignore
public void characters(char[] ch, int start, int length) throws SAXException
current += new String(ch, start, length);
} -
Parse xml file with validating againat dtd
i have a xlm file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map SYSTEM "map.dtd">
<map width="20" height="15" goal="25" name="eXtreme Labyrinth of Dooom">
<random-item type='lantern' amount='5' />
<random-item type='health' amount='10' />
<tile x="14" y="0" type="wall">
<renderhint>wall:rock,cracked</renderhint>
</tile>
<tile x="15" y="0" type="wall" />
<tile x="16" y="0" type="floor">
<renderhint>floor:marble,cracked</renderhint>
</tile>
<tile x="17" y="0" type="floor">
<renderhint>floor:stone,rubble</renderhint>
</tile>
<tile x="18" y="0" type="floor" />
<tile x="0" y="1" type="floor" />
<tile x="1" y="1" type="floor" startlocation="1" />
<tile x="2" y="1" type="floor" />
<tile x="3" y="1" type="floor">
<item type="treasure">Bar of Silver</item>
<renderhint>floor:stone,blood</renderhint>
</tile>
<tile x="4" y="1" type="wall" />
<tile x="5" y="1" type="wall" />
<tile x="6" y="1" type="wall">
<renderhint>wall:bricks,cracked</renderhint>
</tile>
</map>and a dtd document like:
<!ELEMENT map (random-item+, tile+)>
<!ATTLIST map
width CDATA #REQUIRED
height CDATA #REQUIRED
goal CDATA #REQUIRED
name CDATA #REQUIRED
<!ELEMENT random-item EMPTY>
<!ATTLIST random-item
type (armour|health|sword|treasure|lantern) #REQUIRED
amount CDATA #REQUIRED
<!ELEMENT tile (item|renderhint)*>
<!ATTLIST tile
x CDATA #REQUIRED
y CDATA #REQUIRED
type (exit|floor|wall) #REQUIRED
startlocation CDATA #IMPLIED
<!ELEMENT item (#PCDATA)>
<!ATTLIST item
type (armour|health|sword|treasure|lantern) #REQUIRED
<!ELEMENT renderhint (#PCDATA)>i need to validate the xml file against the dtd document and parse it to java using DOM.
Can anyone give ma any suggestions on how to do it?
thank youi have started my coding like:
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import java.io.*;
class loadxml
public static void main(String[] args)
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(true);
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder parser = factory.newDocumentBuilder();
Document doc = parser.parse(new File("hallways.xml"));
loadxml load = new loadxml();
load.parseNode(doc);
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
public void parseNode (Node node) throws IOException
// here is where i have problem with
}since in my xml file, i have got ATTLIST, this ready confuses me when i try to coding it.
Can anyone help me, please.
Thank you.
Edited by: mujingyue on Mar 12, 2008 3:10 PM
Maybe you are looking for
-
Problem in Authorization of ESS in EP
Dear All, While running ESS through EP some users are getting error :<b>You are not authorised to Start service sap.com\pcui_gp~xssutils/XSS/Menu/Area </b> I have already attached the Roles to the user which the otehr user is having and running fine
-
Pictures and texts are not displayed properly
Hello Apple users, I've the 15 inch Macbook Pro with retina display, running Mountain Lion. I have noticed that when I chat with my friends in Facebook, the texts in the chat window are not displayed properly. This also happens when flipping through
-
Using of zero balance a/c ?
Hi all, i am workig on ECC 6.0. my question is " why should we usd 'ZERO BALANCE G/L ACCOUNT' in ECC 6.0. what is the purpus and impartence of that in this version. Thanku
-
Dear All, I am trying to download employees from HR to CRM system. Connection is already set up. When I process an Idoc in BD87 in CRM, system gives me a warning message that Object 01,CP,<pernr number> does not exist: infotype 5580 cannot be created
-
I got a The Network Adapter could not establish the connection..
hi guys, i've just downloaded and installed oracle 10g express in my win 7 installation. i've already created 2 tables and one user and everything seems to be ok. but.. there's a but!!! i've tried to connect (using driver ojdbc14) from netbeans and i