Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!

Ahamed Ali

Greenhorn
+ Follow
since Apr 21, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ahamed Ali

HI,

I am developing a task, which involved converting CSV to XML. Everything is working fine, but I am not able to remove single quotes from CSV to produce output in XML. I am using SAX and Java.

The CSV is look like:

'First','carol','Last','Simon',' ' and so on.

The part of the out put I got:

<?xml version="1.0" encoding="UTF-8"?>
<learnerinformation>
<relationship>
<source>'First'</source>
<id>'carol'</id>
</relationship>
</learnerinformation>

I want to the remove the quotes using Java, pleae some one could helpme out.

Thanks in advanced


Ahamed
hi,

thanks for your message.

At this moment I am looking a CSV file to parse into SAX then transform to XML output, simply CSV to XML using SAX, probably I will later to store the csv to databases.

I used StringTokenizer, but does not give much results for complex CSV files, and I also gone through open source CSV parser Ostill... for Java. It is just reading the complete CSV file and the giving the console, but I dont know how to parse into SAX for firing an event of CSV file line by line.

I hope SAX is the best choice to my requirements. Please someone could help me out about this task, and I need to complete ASAP.

thanks in advanced.


Ahamed
14 years ago
thanks for everyone suggested me about the headche stuff.

Mr. D Rog could you please publish your CSV code in the open source, because I am very much interested to look the code and for help.

thanks in adavance and hope to see the CSV code in open source.


Ahamed
14 years ago
Hi,

I am trying to convert CSV to XML file, and I am using StringTokenizer to
read CSV file, but not clear understandble.

---------------------------CSV File-------------------------------------
[Header]
'devon','add','"LR","UOP"','test'
[Identification]
'northdevon.ac.uk','123456','',''
[Personal]
'Smith','West','Carol','Mrs','31/12/1977','F','156 Old Mill Lane, Worcester','WO34 5GG','ER234557H','','Favourite food?'
------------------------------------------------------------------

Can any one suggest me about this implementation or any links to have a similar examples.

