66 |
private boolean inStartElement; |
private boolean inStartElement; |
67 |
private boolean emptyElement; |
private boolean emptyElement; |
68 |
private NamespaceSupport namespaces; |
private NamespaceSupport namespaces; |
69 |
|
private int count = 0; |
70 |
|
|
71 |
protected XMLStreamWriterImpl(Writer writer, String encoding, |
protected XMLStreamWriterImpl(Writer writer, String encoding, |
72 |
boolean prefixDefaulting) |
boolean prefixDefaulting) |
129 |
if (!isDeclared) |
if (!isDeclared) |
130 |
{ |
{ |
131 |
if (prefixDefaulting) |
if (prefixDefaulting) |
132 |
prefix = XMLConstants.DEFAULT_NS_PREFIX; |
prefix = createPrefix(); |
133 |
else |
else |
134 |
throw new XMLStreamException("namespace " + namespaceURI + |
throw new XMLStreamException("namespace " + namespaceURI + |
135 |
" has not been declared"); |
" has not been declared"); |
141 |
writer.write(':'); |
writer.write(':'); |
142 |
} |
} |
143 |
writer.write(localName); |
writer.write(localName); |
144 |
if (prefixDefaulting && !isDeclared) |
inStartElement = true; |
145 |
|
if (!isDeclared) |
146 |
{ |
{ |
147 |
writeNamespace(prefix, namespaceURI); |
writeNamespace(prefix, namespaceURI); |
148 |
} |
} |
149 |
|
|
150 |
elements.addLast(new String[] { prefix, localName }); |
elements.addLast(new String[] { prefix, localName }); |
|
inStartElement = true; |
|
151 |
} |
} |
152 |
catch (IOException e) |
catch (IOException e) |
153 |
{ |
{ |
157 |
} |
} |
158 |
} |
} |
159 |
|
|
160 |
|
protected String createPrefix() |
161 |
|
{ |
162 |
|
return "ns" + (count++); |
163 |
|
} |
164 |
|
|
165 |
public void writeStartElement(String prefix, String localName, |
public void writeStartElement(String prefix, String localName, |
166 |
String namespaceURI) |
String namespaceURI) |
167 |
throws XMLStreamException |
throws XMLStreamException |