java - remove prefix from XML in JAXB -


i'm trying generate xml file jaxb annotations

so, i'll generate jaxb classes & package-info.java xsd

lets go :

1 - package-info.java

 //     // file generated javatm architecture xml binding(jaxb) reference implementation, v2.2.8-b130911.1802      // see <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>      // modifications file lost upon recompilation of source schema.      // generated on: 2017.01.05 @ 01:51:40 pm cet       //      @xmlschema(     xmlns = {             @xmlns(namespaceuri = "urn:oasis:names:specification:ubl:schema:xsd:commonaggregatecomponents-2",             prefix = "cac"),             @xmlns(namespaceuri = "urn:oasis:names:specification:ubl:schema:xsd:commonbasiccomponents-2",                 prefix = "cbc"),             @xmlns(namespaceuri = "urn:oasis:names:specification:ubl:schema:xsd:invoice-2",                               prefix = "") //this must empty prefix     },      elementformdefault = javax.xml.bind.annotation.xmlnsform.qualified)      package com.audaxis.compiere.osg.ei.ubl2;     import javax.xml.bind.annotation.xmlns;     import javax.xml.bind.annotation.xmlschema; 

2 - generate xml folowing code :

jaxbcontext context = jaxbcontext.newinstance(invoicetype.class);             marshaller  m       = context.createmarshaller();              m.setproperty(marshaller.jaxb_formatted_output, boolean.true);             m.setproperty(marshaller.jaxb_encoding, "utf-8");             m.setproperty(marshaller.jaxb_schema_location, tueinvoiceconstants.ublinvoiceshcemalocation);              // write file             file f = new file(system.getproperty("java.io.tmpdir"), getoutputfilenamesimple(root));               m.marshal(root, f); 

3 - result generated xml:

 <?xml version="1.0" encoding="utf-8" standalone="yes"?>     <invoice  xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:commonbasiccomponents-2"      xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:commonaggregatecomponents-2"       xmlns:ns11="urn:oasis:names:specification:ubl:schema:xsd:invoice-2"      xsi:schemalocation="urn:oasis:names:specification:ubl:schema:xsd:invoice-2 ubl-invoice-2.1.xsd">     <cbc:ublversionid>2.1</cbc:ublversionid>     <-- xml tags -->     <end xml> 

4 - can see, third namespace created prefix = ns11 , cause problems me in next step.

question : how can let generate xml without prefixes ??


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -