I am using JAXB to create XML file from a result set.
I used Java / Xjc utiliy to help class files using xsd. Now I am trying to create an XML file using Marshaler. I will not see the attribute in the XML file with the original tag xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
.
Public Class JAXBConstructor {Public Zero Generated XML Document (File xmlDocument) {try {JAXBContext jaxbContext = JAXBContext.newInstance ("com"); Marshall Marshaller = Jacob Contantete .Creat Marshler (); Marshaller.setProperty (Marshall JAXB_FRAGMENT, true); Marshaller.setProperty (Marshaler. JAXB_FORMATTED_OUTPUT, true); Com.ObjectFactory factory = new com.ObjectFactory (); USERTASKSImpl userTasks = (USERTASKSImpl) (factory.createUSERTASKS ()); USERTASKTypeImpl userTaskType = (USERTASKTypeImpl) (factory.createUSERTASKSTypeUSERTASKType ()); UserTaskType.setName ("zmannan"); UserTaskType.setCode ("G5023920"); Java.util.List userTaskList = userTasks.getUSERTASK (); UserTaskList.add (userTaskType); Marshaller.marshal (User Task, New FileOutputStream ("User_Task.xml")); }
Code Output: There is no XMLSchema value -
How can I add schema-instance values in the root tag?
Comments
Post a Comment