Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8163325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:59:43+00:00 2026-06-06T18:59:43+00:00

I am working on Linux OS. I am facing trouble parsing & transforming the

  • 0

I am working on Linux OS.

I am facing trouble parsing & transforming the XML file though Java.

Location of Java XMLTransform.class: /home/apps/source (this path is present in CLASSPATH)
Location of XML file (working directory): /home/apps/nk/working/payload.xml

When I am inside the “Working Directory”, I am invoking XMLTransform.class passing XML filename payload.xml to it but getting following error:

XML-22004: (Fatal Error) Error while parsing input XML document (Invalid InputSource.).
---------
oracle.xml.parser.v2.XMLParseException: Invalid InputSource.
    at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:320)
    at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:248)
    at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:202)
    at oracle.xml.jaxp.JXTransformer.transform(JXTransformer.java:321)
    at TransformationEngine.main(TransformationEngine.java:30)

It is clear that class is not able to resolve the file name.

Please give pointers as to how I can resolve this?

Note: invoice_transformer.xsl is placed in same directory as .class file and CLASS file is able to read it.

Java Code:

import javax.xml.transform.*;
import java.io.*;

public class TransformationEngine {
public static void main(String[] args){

    String payloadFileName = args[0];

    String xslFile = "invoice_transformer.xsl";

    InputStream is = java.lang.ClassLoader.getSystemResourceAsStream(xslFile);
    InputStream pfis = java.lang.ClassLoader.getSystemResourceAsStream(payloadFileName);

    try{
        TransformerFactory tFactory = TransformerFactory.newInstance();

        Transformer transformer = tFactory.newTransformer(new javax.xml.transform.stream.StreamSource(is));
        transformer.transform(new javax.xml.transform.stream.StreamSource(pfis),new javax.xml.transform.stream.StreamResult(new FileOutputStream("IDMpayload.csv")));

    }
    catch(Exception e){
        e.printStackTrace();
    }
}

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T18:59:45+00:00Added an answer on June 6, 2026 at 6:59 pm

    getSystemResourceAsStream() looks for the resource in the CLASSPATH. You don’t have /home/apps/nk/working/ in your CLASSPATH (do you?).

    Instead use FileInputStream (as suggested by @Banthar )

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Actually I have a file . I am working in linux environment. I need
I am facing a problem in copying a Zip file from linux machine to
Working under linux for our developement, I have an Eclipse Makefile C Project and
I am working in linux bash environment, and I have many files to edit,
I'm working on linux + eclipse. I have updated my code following the steps
I am working in Linux, Eclipse CDT, g++, with Boost library. Having existing program
I finally got apache2 with mod_wsgi working on Linux (havent much luck with windows
I have Developed an Stand alone application (.jar) which is working on Linux environment,
I'm trying to get a global hotkey working in Linux using Mono. I found
Iam working on Ubuntu.(Linux) I want to redirect from the page one.php to two.php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.