C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » XML »

Generate XML Response


Posted Date: 16 Nov 2008    Resource Type: Code Snippets    Category: XML
Author: mahendrakiranMember Level: Gold    
Rating: 1 out of 5Points: 7



This sample code snippet shows how to generate XML response.


package com.cfnarcintegration.processor.parsing.outputxml.Seters;

import java.io.FileWriter;
import java.io.Writer;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import com.cfnarcintegration.processor.parsing.outputxml.CFNOutput;
import com.cfnarcintegration.processor.parsing.outputxml.impl.CFNOutputImpl;
import com.cfnarcintegration.processor.parsing.outputxml.impl.MessageInfoImpl;
import com.cfnarcintegration.processor.parsing.outputxml.impl.CurrentPortfolioImpl;
import com.cfnarcintegration.processor.parsing.outputxml.CurrentPortfolio;

/* This Class Generate xmlArcoutput.xml file */
public class GenerateXMLResponce {
/* The method generate xml response @param pWriter @throws JAXBException */

public static void generateXMLResponse(Writer pWriter) throws JAXBException
{

CFNOutput cfnoutput = new CFNOutputImpl();
SetMessageInfo smi = new SetMessageInfo();
SetClient sc = new SetClient();
SetContractInformation sci = new SetContractInformation();
SetCurrentPortfolio scp = new SetCurrentPortfolio();
SetProjectedPortfolio spp = new SetProjectedPortfolio();
SetLot st = new SetLot();
SetPosition sp = new SetPosition();
SetCurrentPosition scposition = new SetCurrentPosition();
CurrentPortfolio currentportfolio = new CurrentPortfolioImpl();
cfnoutput.setMessageInfo(new MessageInfoImpl());
smi.setMessageInfo(cfnoutput);
sc.setClient(cfnoutput);
sci.setContractInformation(cfnoutput);
scp.setCurrentPortfolio(cfnoutput);
spp.setProjectedPortfolio(cfnoutput);
//CalPositionValues cpv=new CalPositionValues();
//cpv.calPositionValues(cfnoutput);
JAXBContext context = JAXBContext.newInstance("com.cfnarcintegration.processor.parsing.outputxml");
Marshaller marshaller = context.createMarshaller();
marshaller.marshal(cfnoutput, pWriter);
}

public static void main(String[] args) throws Exception
{
FileWriter fw = new FileWriter("c:\\Test\\xmlArcoutput.xml");
generateXMLResponse(fw);
fw.close();
}

}



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: XML nodes in tree view
Previous Resource: Validate an XML against Schema
Return to Discussion Resource Index
Post New Resource
Category: XML


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use