java - XML Data is sorted -


I am creating XML code using Java. See my code snippet.

  document document = null; String xml = ""; Reports Oado objReportsDAO = Faucet; Try {logger.info ("Getting XML data to start consumer reports ..."); ObjReportsDAO = new reportsDo (); List Consumable DTOLT = OZRportsAO.JetConstitutional Data (Issued, Issued, Employee Type, Item Code, ItemName, ClassName, Transaction Formad, TransactionToadet, MachineCode, Work Order Number, JobName, Customer ID); Documentbuilder Factory Factory = Document Builder. Firmware (); DocumentBuilder Builder = Factory. NE DocumentBuilder (); Document = builder.newDocument (); Element root aliment = (element) document.createElement ("item"); Document.appendChild (rootElmnt); Element LLMT = Faucet; Consumable DTO objConsumableDTO = Faucet; SimpleDetformSDF = New SimpleDetermate ("MM / DD / Yay"); (Int i = 0; i & lt; consumableDTOLst.size (); i ++) {objConsumableDTO = (Consumable DTO) consumable DTOlst .get (I); LLMT = (element) document. CreateElement ("item"); Elmt.setAttribute ("issued", objConsumableDTO.getIssuedBy ()); Elmt.setAttribute ("issued", objConsumableDTO.getIssuedTo ()); Elmt.setAttribute ("EMPLOYECADRE", objConsumableDTO.getEmployeeType ()); Elmt.setAttribute ("ITEMCODE", objConsumableDTO.getItemCode ()); Elmt.setAttribute ("ITEMNAME", objConsumableDTO.getItemName ()); Elmt.setAttribute ("ITEMCLASS", objConsumableDTO.getClassName ()); Elmt.setAttribute ("DATE", sdf.format (objConsumableDTO.getTransactionDate ())); Elmt.setAttribute ("machinecode", objConsumableDTO.getMachineCode ()); Elmt.setAttribute ("JOB", objConsumableDTO.getJobName ()); Elmt.setAttribute ("WORKORDERNUMBER", objConsumableDTO.getWorkOrderNumber ()); Elmt.setAttribute ("Customer Name", objConsumableDTO.getCustomerName ()); Elmt.setAttribute ("Roleplay", objConsumableDTO.getGroupName ()); Elmt.setAttribute ("Seller Name", objConsumableDTO.getVendorName ()); Elmt.setAttribute ("QTY", String.valueOf (Math.abs (objConsumableDTO.getQuantity ())); Elmt.setAttribute ("Entity Details", objConsumableDTO.getUnitDescription ()); Elmt.setAttribute ("RATEPERQTY", String.valueOf (objConsumableDTO.getRate ())); Elmt.setAttribute ("AMOUNT", string.value (objConsumableDTO.getAmount ())); RootElmnt.appendChild (elmt); }  

The problem is that all the features are automatically sorted, how to prevent it?

For example,

  & lt; Empdetails age = "25" name = "john" />  

but I want

  & lt; Empdetails name = "john" age = "25" />  

Please suggest some suggestion.

Duplicate:

From:

Duplicate:

From: / P>

See section 3.1 of XML Recommendation. It says, "Note that the sequence of attribute specifications is not important in the start-tag or empty-element tag."

If a software requires features on XML elements in a particular order, that software is not processing XML, it is processing text that looks extensively like XML Need to decide.

If this can not be decided, and you have to create files according to your needs, then you can not make reliable use of standard XML tools to create those files.

Credit


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -