xml 格式化输出
我用XStream 转出的xml是这样
- <list>
- <Contacts>
- <id>1</id>
- <name>11</name>
- <email>111</email>
- <phone>1111</phone>
- </Contacts>
- <Contacts>
- <id>2</id>
- <name>22</name>
- <email>222</email>
- <phone>2222</phone>
- </Contacts>
- <Contacts>
- <id>3</id>
- <name>33</name>
- <email>333</email>
- <phone>3333</phone>
- </Contacts>
- </list>
但我不希望吧phone暴漏出去,希望的输出结果是
- <list>
- <Contacts>
- <id>1</id>
- <name>11</name>
- <email>111</email>
- </Contacts>
- <Contacts>
- <id>2</id>
- <name>22</name>
- <email>222</email>
- </Contacts>
- <Contacts>
- <id>3</id>
- <name>33</name>
- <email>333</email>
- </Contacts>
- </list>
javabean:
- @H_404_646@public@H_404_646@classEmployee{
- @H_404_646@privateStringempNo;
- @H_404_646@privateStringjob;
- @XStreamOmitField
- @H_404_646@privateStringphone;
- @H_404_646@publicStringgetEmpNo(){
- @H_404_646@returnempNo;
- }
- @H_404_646@public@H_404_646@voidsetEmpNo(StringempNo){
- @H_404_646@this.empNo=empNo;
- }
- @H_404_646@publicStringgetJob(){
- @H_404_646@returnjob;
- }
- @H_404_646@public@H_404_646@voidsetJob(Stringjob){
- @H_404_646@this.job=job;
- }
- @H_404_646@publicStringgetPhone(){
- @H_404_646@returnphone;
- }
- @H_404_646@public@H_404_646@voidsetPhone(Stringphone){
- @H_404_646@this.phone=phone;
- }
- }