How to instantiate an empty element with JAXB

前端 未结 4 1470
-上瘾入骨i
-上瘾入骨i 2020-12-10 04:30

I use JAXB to create XML messages. The XML I need to create is (for the sake of simplicity):


  
4条回答
  •  借酒劲吻你
    2020-12-10 04:56

    An empty tag for a String object is essentially the empty string.

    If you call the following, you will get what you are looking for:

    request.setHeader("")
    

    I should also note that in XML the following two declarations of a header are idential. Both of these have no child text nodes. These are essentially the same and will be treated the same by all XML parsers:

提交回复
热议问题