1: <?php
2: /**
3: * From Binary XML Content Format Specification Version 1.3, 25 July 2001
4: * found at http://www.wapforum.org
5: *
6: * Copyright 2003-2012 Horde LLC (http://www.horde.org/)
7: *
8: * See the enclosed file COPYING for license information (LGPL). If you
9: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
10: *
11: * @author Anthony Mills <amills@pyramid6.com>
12: * @package Xml_Wbxml
13: */
14: class Horde_Xml_Wbxml_Dtd
15: {
16: /* Constants are from Binary XML Content Format Specification Version 1.3,
17: * 25 July 2001 found at http://www.wapforum.org */
18:
19: /* Not sure where defined. */
20: const WML_1_0 = '-//WAPFORUM//DTD WML 1.0//EN';
21: const WTA_1_0 = '-//WAPFORUM//DTD WTA 1.0//EN';
22: const WML_1_1 = '-//WAPFORUM//DTD WML 1.1//EN';
23: const SI_1_1 = '-//WAPFORUM//DTD SI 1.1//EN';
24: const SL_1_0 = '-//WAPFORUM//DTD SL 1.0//EN';
25: const CO_1_0 = '-//WAPFORUM//DTD CO 1.0//EN';
26: const CHANNEL_1_1 = '-//WAPFORUM//DTD CHANNEL 1.1//EN';
27: const WML_1_2 = '-//WAPFORUM//DTD WML 1.2//EN';
28: const WML_1_3 = '-//WAPFORUM//DTD WML 1.3//EN';
29: const PROV_1_0 = '-//WAPFORUM//DTD PROV 1.0//EN';
30: const WTA_WML_1_2 = '-//WAPFORUM//DTD WTA-WML 1.2//EN';
31: const CHANNEL_1_2 = '-//WAPFORUM//DTD CHANNEL 1.2//EN';
32:
33: const SYNCML_1_0 = '-//SYNCML//DTD SyncML 1.0//EN';
34: const DEVINF_1_0 = '-//SYNCML//DTD DevInf 1.0//EN';
35: const METINF_1_0 = '-//SYNCML//DTD MetInf 1.0//EN';
36: const SYNCML_1_1 = '-//SYNCML//DTD SyncML 1.1//EN';
37: const DEVINF_1_1 = '-//SYNCML//DTD DevInf 1.1//EN';
38: const METINF_1_1 = '-//SYNCML//DTD MetInf 1.1//EN';
39: const SYNCML_1_2 = '-//SYNCML//DTD SyncML 1.2//EN';
40: const DEVINF_1_2 = '-//SYNCML//DTD DevInf 1.2//EN';
41: const METINF_1_2 = '-//SYNCML//DTD MetInf 1.2//EN';
42:
43: public $version;
44: public $intTags;
45: public $intAttributes;
46: public $strTags;
47: public $strAttributes;
48: public $intCodePages;
49: public $strCodePages;
50: public $strCodePagesURI;
51: public $URI;
52: public $XMLNS;
53: public $DPI;
54:
55: public function __construct($v)
56: {
57: $this->version = $v;
58: $this->init();
59: }
60:
61: public function init()
62: {
63: }
64:
65: public function setAttribute($intAttribute, $strAttribute)
66: {
67: $this->strAttributes[$strAttribute] = $intAttribute;
68: $this->intAttributes[$intAttribute] = $strAttribute;
69: }
70:
71: public function setTag($intTag, $strTag)
72: {
73: $this->strTags[$strTag] = $intTag;
74: $this->intTags[$intTag] = $strTag;
75: }
76:
77: public function setCodePage($intCodePage, $strCodePage, $strCodePageURI)
78: {
79: $this->strCodePagesURI[$strCodePageURI] = $intCodePage;
80: $this->strCodePages[$strCodePage] = $intCodePage;
81: $this->intCodePages[$intCodePage] = $strCodePage;
82: }
83:
84: public function toTagStr($tag)
85: {
86: return isset($this->intTags[$tag]) ? $this->intTags[$tag] : false;
87: }
88:
89: public function toAttributeStr($attribute)
90: {
91: return isset($this->intTags[$attribute]) ? $this->intTags[$attribute] : false;
92: }
93:
94: public function toCodePageStr($codePage)
95: {
96: return isset($this->intCodePages[$codePage]) ? $this->intCodePages[$codePage] : false;
97: }
98:
99: public function toTagInt($tag)
100: {
101: return isset($this->strTags[$tag]) ? $this->strTags[$tag] : false;
102: }
103:
104: public function toAttributeInt($attribute)
105: {
106: return isset($this->strAttributes[$attribute]) ? $this->strAttributes[$attribute] : false;
107: }
108:
109: public function toCodePageInt($codePage)
110: {
111: return isset($this->strCodePages[$codePage]) ? $this->strCodePages[$codePage] : false;
112: }
113:
114: public function toCodePageURI($uri)
115: {
116: $uri = Horde_String::lower($uri);
117: return isset($this->strCodePagesURI[$uri])
118: ? $this->strCodePagesURI[$uri]
119: : false;
120: }
121:
122: /**
123: * Getter for property version.
124: * @return Value of property version.
125: */
126: public function getVersion()
127: {
128: return $this->version;
129: }
130:
131: /**
132: * Setter for property version.
133: * @param integer $v New value of property version.
134: */
135: public function setVersion($v)
136: {
137: $this->version = $v;
138: }
139:
140: /**
141: * Getter for property URI.
142: * @return Value of property URI.
143: */
144: public function getURI()
145: {
146: return $this->URI;
147: }
148:
149: /**
150: * Setter for property URI.
151: * @param string $u New value of property URI.
152: */
153: public function setURI($u)
154: {
155: $this->URI = $u;
156: }
157:
158: /**
159: * Getter for property DPI.
160: * @return Value of property DPI.
161: */
162: public function getDPI()
163: {
164: return $this->DPI;
165: }
166:
167: /**
168: * Setter for property DPI.
169: * @param DPI New value of property DPI.
170: */
171: public function setDPI($d)
172: {
173: $this->DPI = $d;
174: }
175: }
176: