You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by zi...@apache.org on 2004/04/09 11:20:24 UTC
cvs commit: xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal MarshalResult.java
zieg 2004/04/09 02:20:24
Modified: v2/src/common/org/apache/xmlbeans/impl/common
XmlReaderToWriter.java
v2/src/marshal/org/apache/xmlbeans/impl/marshal
MarshalResult.java
Log:
very minor code cleanup
Revision Changes Path
1.3 +2 -2 xml-xmlbeans/v2/src/common/org/apache/xmlbeans/impl/common/XmlReaderToWriter.java
Index: XmlReaderToWriter.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/common/org/apache/xmlbeans/impl/common/XmlReaderToWriter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XmlReaderToWriter.java 12 Feb 2004 20:06:08 -0000 1.2
+++ XmlReaderToWriter.java 9 Apr 2004 09:20:24 -0000 1.3
@@ -56,12 +56,12 @@
writer.writeStartElement(localName);
}
- for (int i = 0; i < xmlr.getNamespaceCount(); i++) {
+ for (int i = 0, len = xmlr.getNamespaceCount(); i < len; i++) {
writer.writeNamespace(xmlr.getNamespacePrefix(i),
xmlr.getNamespaceURI(i));
}
- for (int i = 0; i < xmlr.getAttributeCount(); i++) {
+ for (int i = 0, len = xmlr.getAttributeCount(); i < len; i++) {
String attUri = xmlr.getAttributeNamespace(i);
if (attUri != null)
writer.writeAttribute(attUri,
1.24 +34 -35 xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshalResult.java
Index: MarshalResult.java
===================================================================
RCS file: /home/cvs/xml-xmlbeans/v2/src/marshal/org/apache/xmlbeans/impl/marshal/MarshalResult.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- MarshalResult.java 8 Apr 2004 19:03:44 -0000 1.23
+++ MarshalResult.java 9 Apr 2004 09:20:24 -0000 1.24
@@ -124,6 +124,40 @@
}
}
+ private int advanceToNext()
+ throws XmlException
+ {
+ final int next_state = currVisitor.advance();
+ switch (next_state) {
+ case XmlTypeVisitor.CONTENT:
+ pushVisitor(currVisitor);
+ currVisitor = currVisitor.getCurrentChild();
+ return START_ELEMENT;
+ case XmlTypeVisitor.CHARS:
+ pushVisitor(currVisitor);
+ currVisitor = currVisitor.getCurrentChild();
+ return CHARACTERS;
+ case XmlTypeVisitor.END:
+ return END_ELEMENT;
+ default:
+ throw new AssertionError("bad state: " + next_state);
+ }
+ }
+
+ private void pushVisitor(XmlTypeVisitor v)
+ {
+ visitorStack.push(v);
+ namespaceContext.openScope();
+ initedAttributes = false;
+ }
+
+ private XmlTypeVisitor popVisitor()
+ {
+ namespaceContext.closeScope();
+ final XmlTypeVisitor tv = (XmlTypeVisitor)visitorStack.pop();
+ return tv;
+ }
+
QName fillPrefix(final QName pname)
{
final String uri = pname.getNamespaceURI();
@@ -191,41 +225,6 @@
{
return getRuntimeTypeFactory().createRuntimeType(type, typeTable,
bindingLoader);
- }
-
-
- private int advanceToNext()
- throws XmlException
- {
- final int next_state = currVisitor.advance();
- switch (next_state) {
- case XmlTypeVisitor.CONTENT:
- pushVisitor(currVisitor);
- currVisitor = currVisitor.getCurrentChild();
- return START_ELEMENT;
- case XmlTypeVisitor.CHARS:
- pushVisitor(currVisitor);
- currVisitor = currVisitor.getCurrentChild();
- return CHARACTERS;
- case XmlTypeVisitor.END:
- return END_ELEMENT;
- default:
- throw new AssertionError("bad state: " + next_state);
- }
- }
-
- private void pushVisitor(XmlTypeVisitor v)
- {
- visitorStack.push(v);
- namespaceContext.openScope();
- initedAttributes = false;
- }
-
- private XmlTypeVisitor popVisitor()
- {
- namespaceContext.closeScope();
- final XmlTypeVisitor tv = (XmlTypeVisitor)visitorStack.pop();
- return tv;
}
public void require(int i, String s, String s1)
---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org