Revision 220
org.gvsig.xmlpull/library/trunk/org.gvsig.xmlpull/org.gvsig.xmlpull.prov/org.gvsig.xmlpull.prov.kxml/src/main/java/org/gvsig/xmlpull/prov/kxml/stream/KxmlXmlStreamReader.java | ||
---|---|---|
49 | 49 |
import java.io.IOException; |
50 | 50 |
import java.io.InputStream; |
51 | 51 |
|
52 |
import javax.xml.namespace.QName; |
|
53 |
import javax.xml.stream.XMLStreamReader; |
|
54 |
|
|
52 |
import org.gvsig.xmlpull.lib.api.stream.IQName; |
|
55 | 53 |
import org.gvsig.xmlpull.lib.api.stream.IXmlStreamReader; |
56 | 54 |
import org.gvsig.xmlpull.lib.api.stream.XmlStreamException; |
57 | 55 |
import org.kxml2.io.KXmlParser; |
... | ... | |
99 | 97 |
return parser.getAttributeCount(); |
100 | 98 |
} |
101 | 99 |
|
102 |
public QName getAttributeName(int i) throws XmlStreamException { |
|
103 |
return new QName(parser.getAttributeNamespace(i), parser.getAttributeName(i)); |
|
100 |
public IQName getAttributeName(int i) throws XmlStreamException {
|
|
101 |
return new KxmlQName(parser.getAttributeNamespace(i), parser.getAttributeName(i));
|
|
104 | 102 |
} |
105 | 103 |
|
106 | 104 |
public String getAttributeValue(int i) throws XmlStreamException { |
... | ... | |
122 | 120 |
* @return |
123 | 121 |
* @see org.gvsig.gpe.xml.stream.IXmlStreamReader#getName() |
124 | 122 |
*/ |
125 |
public QName getName() throws XmlStreamException { |
|
123 |
public IQName getName() throws XmlStreamException {
|
|
126 | 124 |
int eventType; |
127 | 125 |
try { |
128 | 126 |
eventType = parser.getEventType(); |
129 |
if (eventType != XMLStreamReader.START_ELEMENT
|
|
130 |
&& eventType != XMLStreamReader.END_ELEMENT
|
|
131 |
&& eventType != XMLStreamReader.PROCESSING_INSTRUCTION
|
|
132 |
&& eventType != XMLStreamReader.CHARACTERS) {
|
|
127 |
if (eventType != IXmlStreamReader.START_ELEMENT
|
|
128 |
&& eventType != IXmlStreamReader.END_ELEMENT
|
|
129 |
&& eventType != IXmlStreamReader.PROCESSING_INSTRUCTION
|
|
130 |
&& eventType != IXmlStreamReader.CHARACTERS) {
|
|
133 | 131 |
return null; |
134 | 132 |
} |
135 | 133 |
String name = parser.getName(); |
136 | 134 |
if (name != null){ |
137 | 135 |
name = name.substring(name.indexOf(":") + 1, name.length()); |
138 | 136 |
parser.getNamespace(); |
139 |
return new QName(parser.getNamespace(), name); |
|
137 |
return new KxmlQName(parser.getNamespace(), name);
|
|
140 | 138 |
} |
141 | 139 |
} catch (XmlPullParserException e) { |
142 | 140 |
return null; |
... | ... | |
158 | 156 |
|
159 | 157 |
public int next() throws XmlStreamException { |
160 | 158 |
int xmlPullEventType; |
161 |
if (getEventType()==XMLStreamReader.END_DOCUMENT)
|
|
159 |
if (getEventType()==IXmlStreamReader.END_DOCUMENT)
|
|
162 | 160 |
throw new XmlStreamException("End Document Exception! \n There aren't more items to get."); |
163 | 161 |
try { |
164 | 162 |
xmlPullEventType = parser.next(); |
... | ... | |
172 | 170 |
|
173 | 171 |
public int nextTag() throws XmlStreamException { |
174 | 172 |
int xmlPullEventType; |
175 |
if (getEventType()==XMLStreamReader.END_DOCUMENT)
|
|
173 |
if (getEventType()==IXmlStreamReader.END_DOCUMENT)
|
|
176 | 174 |
throw new XmlStreamException("End Document Exception! \n There aren't more tags to get."); |
177 | 175 |
try { |
178 | 176 |
xmlPullEventType = parser.nextTag(); |
org.gvsig.xmlpull/library/trunk/org.gvsig.xmlpull/org.gvsig.xmlpull.prov/org.gvsig.xmlpull.prov.kxml/src/main/java/org/gvsig/xmlpull/prov/kxml/stream/KxmlQName.java | ||
---|---|---|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
2 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
22 |
|
|
23 |
/* |
|
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2010 {Iver T.I.} {Task} |
|
26 |
*/ |
|
27 |
|
|
28 |
package org.gvsig.xmlpull.prov.kxml.stream; |
|
29 |
|
|
30 |
import org.gvsig.xmlpull.lib.api.stream.IQName; |
|
31 |
|
|
32 |
/** |
|
33 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a> |
|
34 |
*/ |
|
35 |
public class KxmlQName implements IQName{ |
|
36 |
private String attributeNamespace; |
|
37 |
private String attributeName; |
|
38 |
|
|
39 |
public KxmlQName(String attributeNamespace, String attributeName) { |
|
40 |
this.attributeNamespace = attributeNamespace; |
|
41 |
this.attributeName = attributeName; |
|
42 |
} |
|
43 |
|
|
44 |
public String getLocalPart() { |
|
45 |
return attributeName; |
|
46 |
} |
|
47 |
|
|
48 |
public String getNamespaceURI() { |
|
49 |
return attributeNamespace; |
|
50 |
} |
|
51 |
|
|
52 |
} |
|
53 |
|
|
0 | 54 |
Also available in: Unified diff