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

  • Home
  • SEARCH
  • 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 5964809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:30:02+00:00 2026-05-22T19:30:02+00:00

in java I need to create xml file which look like this: <?xml version=1.0

  • 0

in java I need to create xml file which look like this:

<?xml version="1.0" encoding="UTF-8"?>
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_customObjectInstance.xsd">
    <Header action="write" externalSource="NIKU" objectType="customObjectInstance" version="8.1.0.4247"/>
    <customObjectInstances objectCode="hen_allockey_p">
        <instance instanceCode="MIG5033028" objectCode="hen_allockey_p"
        parentInstanceCode="001260" parentObjectCode="project">
            <CustomInformation>
                <ColumnValue name="hen_from">200801</ColumnValue>
                <ColumnValue name="name">MIG5033028</ColumnValue>
                <ColumnValue name="code">MIG5033028</ColumnValue>
            <OBSAssocs/>
            <Security/>
        </instance>
    </customObjectInstances>
</NikuDataBus>

I found something on google, but it didn’t match to my needs. And as I am new with java, I don’t know how to adapt it to my needs.

Thank you for your help.

  • 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-05-22T19:30:03+00:00Added an answer on May 22, 2026 at 7:30 pm

    I resolved it like this. It is bad looking code, but it works for me, maybe there are some errors caused by copy and paste

    public class POIExcelReader {
    
    private void setHenAllocKeyHeader(StringBuilder sb) {
        sb.append ("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
                + "<NikuDataBus xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"../xsd/nikuxog_customObjectInstance.xsd\">\r\n"
                + "<Header action=\"write\" externalSource=\"NIKU\"objectType=\"customObjectInstance\" version=\"8.1.0.4247\"/>\r\n"
                + "<customObjectInstances objectCode=\"hen_allockey_p\">\r\n"
                + "<instance instanceCode=\"MIG5033028\" objectCode=\"hen_allockey_p\" parentInstanceCode=\"001260\" parentObjectCode=\"project\">\r\n");
    }
    
    private void setHenAllocKeyBottom (StringBuilder sb) {
        sb.append ("<OBSAssocs/>\r\n"
                +"<Security/>\r\n"
                +"</customObjectInstances>\r\n" 
                + "</NikuDataBus>\r\n");
    }
    
    protected void jobRun() throws Exception {
    
        StringBuilder sb = new StringBuilder();
        setHenAllocKeyHeader(sb);
        String prolog = sb.toString();
    
        sb = new StringBuilder();
        setHenAllocKeyBottom(sb);
        String epilog = sb.toString();
    
    
        FileOutputStream fos = new FileOutputStream("c:\\test\\osem.xml");
        OutputStreamWriter osw = new OutputStreamWriter(fos, Charset.forName("UTF-8"));
        osw.write(prolog);
        osw.write(epilog);
        osw.flush();
        osw.close();
    
    }
    public static void main(String[] args){
    try{
                job.jobRun();
        } catch (Exception e)
        {
            System.out.println("");
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to parse a xml file using JAVA and have to create a
I have a XML schema that I will need to create Java classes for.
I tried to create a jar file from a java project, which uses some
I'd like to have a java.utils.Timer with a resettable time in java.I need to
I need a Java way to find a running Win process from which I
I need to write a java script. This is supposed to validate if the
I'm using ASANT to run a xml file which points to a NARS.jar file.
I need to generate a number of XML documents from Java objects. The objects
I will be hosting a java project on SVN which will need to be
I am on WAS 6.0.2. I need an XML file in classpath for one

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.