1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1
3 *
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Original Code is "SMS Library for the Java platform".
15 *
16 * The Initial Developer of the Original Code is Boris von Loesch.
17 * Portions created by the Initial Developer are Copyright (C) 2002
18 * the Initial Developer. All Rights Reserved.
19 *
20 * Contributor(s): Markus Eriksson
21 *
22 * ***** END LICENSE BLOCK ***** */
23 package org.marre.wap.nokia;
24
25 import java.io.IOException;
26
27 import org.marre.xml.XmlAttribute;
28 import org.marre.xml.XmlWriter;
29
30
31 public class NokiaOtaBookmark
32 {
33 protected String myName;
34 protected String myUrl;
35
36 /***
37 * Creates a Nokia Ota Browser Settings Bookmark
38 *
39 * @param name the name of the bookmark (max 50 chars)
40 * @param theUri the URI of the bookmark (max 255 chars)
41 */
42 public NokiaOtaBookmark(String name, String url)
43 {
44 myName = name;
45 myUrl = url;
46 }
47
48 public void writeXmlTo(XmlWriter xmlWriter) throws IOException
49 {
50 // <CHARACTERISTIC TYPE="BOOKMARK">
51 xmlWriter.addStartElement("CHARACTERISTIC", new XmlAttribute[]{new XmlAttribute("TYPE", "BOOKMARK")});
52
53 // <PARM NAME="NAME" VALUE="myName"/>
54 xmlWriter.addEmptyElement("PARM", new XmlAttribute[]{
55 new XmlAttribute("NAME", "NAME"),
56 new XmlAttribute("VALUE", myName)});
57 // <PARM NAME="URL" VALUE="myUrl"/>
58 xmlWriter.addEmptyElement("PARM", new XmlAttribute[]{
59 new XmlAttribute("NAME", "URL"),
60 new XmlAttribute("VALUE", myUrl)});
61
62 // </CHARACTERISTIC>
63 xmlWriter.addEndElement();
64 }
65 }