posted 14 years ago
I have a script which strips off a couple nodes and then writes the script to a new file. The script works fine, but the attributes are not in the same order as in the original document. For example,
<Transaction DataType="N" ProgramNumber="08201" ProgramPhase="I" OCRMailCode="" OCRCellNumber="" OCROfferId="" OCRNameControl="083545995" OCRCheckDigit="" DateKeyed="20081007" BpData="" MediaCategory="EV" MediaCode="RN" UPCcode="" CCN="" RetailAccountNo="" PromoCode="">
displays
<Transaction OCRMailCode="" DataType="N" RetailAccountNo="" ProgramNumber="08201" MediaCode="RN" UPCcode="" CCN="" OCRCheckDigit="" MediaCategory="EV" OCROfferId="" BpData="" DateKeyed="20081007" ProgramPhase="I" PromoCode="" OCRCellNumber="" OCRNameControl="083545995">
I am using the XMLParser and printing doing the following.
new XmlNodePrinter(pw).print(ASD)
Does anyone know how one can preserve the order of attributes with the script?