I tried with StrinTokenizer, but could get the proper results.
-------------------------------------------------------------------------
public int transformMethod(String csvFileName, String xmlFileName){
int rowsCount=-1;
try{
Document newDoc = domBuilder.newDocument();
Element rootElement = newDoc.createElement("learnerinformation");
newDoc.appendChild(rootElement);

// Read comma seperated file
BufferedReader csvReader;
csvReader = new BufferedReader(new FileReader(csvFileName));
int fieldCount = 0;
String[] csvFields = null;
StringTokenizer stringTokenizer = null;

// Assumption: first line in CSV file is column/field names
// As the column names are used to name the elements in the
XML file,
// avoid using spaces/any other characters not suitable for
XML element naming
String curLine = csvReader.readLine();
if(curLine != null)
{
stringTokenizer = new StringTokenizer(curLine,",");
fieldCount = stringTokenizer.countTokens();
if(fieldCount > 0)
{
csvFields = new String[fieldCount];
int i=0;
while(stringTokenizer.hasMoreElements())
csvFields[i++] = String.valueOf( stringTokenizer.nextElement());
}
}

// Now we know the columns, Let's now read data row lines
while((curLine = csvReader.readLine()) != null)
{
stringTokenizer = new StringTokenizer(curLine,",");
fieldCount = stringTokenizer.countTokens();

if(fieldCount > 0)
{
Element rowElement = newDoc.createElement("Contenentype");
//Element rowElement1 = newDoc.createElement("referential");

int i=0;
while(stringTokenizer.hasMoreElements())
{
try
{
String curValue = String.valueOf(stringTokenizer.nextElement());
Element curElement = newDoc.createElement(csvFields[i++]);
curElement.appendChild(newDoc.createTextNode(curValue));
rowElement.appendChild(curElement);
// rowElement1.appendChild(curElement);
}
catch(Exception exp)
{
}
}
rootElement.appendChild(rowElement);
rowsCount++;
}
}
csvReader.close();
}
----------------------------------------------------------------------

thanks in advanced.


Fyrose
14 years ago
Hi,

I am trying to convert CSV to XML file, and I am using StringTokenizer to
read CSV file, but not clear understandble.

---------------------------CSV File-------------------------------------
[Header]
'devon','add','"LR","UOP"','test'
[Identification]
'northdevon.ac.uk','123456','',''
[Personal]
'Smith','West','Carol','Mrs','31/12/1977','F','156 Old Mill Lane, Worcester','WO34 5GG','ER234557H','','Favourite food?'
------------------------------------------------------------------

Can any one suggest me about this implementation or any links to have a similar examples.

I tried with StrinTokenizer, but could get the proper results.
-------------------------------------------------------------------------
public int transformMethod(String csvFileName, String xmlFileName){
int rowsCount=-1;
try{
Document newDoc = domBuilder.newDocument();
Element rootElement = newDoc.createElement("learnerinformation");
newDoc.appendChild(rootElement);

// Read comma seperated file
BufferedReader csvReader;
csvReader = new BufferedReader(new FileReader(csvFileName));
int fieldCount = 0;
String[] csvFields = null;
StringTokenizer stringTokenizer = null;

// Assumption: first line in CSV file is column/field names
// As the column names are used to name the elements in the
XML file,
// avoid using spaces/any other characters not suitable for
XML element naming
String curLine = csvReader.readLine();
if(curLine != null)
{
stringTokenizer = new StringTokenizer(curLine,",");
fieldCount = stringTokenizer.countTokens();
if(fieldCount > 0)
{
csvFields = new String[fieldCount];
int i=0;
while(stringTokenizer.hasMoreElements())
csvFields[i++] = String.valueOf( stringTokenizer.nextElement());
}
}

// Now we know the columns, Let's now read data row lines
while((curLine = csvReader.readLine()) != null)
{
stringTokenizer = new StringTokenizer(curLine,",");
fieldCount = stringTokenizer.countTokens();

if(fieldCount > 0)
{
Element rowElement = newDoc.createElement("Contenentype");
//Element rowElement1 = newDoc.createElement("referential");

int i=0;
while(stringTokenizer.hasMoreElements())
{
try
{
String curValue = String.valueOf(stringTokenizer.nextElement());
Element curElement = newDoc.createElement(csvFields[i++]);
curElement.appendChild(newDoc.createTextNode(curValue));
rowElement.appendChild(curElement);
// rowElement1.appendChild(curElement);
}
catch(Exception exp)
{
}
}
rootElement.appendChild(rowElement);
rowsCount++;
}
}
csvReader.close();
}
----------------------------------------------------------------------

thanks in advanced.


Ahamed
14 years ago
thanks Bill for your help.

I am going to study about SAX, and it would be very greatful, if you could provide sample implementation examples, where I can get some more helpful about the technologies.

thanks in advance.

Ahamed
Hi Bill,

thanks for your message. I am planning to go with JAXP, using JAXP transform CSV files to XML in DOM, then transform XML to CSV file usig XSLT otherwise using Java and SOAP exchange messages.

I would like to know, it would be possible to go with Java and SOAP to transform CSV to XML and reverse transform to CSV file from XML.

It would be very greatful, if you could give me some suggesstions to go with or your openions to go with for writing the code.

Which technologies and tools, I should prefer for implementation of this task?

Thanks in advanced


Ahamed
Hi Balaji,

Thanks for your help.

The requirements of the task is: (Overall Aim)

Be able to store and supply multiple transformations. In the future
we wish to transform from one type of data to another. Examples could be CSV, XML, HTML, plain text or MPEG-II. We would like to be
able to plug in new transforms at any time and the system to be able to use these without any recompilation.

Now I got the CSV document and the transformed XML document, and my work is write the code against to that files.

It would be very greatful, if you could provide me some help, and which tools and technologies would be suitable to write code.

Thanks in advance.


Ahamed Ali
Hi Everyone,

I need some help to complete this following task.

The Systems output data in a speciafied CSV format. This CSV is transformed into XML and sent over a network to other machines. When received at the other end, this XML is reverse transformed back to CSV.

I hope someone could helpme out the following:

- Which technologies would be best suitable for this task to complete.
- Is there any sample implementaion examples from CSV to XML to CSV or
similar.

Finally, I am expecting help and hints from experts.

Thanks in advance


Ahamed Ali
Hi Everyone,

I got a task to complete.

Let me explain: The Systems output data in a speciafied CSV format. This CSV is transformed into XML and sent over a network to other machines. When received at the other end, this XML is reverse transformed back to CSV.

I hope someone could helpme out the following:

- Which technologies would be best suitable for this task to complete.
- Is there any sample implementaion examples from CSV to XML to CSV or
similar.

Finally, I am expecting help and hints from experts.

Thanks in advance


Ahamed Ali
14 years ago
Hi Everyone,

I am learning struts. I wanted to develop a sample application using Struts Framework in eclipse. Can any one Pl tell me where can I find Sample applications, through which I can learn and develop an application.

I found one easystruts, but it is not working with eclipse 3.x version.

Thanks in Advance

Ahamed
15 years ago
Hi,

The simplest answer is Tomcat is a open source project, and Websphere is a commercial one, so you know the difference between open source and commercial.

And Tomcat is a Servlet Engine or Web container, so you cannot deploy EJB components. Websphere is a J2EE Application Server, you can deploy all J2EE componets.

Thanks


Ahamed
Hi Riaz,

I am not a english born to speak like english people, and how can you say that my english is poor. If you feel like that, and anyhow a java programmer dont need much communication skills than consultant or business analyst. So dont say like all fool words RIAZ. Just think before what do you want say and how to give answer

Need to have skiils on technical things not in communication skills, so just put these words in your mind.

Ahamed
15 years ago
hi Ritu,

The job market is not good in UK. I have 3+ years experience in Java/J2EE in India and Germany but still not getting a job.

very bad things are here, apply jobs with agencies and these people are really dont know how to recruit and how to talk with applicants.

If any one know better idia how to apply job and get a job, that would be nice to here.

Finally my suggetion is for you, dont try a job in UK, better go to US or stay in India.

Thats for the day


Ahamed
15 years ago