You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by di...@apache.org on 2006/04/04 14:01:42 UTC
svn commit: r391280 -
/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java
Author: dims
Date: Tue Apr 4 05:01:40 2006
New Revision: 391280
URL: http://svn.apache.org/viewcvs?rev=391280&view=rev
Log:
use a single XOP namespace. don't keep creating it
Modified:
webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java
Modified: webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java?rev=391280&r1=391279&r2=391280&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/src/org/apache/axiom/om/impl/llom/OMTextImpl.java Tue Apr 4 05:01:40 2006
@@ -37,6 +37,12 @@
import java.io.InputStream;
public class OMTextImpl extends OMNodeImpl implements OMText, OMConstants {
+ /**
+ * Field nameSpace used when serializing Binary stuff as MTOM optimized.
+ */
+ public static final OMNamespace XOP_NS = new OMNamespaceImpl(
+ "http://www.w3.org/2004/08/xop/include", "xop");
+
protected String value = null;
protected OMNamespace textNS;
@@ -61,11 +67,6 @@
private Object dataHandlerObject = null;
/**
- * Field nameSpace used when serializing Binary stuff as MTOM optimized.
- */
- protected OMNamespace xopNS = null;
-
- /**
* Field localName used when serializing Binary stuff as MTOM optimized.
*/
protected String localName = "Include";
@@ -93,8 +94,6 @@
super(factory);
this.value = s;
this.nodeType = nodeType;
- this.xopNS = new OMNamespaceImpl(
- "http://www.w3.org/2004/08/xop/include", "xop");
}
/**
@@ -113,8 +112,6 @@
this.value = text;
done = true;
this.nodeType = nodeType;
- this.xopNS = new OMNamespaceImpl(
- "http://www.w3.org/2004/08/xop/include", "xop");
}
@@ -129,8 +126,6 @@
this.value = text.getLocalPart();
done = true;
this.nodeType = nodeType;
- this.xopNS = new OMNamespaceImpl(
- "http://www.w3.org/2004/08/xop/include", "xop");
}
/**
@@ -176,8 +171,6 @@
this.optimize = optimize;
done = true;
this.nodeType = TEXT_NODE;
- this.xopNS = new OMNamespaceImpl(
- "http://www.w3.org/2004/08/xop/include", "xop");
}
/**
@@ -195,8 +188,6 @@
this.isBinary = true;
this.builder = builder;
this.nodeType = TEXT_NODE;
- this.xopNS = new OMNamespaceImpl(
- "http://www.w3.org/2004/08/xop/include", "xop");
}
/**
@@ -419,42 +410,21 @@
*/
private void serializeStartpart(XMLStreamWriter writer)
throws XMLStreamException {
- String nameSpaceName;
- String writer_prefix;
- String prefix;
- if (this.xopNS != null) {
- nameSpaceName = this.xopNS.getName();
- writer_prefix = writer.getPrefix(nameSpaceName);
- prefix = this.xopNS.getPrefix();
- if (nameSpaceName != null) {
- if (writer_prefix != null) {
- writer
- .writeStartElement(nameSpaceName, this
- .getLocalName());
- } else {
- if (prefix != null) {
- writer.writeStartElement(prefix, this.getLocalName(),
- nameSpaceName);
- //TODO FIX ME
- //writer.writeNamespace(prefix, nameSpaceName);
- writer.setPrefix(prefix, nameSpaceName);
- } else {
- writer.writeStartElement(nameSpaceName, this
- .getLocalName());
- writer.writeDefaultNamespace(nameSpaceName);
- writer.setDefaultNamespace(nameSpaceName);
- }
- }
- } else {
- writer.writeStartElement(this.getLocalName());
- }
+ String nameSpaceName = XOP_NS.getName();
+ String writer_prefix = writer.getPrefix(nameSpaceName);
+ String prefix = XOP_NS.getPrefix();
+ if (writer_prefix != null) {
+ writer.writeStartElement(nameSpaceName, this
+ .getLocalName());
} else {
- writer.writeStartElement(this.getLocalName());
+ writer.writeStartElement(prefix, this.getLocalName(),
+ nameSpaceName);
+ writer.setPrefix(prefix, nameSpaceName);
}
// add the elements attribute "href"
serializeAttribute(this.attribute, writer);
// add the namespace
- serializeNamespace(this.xopNS, writer);
+ serializeNamespace(XOP_NS, writer);
}
/**