Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package kontrolltoo;
- import DB.Database;
- import XML.Continent;
- import XML.Continents;
- import XML.CurrencyXML;
- import java.io.File;
- import java.io.IOException;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Set;
- import javax.xml.bind.JAXBContext;
- import javax.xml.bind.JAXBException;
- import javax.xml.bind.Marshaller;
- public class Kontrolltoo {
- // public static List<Currency> andmed =JSONData.data;
- public static Set<CurrencyXML> currEu =CurrencyData.currEu;
- public static Set<CurrencyXML> currAsia =CurrencyData.currAsia;
- public static Set<CurrencyXML> currUSA =CurrencyData.currUSA;
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) throws IOException, JAXBException {
- // TODO code application logic here
- //DB
- Database.main(args);
- //XML
- //continentidesse currency lisamine.
- List<Continent> continents = new ArrayList<>();
- Continent continent1 = new Continent("Europe",currEu);
- Continent continent2 = new Continent("Asia",currAsia);
- Continent continent3 = new Continent("North America",currUSA);
- //info lisamine listi
- continents.add(continent1);
- JAXBContext context = JAXBContext.newInstance(Continents.class);
- //XML faili loomine loodud andmetega
- Continents toXml = new Continents();
- toXml.setContinents(continents);
- Marshaller marshaller = context.createMarshaller();
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
- marshaller.marshal(toXml, new File("CurrencyXML.xml"));
- }
- }
Add Comment
Please, Sign In to add comment