Please help to convert this xml to text.
I have the attached the xml. Please find the attachement.
Some student has two address tag and some student has one address tag and
some student dont have address tag tag.
I need to convert the xml into string.
this is my desired output.
100
Which input format you are using . Use xml input format.
On 3 Jan 2014 10:47, Ranjini Rathinam ranjinibe...@gmail.com wrote:
Hi,
Need to convert XML into text using mapreduce.
I have used DOM and SAX parser.
After using SAX Builder in mapper class. the child node act as root
Element
= new Job(conf, XML to Text);
job.setJarByClass(MainXml.class);
// job.setJobName(XML to Text);
FileInputFormat.addInputPath(job, new Path(args[0]));
// FileOutputFormat.setOutputPath(job, new Path(args[1]));
Path outPath = new Path(output
);
System.exit(-1);
}
String output=/user/task/Sales/;
Job job = new Job(conf, XML to Text);
job.setJarByClass(MainXml.class);
// job.setJobName(XML to Text);
FileInputFormat.addInputPath(job, new Path(args[0]));
// FileOutputFormat.setOutputPath(job
(Main.class);
job.setJobName(XML to Text);
FileInputFormat.addInputPath(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
job.setMapperClass(XmlToTextMapper.class);
job.setNumReduceTasks(0);
job.setMapOutputKeyClass
.println(Usage: XMLtoText input path output
path);
System.exit(-1);
}
Job job = new Job();
job.setJarByClass(Main.class);
job.setJobName(XML to Text);
FileInputFormat.addInputPath(job, new Path(args[0
XML to text.
such as your xml like this:
xml
namelll/name
/xml
you need to specify stream.recordreader.begin and stream.recordreader.end
in the Configuration:
Configuration conf = new Configuration();
conf.set(stream.recordreader.begin, xml);
conf.set(stream.recordreader.end, /xml
);
}
Job job = new Job();
job.setJarByClass(Main.class);
job.setJobName(XML to Text);
FileInputFormat.addInputPath(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
job.setMapperClass(XmlToTextMapper.class
Hi,
Need to convert XML into text using mapreduce.
I have used DOM and SAX parser.
After using SAX Builder in mapper class. the child node act as root Element.
While seeing in Sys out i found thar root element is taking the child
element and printing.
For Eg,
CompEmpid100/idnameRR/name/Emp
Hi,
you can use org.apache.hadoop.streaming.StreamInputFormat using map reduce
to convert XML to text.
such as your xml like this:
xml
namelll/name
/xml
you need to specify stream.recordreader.begin and stream.recordreader.end
in the Configuration:
Configuration conf = new Configuration
10 matches
Mail list logo