1 package com.android.hotspot2.omadm;
2 
3 import java.util.Map;
4 
5 public class MgmtTreeRoot extends OMAConstructed {
6     private final String mDtdRev;
7 
MgmtTreeRoot(XMLNode node, String dtdRev)8     public MgmtTreeRoot(XMLNode node, String dtdRev) {
9         super(null, MOTree.MgmtTreeTag, null, new MultiValueMap<OMANode>(),
10                 node.getTextualAttributes());
11         mDtdRev = dtdRev;
12     }
13 
MgmtTreeRoot(String dtdRev)14     public MgmtTreeRoot(String dtdRev) {
15         super(null, MOTree.MgmtTreeTag, null, "xmlns", OMAConstants.SyncML);
16         mDtdRev = dtdRev;
17     }
18 
19     @Override
toXml(StringBuilder sb)20     public void toXml(StringBuilder sb) {
21         sb.append('<').append(MOTree.MgmtTreeTag);
22         if (getAttributes() != null && !getAttributes().isEmpty()) {
23             for (Map.Entry<String, String> avp : getAttributes().entrySet()) {
24                 sb.append(' ').append(avp.getKey()).append("=\"")
25                         .append(avp.getValue()).append('"');
26             }
27         }
28         sb.append(">\n");
29 
30         sb.append('<').append(OMAConstants.SyncMLVersionTag).append('>').append(mDtdRev)
31                 .append("</").append(OMAConstants.SyncMLVersionTag).append(">\n");
32         for (OMANode child : getChildren()) {
33             child.toXml(sb);
34         }
35         sb.append("</").append(MOTree.MgmtTreeTag).append(">\n");
36     }
37 }
38