193
194 protected void handleEndElement() throws XMLStreamException {
195 out.writeEndElement();
196 }
197
198 protected void handleStartElement() throws XMLStreamException {
199 String nsUri = in.getNamespaceURI();
200 if(nsUri==null)
201 out.writeStartElement(in.getLocalName());
202 else
203 out.writeStartElement(
204 fixNull(in.getPrefix()),
205 in.getLocalName(),
206 nsUri
207 );
208
209 // start namespace bindings
210 int nsCount = in.getNamespaceCount();
211 for (int i = 0; i < nsCount; i++) {
212 out.writeNamespace(
213 in.getNamespacePrefix(i),
214 fixNull(in.getNamespaceURI(i))); // zephyr doesn't like null, I don't know what is correct, so just fix null to "" for now
215 }
216
217 // write attributes
218 int attCount = in.getAttributeCount();
219 for (int i = 0; i < attCount; i++) {
220 handleAttribute(i);
221 }
222 }
223
224 /**
225 * Writes out the {@code i}-th attribute of the current element.
226 *
227 * <p>
228 * Used from {@link #handleStartElement()}.
229 */
230 protected void handleAttribute(int i) throws XMLStreamException {
231 String nsUri = in.getAttributeNamespace(i);
232 String prefix = in.getAttributePrefix(i);
233 if (fixNull(nsUri).equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) {
|
193
194 protected void handleEndElement() throws XMLStreamException {
195 out.writeEndElement();
196 }
197
198 protected void handleStartElement() throws XMLStreamException {
199 String nsUri = in.getNamespaceURI();
200 if(nsUri==null)
201 out.writeStartElement(in.getLocalName());
202 else
203 out.writeStartElement(
204 fixNull(in.getPrefix()),
205 in.getLocalName(),
206 nsUri
207 );
208
209 // start namespace bindings
210 int nsCount = in.getNamespaceCount();
211 for (int i = 0; i < nsCount; i++) {
212 out.writeNamespace(
213 fixNull(in.getNamespacePrefix(i)), //StAX reader will return null for default NS
214 fixNull(in.getNamespaceURI(i))); // zephyr doesn't like null, I don't know what is correct, so just fix null to "" for now
215 }
216
217 // write attributes
218 int attCount = in.getAttributeCount();
219 for (int i = 0; i < attCount; i++) {
220 handleAttribute(i);
221 }
222 }
223
224 /**
225 * Writes out the {@code i}-th attribute of the current element.
226 *
227 * <p>
228 * Used from {@link #handleStartElement()}.
229 */
230 protected void handleAttribute(int i) throws XMLStreamException {
231 String nsUri = in.getAttributeNamespace(i);
232 String prefix = in.getAttributePrefix(i);
233 if (fixNull(nsUri).equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) {
|