File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes XPATH Processor in java code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XPATH Processor in java code " Watch "XPATH Processor in java code " New topic
Author

XPATH Processor in java code

Sharang Thorat
Greenhorn

Joined: Dec 07, 2000
Posts: 21
Hello
i have an xml which i want to sort on certain elements
as specified by user GUI.
i intend to follow following steps

1. convert xml to another xml using XPATH processor
here sorting crieterion from user will be applied.
2. apply xslt on that xml and display

i could achive the step 2 in my code

File xmlfile = new File(file_path.concat("\\temp.xml"));
File stylesheet = new File(file_path.concat("\\rsdstylesheet.xsl"));

FileInputStream in = new FileInputStream(xmlfile);
FileInputStream xslfile = new FileInputStream(stylesheet);


XSLTProcessor processor = XSLTProcessorFactory.getProcessor();
//StylesheetRoot parsedStyleSheet = null;

//parsedStyleSheet = processor.processStylesheet( new XSLTInputSource( xslfile ) );
//processor.setStylesheet(parsedStyleSheet);
try{
processor.process(new XSLTInputSource(in),new XSLTInputSource(xslfile),new XSLTResultTarget(out));
}catch (Exception e)
{
System.out.println("******************************************");
e.printStackTrace();
}

but how to cheive step one. How to apply the user selected crieterion for sorting on the xml and using XPath convert it
to anohter xml. i know how to do it on command line
using org.apache.xalan.xpath.Process class but is there any implementation for that class to call it through the programme
like XSLTProcessor class.
regards
sharang
 
 
subject: XPATH Processor in java code
 
Similar Threads
xalan
JSP with XSL
paserConfigurationException
XSLT and unicode
what is the Error Ajith