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 gd...@apache.org on 2007/03/07 15:59:13 UTC
svn commit: r515594 [8/19] - in
/webservices/commons/trunk/modules/axiom/modules:
axiom-api/src/main/java/org/apache/axiom/attachments/
axiom-api/src/main/java/org/apache/axiom/attachments/utils/
axiom-api/src/main/java/org/apache/axiom/om/ axiom-api/s...
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/ParentNode.java Wed Mar 7 06:59:00 2007
@@ -36,7 +36,6 @@
import org.w3c.dom.NodeList;
import javax.xml.namespace.QName;
-
import java.util.Iterator;
public abstract class ParentNode extends ChildNode implements OMContainerEx {
@@ -45,9 +44,7 @@
protected ChildNode lastChild;
- /**
- * @param ownerDocument
- */
+ /** @param ownerDocument */
protected ParentNode(DocumentImpl ownerDocument, OMFactory factory) {
super(ownerDocument, factory);
}
@@ -61,17 +58,17 @@
// /
public void addChild(OMNode omNode) {
- if (omNode.getOMFactory() instanceof OMDOMFactory) {
- Node domNode= (Node)omNode;
- if(this.ownerNode != null && !domNode.getOwnerDocument().equals(this.ownerNode)) {
+ if (omNode.getOMFactory() instanceof OMDOMFactory) {
+ Node domNode = (Node) omNode;
+ if (this.ownerNode != null && !domNode.getOwnerDocument().equals(this.ownerNode)) {
this.appendChild(this.ownerNode.importNode(domNode, true));
} else {
this.appendChild(domNode);
}
- } else {
- addChild(importNode(omNode));
- }
-
+ } else {
+ addChild(importNode(omNode));
+ }
+
}
public void buildNext() {
@@ -85,9 +82,8 @@
/**
* Returns an iterator of child nodes having a given qname.
- *
- * @see org.apache.axiom.om.OMContainer#getChildrenWithName
- * (javax.xml.namespace.QName)
+ *
+ * @see org.apache.axiom.om.OMContainer#getChildrenWithName (javax.xml.namespace.QName)
*/
public Iterator getChildrenWithName(QName elementQName) throws OMException {
return new OMChildrenQNameIterator(getFirstOMChild(), elementQName);
@@ -95,14 +91,13 @@
/**
* Returns the first OMElement child node.
- *
- * @see org.apache.axiom.om.OMContainer#getFirstChildWithName
- * (javax.xml.namespace.QName)
+ *
+ * @see org.apache.axiom.om.OMContainer#getFirstChildWithName (javax.xml.namespace.QName)
*/
public OMElement getFirstChildWithName(QName elementQName)
throws OMException {
Iterator children = new OMChildrenQNameIterator(getFirstOMChild(),
- elementQName);
+ elementQName);
while (children.hasNext()) {
OMNode node = (OMNode) children.next();
@@ -158,8 +153,8 @@
}
/**
- * Inserts newChild before the refChild. If the refChild is null then the
- * newChild is made the last child.
+ * Inserts newChild before the refChild. If the refChild is null then the newChild is made the
+ * last child.
*/
public Node insertBefore(Node newChild, Node refChild) throws DOMException {
@@ -168,12 +163,12 @@
if (this == newChild || !isAncestor(newChild)) {
throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "HIERARCHY_REQUEST_ERR", null));
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "HIERARCHY_REQUEST_ERR", null));
}
-
- if(newDomChild.parentNode != null && newDomChild.ownerNode == this.ownerNode) {
+
+ if (newDomChild.parentNode != null && newDomChild.ownerNode == this.ownerNode) {
//If the newChild is already in the tree remove it
newDomChild.parentNode.removeChild(newDomChild);
}
@@ -181,16 +176,16 @@
if (!(this instanceof Document)
&& !(this.ownerNode == newDomChild.getOwnerDocument())) {
throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "WRONG_DOCUMENT_ERR", null));
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "WRONG_DOCUMENT_ERR", null));
}
if (this.isReadonly()) {
throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "NO_MODIFICATION_ALLOWED_ERR", null));
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "NO_MODIFICATION_ALLOWED_ERR", null));
}
if (this instanceof Document) {
@@ -198,9 +193,9 @@
&& !(newDomChild instanceof CommentImpl)) {
// Throw exception since there cannot be two document elements
throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "HIERARCHY_REQUEST_ERR", null));
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "HIERARCHY_REQUEST_ERR", null));
} else if (newDomChild instanceof ElementImpl) {
if (newDomChild.parentNode == null) {
newDomChild.parentNode = this;
@@ -237,16 +232,16 @@
if (tempNode.equals(refChild)) {
// RefChild found
if (this.firstChild == tempNode) { // If the refChild is the
- // first child
+ // first child
if (newChild instanceof DocumentFragmentImpl) {
// The new child is a DocumentFragment
DocumentFragmentImpl docFrag =
- (DocumentFragmentImpl) newChild;
+ (DocumentFragmentImpl) newChild;
this.firstChild = docFrag.firstChild;
docFrag.lastChild.nextSibling = refDomChild;
- refDomChild.previousSibling =
- docFrag.lastChild.nextSibling;
+ refDomChild.previousSibling =
+ docFrag.lastChild.nextSibling;
} else {
@@ -259,7 +254,7 @@
this.firstChild.isFirstChild(true);
refDomChild.isFirstChild(false);
newDomChild.previousSibling = null; // Just to be
- // sure :-)
+ // sure :-)
}
} else { // If the refChild is not the fist child
@@ -268,7 +263,7 @@
if (newChild instanceof DocumentFragmentImpl) {
// the newChild is a document fragment
DocumentFragmentImpl docFrag =
- (DocumentFragmentImpl) newChild;
+ (DocumentFragmentImpl) newChild;
previousNode.nextSibling = docFrag.firstChild;
docFrag.firstChild.previousSibling = previousNode;
@@ -292,9 +287,9 @@
if (!found) {
throw new DOMException(DOMException.NOT_FOUND_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "NOT_FOUND_ERR", null));
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "NOT_FOUND_ERR", null));
}
if (newDomChild.parentNode == null) {
@@ -305,36 +300,34 @@
}
}
- /**
- * Replaces the oldChild with the newChild.
- */
+ /** Replaces the oldChild with the newChild. */
public Node replaceChild(Node newChild, Node oldChild) throws DOMException {
ChildNode newDomChild = (ChildNode) newChild;
ChildNode oldDomChild = (ChildNode) oldChild;
- if(newChild == null) {
+ if (newChild == null) {
return this.removeChild(oldChild);
}
-
+
if (this == newChild || !isAncestor(newChild)) {
throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "HIERARCHY_REQUEST_ERR", null));
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "HIERARCHY_REQUEST_ERR", null));
}
if (newDomChild != null && !this.ownerNode.equals(newDomChild.ownerNode)) {
throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "WRONG_DOCUMENT_ERR", null));
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "WRONG_DOCUMENT_ERR", null));
}
if (this.isReadonly()) {
throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "NO_MODIFICATION_ALLOWED_ERR", null));
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "NO_MODIFICATION_ALLOWED_ERR", null));
}
Iterator children = this.getChildren();
@@ -344,27 +337,27 @@
if (tempNode.equals(oldChild)) {
if (newChild instanceof DocumentFragmentImpl) {
DocumentFragmentImpl docFrag =
- (DocumentFragmentImpl) newDomChild;
+ (DocumentFragmentImpl) newDomChild;
ChildNode child = (ChildNode) docFrag.getFirstChild();
this.replaceChild(child, oldChild);
- if(child != null) {
+ if (child != null) {
child.parentNode = this;
}
} else {
if (this.firstChild == oldDomChild) {
-
- if(this.firstChild.nextSibling != null) {
+
+ if (this.firstChild.nextSibling != null) {
this.firstChild.nextSibling.previousSibling = newDomChild;
newDomChild.nextSibling = this.firstChild.nextSibling;
}
-
+
//Cleanup the current first child
this.firstChild.parentNode = null;
this.firstChild.nextSibling = null;
-
+
//Set the new first child
this.firstChild = newDomChild;
-
+
} else {
newDomChild.nextSibling = oldDomChild.nextSibling;
newDomChild.previousSibling = oldDomChild.previousSibling;
@@ -379,7 +372,7 @@
}
}
-
+
newDomChild.parentNode = this;
}
found = true;
@@ -393,23 +386,21 @@
if (!found)
throw new DOMException(DOMException.NOT_FOUND_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR",
- null));
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR",
+ null));
return oldChild;
}
- /**
- * Removes the given child from the DOM Tree.
- */
+ /** Removes the given child from the DOM Tree. */
public Node removeChild(Node oldChild) throws DOMException {
// Check if this node is readonly
if (this.isReadonly()) {
throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "NO_MODIFICATION_ALLOWED_ERR", null));
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "NO_MODIFICATION_ALLOWED_ERR", null));
}
// Check if the Child is there
@@ -449,9 +440,9 @@
if (!childFound)
throw new DOMException(DOMException.NOT_FOUND_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR",
- null));
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR",
+ null));
return oldChild;
}
@@ -475,82 +466,84 @@
// Then, if deep, clone the kids too.
if (deep) {
- for (ChildNode child = firstChild; child != null;
- child = child.nextSibling) {
+ for (ChildNode child = firstChild; child != null;
+ child = child.nextSibling) {
newnode.appendChild(child.cloneNode(true));
}
}
return newnode;
}
-
- /**
- * This method is intended only to be used by Axiom intenals when merging Objects
- * from different Axiom implementations to the DOOM implementation.
- *
- * @param child
- */
- protected OMNode importNode(OMNode child) {
- int type = child.getType();
- switch (type) {
- case (OMNode.ELEMENT_NODE): {
- OMElement childElement = (OMElement) child;
- OMElement newElement = (new StAXOMBuilder(this.factory,
- childElement.getXMLStreamReader())).getDocumentElement();
- newElement.build();
- return (OMNode) this.ownerNode.importNode((Element) newElement,
- true);
- }
- case (OMNode.TEXT_NODE): {
- OMText importedText = (OMText) child;
- OMText newText;
- if (importedText.isBinary()) {
- boolean isOptimize = importedText.isOptimized();
- newText = this.factory.createOMText(importedText
- .getDataHandler(), isOptimize);
- } else if (importedText.getNamespace() != null) {
- newText = this.factory.createOMText(this, importedText
- .getTextAsQName(), importedText.getType());
- } else if (importedText.isCharacters()) {
- newText = new TextImpl((DocumentImpl) this.getOwnerDocument(),
- importedText.getTextCharacters(), this.factory);
- } else {
- newText = new TextImpl((DocumentImpl) this.getOwnerDocument(),
- importedText.getText(), this.factory);
- }
- return newText;
- }
-
- case (OMNode.PI_NODE): {
- OMProcessingInstruction importedPI = (OMProcessingInstruction) child;
- OMProcessingInstruction newPI = this.factory
- .createOMProcessingInstruction(this,
- importedPI.getTarget(), importedPI.getValue());
- return newPI;
- }
- case (OMNode.COMMENT_NODE): {
- OMComment importedComment = (OMComment) child;
- OMComment newComment = this.factory.createOMComment(this,
- importedComment.getValue());
- DocumentImpl doc;
- if (this instanceof DocumentImpl) {
- doc = (DocumentImpl) this;
- } else {
- doc = (DocumentImpl) ((ParentNode) this).getOwnerDocument();
- }
- newComment = new CommentImpl(doc, importedComment.getValue(),
- this.factory);
- return newComment;
- }
- case (OMNode.DTD_NODE): {
- OMDocType importedDocType = (OMDocType) child;
- OMDocType newDocType = this.factory.createOMDocType(this,
- importedDocType.getValue());
- return newDocType;
- }
- default: {
- throw new UnsupportedOperationException(
- "Not Implemented Yet for the given node type");
- }
- }
- }
+
+ /**
+ * This method is intended only to be used by Axiom intenals when merging Objects from different
+ * Axiom implementations to the DOOM implementation.
+ *
+ * @param child
+ */
+ protected OMNode importNode(OMNode child) {
+ int type = child.getType();
+ switch (type) {
+ case (OMNode.ELEMENT_NODE): {
+ OMElement childElement = (OMElement) child;
+ OMElement newElement = (new StAXOMBuilder(this.factory,
+ childElement.getXMLStreamReader()))
+ .getDocumentElement();
+ newElement.build();
+ return (OMNode) this.ownerNode.importNode((Element) newElement,
+ true);
+ }
+ case (OMNode.TEXT_NODE): {
+ OMText importedText = (OMText) child;
+ OMText newText;
+ if (importedText.isBinary()) {
+ boolean isOptimize = importedText.isOptimized();
+ newText = this.factory.createOMText(importedText
+ .getDataHandler(), isOptimize);
+ } else if (importedText.getNamespace() != null) {
+ newText = this.factory.createOMText(this, importedText
+ .getTextAsQName(), importedText.getType());
+ } else if (importedText.isCharacters()) {
+ newText = new TextImpl((DocumentImpl) this.getOwnerDocument(),
+ importedText.getTextCharacters(), this.factory);
+ } else {
+ newText = new TextImpl((DocumentImpl) this.getOwnerDocument(),
+ importedText.getText(), this.factory);
+ }
+ return newText;
+ }
+
+ case (OMNode.PI_NODE): {
+ OMProcessingInstruction importedPI = (OMProcessingInstruction) child;
+ OMProcessingInstruction newPI = this.factory
+ .createOMProcessingInstruction(this,
+ importedPI.getTarget(),
+ importedPI.getValue());
+ return newPI;
+ }
+ case (OMNode.COMMENT_NODE): {
+ OMComment importedComment = (OMComment) child;
+ OMComment newComment = this.factory.createOMComment(this,
+ importedComment.getValue());
+ DocumentImpl doc;
+ if (this instanceof DocumentImpl) {
+ doc = (DocumentImpl) this;
+ } else {
+ doc = (DocumentImpl) ((ParentNode) this).getOwnerDocument();
+ }
+ newComment = new CommentImpl(doc, importedComment.getValue(),
+ this.factory);
+ return newComment;
+ }
+ case (OMNode.DTD_NODE): {
+ OMDocType importedDocType = (OMDocType) child;
+ OMDocType newDocType = this.factory.createOMDocType(this,
+ importedDocType.getValue());
+ return newDocType;
+ }
+ default: {
+ throw new UnsupportedOperationException(
+ "Not Implemented Yet for the given node type");
+ }
+ }
+ }
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextImpl.java Wed Mar 7 06:59:00 2007
@@ -16,13 +16,20 @@
package org.apache.axiom.om.impl.dom;
import org.apache.axiom.attachments.utils.DataHandlerUtils;
-import org.apache.axiom.om.*;
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMText;
+import org.apache.axiom.om.OMXMLParserWrapper;
import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
import org.apache.axiom.om.impl.OMNamespaceImpl;
import org.apache.axiom.om.impl.builder.XOPBuilder;
-import org.apache.axiom.om.util.Base64;
-import org.apache.axiom.om.util.UUIDGenerator;
import org.apache.axiom.om.util.TextHelper;
+import org.apache.axiom.om.util.UUIDGenerator;
import org.w3c.dom.DOMException;
import org.w3c.dom.Node;
import org.w3c.dom.Text;
@@ -42,42 +49,34 @@
private boolean isBinary;
private String contentID = null;
-
+
protected OMNamespace textNS = null;
-
+
protected char[] charArray;
/**
- * Field dataHandler contains the DataHandler. Declaring as Object to remove
- * the dependency on Javax.activation.DataHandler
+ * Field dataHandler contains the DataHandler. Declaring as Object to remove the dependency on
+ * Javax.activation.DataHandler
*/
private Object dataHandlerObject = null;
- /**
- * Field nameSpace is used when serializing Binary stuff as MTOM optimized.
- */
+ /** Field nameSpace is used when serializing Binary stuff as MTOM optimized. */
protected OMNamespace ns = null;
- /**
- * Field localName is used when serializing Binary stuff as MTOM optimized.
- */
+ /** Field localName is used when serializing Binary stuff as MTOM optimized. */
protected String localName = "Include";
- /**
- * Field attribute is used when serializing Binary stuff as MTOM optimized.
- */
+ /** Field attribute is used when serializing Binary stuff as MTOM optimized. */
protected OMAttribute attribute;
- /**
- * Field nameSpace used when serializing Binary stuff as MTOM optimized.
- */
+ /** 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");
-
+
/**
- * Creates a text node with the given text required by the OMDOMFactory. The
- * owner document should be set properly when appending this to a DOM tree.
- *
+ * Creates a text node with the given text required by the OMDOMFactory. The owner document
+ * should be set properly when appending this to a DOM tree.
+ *
* @param text
*/
public TextImpl(String text, OMFactory factory) {
@@ -91,13 +90,12 @@
/**
* @param contentID
* @param parent
- * @param builder
- * Used when the builder is encountered with a XOP:Include tag
- * Stores a reference to the builder and the content-id. Supports
- * deffered parsing of MIME messages
+ * @param builder Used when the builder is encountered with a XOP:Include tag Stores a
+ * reference to the builder and the content-id. Supports deffered parsing of
+ * MIME messages
*/
public TextImpl(String contentID, OMContainer parent,
- OMXMLParserWrapper builder, OMFactory factory) {
+ OMXMLParserWrapper builder, OMFactory factory) {
super((DocumentImpl) ((ParentNode) parent).getOwnerDocument(), factory);
this.contentID = contentID;
this.optimize = true;
@@ -108,12 +106,12 @@
}
public TextImpl(String text, String mimeType, boolean optimize,
- OMFactory factory) {
+ OMFactory factory) {
this(text, mimeType, optimize, true, factory);
}
public TextImpl(String text, String mimeType, boolean optimize,
- boolean isBinary, OMFactory factory) {
+ boolean isBinary, OMFactory factory) {
this(text, factory);
this.mimeType = mimeType;
this.optimize = optimize;
@@ -122,10 +120,10 @@
/**
* @param dataHandler
- * @param optimize
- * To send binary content. Created progrmatically.
+ * @param optimize To send binary content. Created progrmatically.
*/
- public TextImpl(DocumentImpl ownerNode, Object dataHandler, boolean optimize, OMFactory factory) {
+ public TextImpl(DocumentImpl ownerNode, Object dataHandler, boolean optimize,
+ OMFactory factory) {
super(ownerNode, factory);
this.dataHandlerObject = dataHandler;
this.isBinary = true;
@@ -134,9 +132,7 @@
this.ns = XOP_NS;
}
- /**
- * @param ownerNode
- */
+ /** @param ownerNode */
public TextImpl(DocumentImpl ownerNode, OMFactory factory) {
super(ownerNode, factory);
this.done = true;
@@ -160,13 +156,13 @@
this.done = true;
this.ns = XOP_NS;
}
-
+
/**
* @param ownerNode
* @param value
*/
public TextImpl(DocumentImpl ownerNode, String value, String mimeType,
- boolean optimize, OMFactory factory) {
+ boolean optimize, OMFactory factory) {
this(ownerNode, value, factory);
this.mimeType = mimeType;
this.optimize = optimize;
@@ -174,43 +170,44 @@
done = true;
}
- public TextImpl(OMContainer parent, QName text,OMFactory factory) {
+ public TextImpl(OMContainer parent, QName text, OMFactory factory) {
this(parent, text, OMNode.TEXT_NODE, factory);
-
+
}
-
+
public TextImpl(OMContainer parent, QName text, int nodeType,
- OMFactory factory) {
- this(((ElementImpl)parent).ownerNode, factory);
- if(text != null) {
- this.textNS = ((ElementImpl) parent).findNamespace(text.getNamespaceURI(), text.getPrefix());
+ OMFactory factory) {
+ this(((ElementImpl) parent).ownerNode, factory);
+ if (text != null) {
+ this.textNS =
+ ((ElementImpl) parent).findNamespace(text.getNamespaceURI(), text.getPrefix());
} else {
-
+
}
this.textValue = new StringBuffer((text == null) ? "" : text.getLocalPart());
this.done = true;
}
+
/**
- * Breaks this node into two nodes at the specified offset, keeping both in
- * the tree as siblings. After being split, this node will contain all the
- * content up to the offset point. A new node of the same type, which
- * contains all the content at and after the offset point, is returned. If
- * the original node had a parent node, the new node is inserted as the next
- * sibling of the original node. When the offset is equal to the length of
- * this node, the new node has no data.
+ * Breaks this node into two nodes at the specified offset, keeping both in the tree as
+ * siblings. After being split, this node will contain all the content up to the offset point. A
+ * new node of the same type, which contains all the content at and after the offset point, is
+ * returned. If the original node had a parent node, the new node is inserted as the next
+ * sibling of the original node. When the offset is equal to the length of this node, the new
+ * node has no data.
*/
public Text splitText(int offset) throws DOMException {
if (this.isReadonly()) {
throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN,
- "NO_MODIFICATION_ALLOWED_ERR", null));
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN,
+ "NO_MODIFICATION_ALLOWED_ERR", null));
}
if (offset < 0 || offset > this.textValue.length()) {
throw new DOMException(DOMException.INDEX_SIZE_ERR,
- DOMMessageFormatter.formatMessage(
- DOMMessageFormatter.DOM_DOMAIN, "INDEX_SIZE_ERR",
- null));
+ DOMMessageFormatter.formatMessage(
+ DOMMessageFormatter.DOM_DOMAIN, "INDEX_SIZE_ERR",
+ null));
}
String newValue = this.textValue.substring(offset);
this.deleteData(offset, this.textValue.length());
@@ -291,7 +288,7 @@
/**
* Writes the relevant output.
- *
+ *
* @param writer
* @throws XMLStreamException
*/
@@ -328,7 +325,7 @@
public boolean isCharacters() {
return charArray != null;
}
-
+
private String getTextFromProperPlace() {
return charArray != null ? new String(charArray) : textValue.toString();
}
@@ -382,7 +379,7 @@
* this should return a DataHandler containing the binary data
* reperesented by the Base64 strings stored in OMText
*/
- if ((textValue != null|| charArray != null || textNS != null) & isBinary) {
+ if ((textValue != null || charArray != null || textNS != null) & isBinary) {
String text = textNS == null ? getTextFromProperPlace() : getTextString();
return DataHandlerUtils
.getDataHandlerFromText(text, mimeType);
@@ -405,7 +402,8 @@
getDataHandler();
}
InputStream inStream;
- javax.activation.DataHandler dataHandler = (javax.activation.DataHandler) dataHandlerObject;
+ javax.activation.DataHandler dataHandler =
+ (javax.activation.DataHandler) dataHandlerObject;
try {
inStream = dataHandler.getDataSource().getInputStream();
} catch (IOException e) {
@@ -430,9 +428,9 @@
}
// send binary as MTOM optimised
this.attribute = new AttrImpl(this.ownerNode, "href",
- new NamespaceImpl("", ""),
- "cid:" + getContentID(),
- this.factory);
+ new NamespaceImpl("", ""),
+ "cid:" + getContentID(),
+ this.factory);
this.serializeStartpart(writer);
writer.writeOptimized(this);
writer.writeEndElement();
@@ -455,7 +453,7 @@
.getLocalName());
} else {
writer.writeStartElement(prefix, this.getLocalName(),
- nameSpaceName);
+ nameSpaceName);
writer.setPrefix(prefix, nameSpaceName);
}
// add the elements attribute "href"
@@ -466,7 +464,7 @@
/**
* Method serializeAttribute.
- *
+ *
* @param attr
* @param writer
* @throws XMLStreamException
@@ -497,7 +495,7 @@
/**
* Method serializeNamespace.
- *
+ *
* @param namespace
* @param writer
* @throws XMLStreamException
@@ -521,13 +519,12 @@
public String getLocalName() {
return this.localName;
}
-
-
+
/*
- * DOM-Level 3 methods
- */
-
-
+ * DOM-Level 3 methods
+ */
+
+
public String getWholeText() {
// TODO TODO
throw new UnsupportedOperationException("TODO");
@@ -546,32 +543,32 @@
public String toString() {
return (this.textValue != null) ? textValue.toString() : "";
}
-
- /* (non-Javadoc)
- * @see org.apache.axiom.om.OMNode#buildAll()
- */
- public void buildWithAttachments() {
- this.build();
- if (isOptimized())
- {
- this.getDataHandler();
- }
- }
- public boolean isBinary() {
- return isBinary;
- }
-
- /**
- * Receiving binary can happen as either MTOM attachments or as Base64 Text
- * In the case of Base64 user has to explicitly specify that the content is
- * binary, before calling getDataHandler(), getInputStream()....
- */
- public void setBinary(boolean value) {
- this.isBinary = value;
-
- }
-
- public OMNamespace getNamespace() {
- return textNS;
- }
+
+ /* (non-Javadoc)
+ * @see org.apache.axiom.om.OMNode#buildAll()
+ */
+ public void buildWithAttachments() {
+ this.build();
+ if (isOptimized()) {
+ this.getDataHandler();
+ }
+ }
+
+ public boolean isBinary() {
+ return isBinary;
+ }
+
+ /**
+ * Receiving binary can happen as either MTOM attachments or as Base64 Text In the case of Base64
+ * user has to explicitly specify that the content is binary, before calling getDataHandler(),
+ * getInputStream()....
+ */
+ public void setBinary(boolean value) {
+ this.isBinary = value;
+
+ }
+
+ public OMNamespace getNamespace() {
+ return textNS;
+ }
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/XMLChar.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/XMLChar.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/XMLChar.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/XMLChar.java Wed Mar 7 06:59:00 2007
@@ -17,20 +17,16 @@
package org.apache.axiom.om.impl.dom;
/**
- * This class defines the basic XML character properties. The data
- * in this class can be used to verify that a character is a valid
- * XML character or if the character is a space, name start, or name
- * character.
- * <p>
- * A series of convenience methods are supplied to ease the burden
- * of the developer. Because inlining the checks can improve per
- * character performance, the tables of character properties are
- * public. Using the character as an index into the <code>CHARS</code>
- * array and applying the appropriate mask flag (e.g.
- * <code>MASK_VALID</code>), yields the same results as calling the
- * convenience methods. There is one exception: check the comments
- * for the <code>isValid</code> method for details.
- *
+ * This class defines the basic XML character properties. The data in this class can be used to
+ * verify that a character is a valid XML character or if the character is a space, name start, or
+ * name character.
+ * <p/>
+ * A series of convenience methods are supplied to ease the burden of the developer. Because
+ * inlining the checks can improve per character performance, the tables of character properties are
+ * public. Using the character as an index into the <code>CHARS</code> array and applying the
+ * appropriate mask flag (e.g. <code>MASK_VALID</code>), yields the same results as calling the
+ * convenience methods. There is one exception: check the comments for the <code>isValid</code>
+ * method for details.
*/
public class XMLChar {
@@ -57,11 +53,10 @@
public static final int MASK_PUBID = 0x10;
/**
- * Content character mask. Special characters are those that can
- * be considered the start of markup, such as '<' and '&'.
- * The various newline characters are considered special as well.
- * All other valid XML characters can be considered content.
- * <p>
+ * Content character mask. Special characters are those that can be considered the start of
+ * markup, such as '<' and '&'. The various newline characters are considered special as
+ * well. All other valid XML characters can be considered content.
+ * <p/>
* This is an optimization for the inner loop of character scanning.
*/
public static final int MASK_CONTENT = 0x20;
@@ -84,7 +79,7 @@
//
int charRange[] = {
- 0x0009, 0x000A, 0x000D, 0x000D, 0x0020, 0xD7FF, 0xE000, 0xFFFD,
+ 0x0009, 0x000A, 0x000D, 0x000D, 0x0020, 0xD7FF, 0xE000, 0xFFFD,
};
//
@@ -92,7 +87,7 @@
//
int spaceChar[] = {
- 0x0020, 0x0009, 0x000D, 0x000A,
+ 0x0020, 0x0009, 0x000D, 0x000A,
};
//
@@ -101,7 +96,7 @@
//
int nameChar[] = {
- 0x002D, 0x002E, // '-' and '.'
+ 0x002D, 0x002E, // '-' and '.'
};
//
@@ -109,7 +104,7 @@
//
int nameStartChar[] = {
- 0x003A, 0x005F, // ':' and '_'
+ 0x003A, 0x005F, // ':' and '_'
};
//
@@ -117,12 +112,12 @@
//
int pubidChar[] = {
- 0x000A, 0x000D, 0x0020, 0x0021, 0x0023, 0x0024, 0x0025, 0x003D,
- 0x005F
+ 0x000A, 0x000D, 0x0020, 0x0021, 0x0023, 0x0024, 0x0025, 0x003D,
+ 0x005F
};
int pubidRange[] = {
- 0x0027, 0x003B, 0x003F, 0x005A, 0x0061, 0x007A
+ 0x0027, 0x003B, 0x003F, 0x005A, 0x0061, 0x007A
};
//
@@ -130,59 +125,59 @@
//
int letterRange[] = {
- // BaseChar
- 0x0041, 0x005A, 0x0061, 0x007A, 0x00C0, 0x00D6, 0x00D8, 0x00F6,
- 0x00F8, 0x0131, 0x0134, 0x013E, 0x0141, 0x0148, 0x014A, 0x017E,
- 0x0180, 0x01C3, 0x01CD, 0x01F0, 0x01F4, 0x01F5, 0x01FA, 0x0217,
- 0x0250, 0x02A8, 0x02BB, 0x02C1, 0x0388, 0x038A, 0x038E, 0x03A1,
- 0x03A3, 0x03CE, 0x03D0, 0x03D6, 0x03E2, 0x03F3, 0x0401, 0x040C,
- 0x040E, 0x044F, 0x0451, 0x045C, 0x045E, 0x0481, 0x0490, 0x04C4,
- 0x04C7, 0x04C8, 0x04CB, 0x04CC, 0x04D0, 0x04EB, 0x04EE, 0x04F5,
- 0x04F8, 0x04F9, 0x0531, 0x0556, 0x0561, 0x0586, 0x05D0, 0x05EA,
- 0x05F0, 0x05F2, 0x0621, 0x063A, 0x0641, 0x064A, 0x0671, 0x06B7,
- 0x06BA, 0x06BE, 0x06C0, 0x06CE, 0x06D0, 0x06D3, 0x06E5, 0x06E6,
- 0x0905, 0x0939, 0x0958, 0x0961, 0x0985, 0x098C, 0x098F, 0x0990,
- 0x0993, 0x09A8, 0x09AA, 0x09B0, 0x09B6, 0x09B9, 0x09DC, 0x09DD,
- 0x09DF, 0x09E1, 0x09F0, 0x09F1, 0x0A05, 0x0A0A, 0x0A0F, 0x0A10,
- 0x0A13, 0x0A28, 0x0A2A, 0x0A30, 0x0A32, 0x0A33, 0x0A35, 0x0A36,
- 0x0A38, 0x0A39, 0x0A59, 0x0A5C, 0x0A72, 0x0A74, 0x0A85, 0x0A8B,
- 0x0A8F, 0x0A91, 0x0A93, 0x0AA8, 0x0AAA, 0x0AB0, 0x0AB2, 0x0AB3,
- 0x0AB5, 0x0AB9, 0x0B05, 0x0B0C, 0x0B0F, 0x0B10, 0x0B13, 0x0B28,
- 0x0B2A, 0x0B30, 0x0B32, 0x0B33, 0x0B36, 0x0B39, 0x0B5C, 0x0B5D,
- 0x0B5F, 0x0B61, 0x0B85, 0x0B8A, 0x0B8E, 0x0B90, 0x0B92, 0x0B95,
- 0x0B99, 0x0B9A, 0x0B9E, 0x0B9F, 0x0BA3, 0x0BA4, 0x0BA8, 0x0BAA,
- 0x0BAE, 0x0BB5, 0x0BB7, 0x0BB9, 0x0C05, 0x0C0C, 0x0C0E, 0x0C10,
- 0x0C12, 0x0C28, 0x0C2A, 0x0C33, 0x0C35, 0x0C39, 0x0C60, 0x0C61,
- 0x0C85, 0x0C8C, 0x0C8E, 0x0C90, 0x0C92, 0x0CA8, 0x0CAA, 0x0CB3,
- 0x0CB5, 0x0CB9, 0x0CE0, 0x0CE1, 0x0D05, 0x0D0C, 0x0D0E, 0x0D10,
- 0x0D12, 0x0D28, 0x0D2A, 0x0D39, 0x0D60, 0x0D61, 0x0E01, 0x0E2E,
- 0x0E32, 0x0E33, 0x0E40, 0x0E45, 0x0E81, 0x0E82, 0x0E87, 0x0E88,
- 0x0E94, 0x0E97, 0x0E99, 0x0E9F, 0x0EA1, 0x0EA3, 0x0EAA, 0x0EAB,
- 0x0EAD, 0x0EAE, 0x0EB2, 0x0EB3, 0x0EC0, 0x0EC4, 0x0F40, 0x0F47,
- 0x0F49, 0x0F69, 0x10A0, 0x10C5, 0x10D0, 0x10F6, 0x1102, 0x1103,
- 0x1105, 0x1107, 0x110B, 0x110C, 0x110E, 0x1112, 0x1154, 0x1155,
- 0x115F, 0x1161, 0x116D, 0x116E, 0x1172, 0x1173, 0x11AE, 0x11AF,
- 0x11B7, 0x11B8, 0x11BC, 0x11C2, 0x1E00, 0x1E9B, 0x1EA0, 0x1EF9,
- 0x1F00, 0x1F15, 0x1F18, 0x1F1D, 0x1F20, 0x1F45, 0x1F48, 0x1F4D,
- 0x1F50, 0x1F57, 0x1F5F, 0x1F7D, 0x1F80, 0x1FB4, 0x1FB6, 0x1FBC,
- 0x1FC2, 0x1FC4, 0x1FC6, 0x1FCC, 0x1FD0, 0x1FD3, 0x1FD6, 0x1FDB,
- 0x1FE0, 0x1FEC, 0x1FF2, 0x1FF4, 0x1FF6, 0x1FFC, 0x212A, 0x212B,
- 0x2180, 0x2182, 0x3041, 0x3094, 0x30A1, 0x30FA, 0x3105, 0x312C,
- 0xAC00, 0xD7A3,
- // Ideographic
- 0x3021, 0x3029, 0x4E00, 0x9FA5,
+ // BaseChar
+ 0x0041, 0x005A, 0x0061, 0x007A, 0x00C0, 0x00D6, 0x00D8, 0x00F6,
+ 0x00F8, 0x0131, 0x0134, 0x013E, 0x0141, 0x0148, 0x014A, 0x017E,
+ 0x0180, 0x01C3, 0x01CD, 0x01F0, 0x01F4, 0x01F5, 0x01FA, 0x0217,
+ 0x0250, 0x02A8, 0x02BB, 0x02C1, 0x0388, 0x038A, 0x038E, 0x03A1,
+ 0x03A3, 0x03CE, 0x03D0, 0x03D6, 0x03E2, 0x03F3, 0x0401, 0x040C,
+ 0x040E, 0x044F, 0x0451, 0x045C, 0x045E, 0x0481, 0x0490, 0x04C4,
+ 0x04C7, 0x04C8, 0x04CB, 0x04CC, 0x04D0, 0x04EB, 0x04EE, 0x04F5,
+ 0x04F8, 0x04F9, 0x0531, 0x0556, 0x0561, 0x0586, 0x05D0, 0x05EA,
+ 0x05F0, 0x05F2, 0x0621, 0x063A, 0x0641, 0x064A, 0x0671, 0x06B7,
+ 0x06BA, 0x06BE, 0x06C0, 0x06CE, 0x06D0, 0x06D3, 0x06E5, 0x06E6,
+ 0x0905, 0x0939, 0x0958, 0x0961, 0x0985, 0x098C, 0x098F, 0x0990,
+ 0x0993, 0x09A8, 0x09AA, 0x09B0, 0x09B6, 0x09B9, 0x09DC, 0x09DD,
+ 0x09DF, 0x09E1, 0x09F0, 0x09F1, 0x0A05, 0x0A0A, 0x0A0F, 0x0A10,
+ 0x0A13, 0x0A28, 0x0A2A, 0x0A30, 0x0A32, 0x0A33, 0x0A35, 0x0A36,
+ 0x0A38, 0x0A39, 0x0A59, 0x0A5C, 0x0A72, 0x0A74, 0x0A85, 0x0A8B,
+ 0x0A8F, 0x0A91, 0x0A93, 0x0AA8, 0x0AAA, 0x0AB0, 0x0AB2, 0x0AB3,
+ 0x0AB5, 0x0AB9, 0x0B05, 0x0B0C, 0x0B0F, 0x0B10, 0x0B13, 0x0B28,
+ 0x0B2A, 0x0B30, 0x0B32, 0x0B33, 0x0B36, 0x0B39, 0x0B5C, 0x0B5D,
+ 0x0B5F, 0x0B61, 0x0B85, 0x0B8A, 0x0B8E, 0x0B90, 0x0B92, 0x0B95,
+ 0x0B99, 0x0B9A, 0x0B9E, 0x0B9F, 0x0BA3, 0x0BA4, 0x0BA8, 0x0BAA,
+ 0x0BAE, 0x0BB5, 0x0BB7, 0x0BB9, 0x0C05, 0x0C0C, 0x0C0E, 0x0C10,
+ 0x0C12, 0x0C28, 0x0C2A, 0x0C33, 0x0C35, 0x0C39, 0x0C60, 0x0C61,
+ 0x0C85, 0x0C8C, 0x0C8E, 0x0C90, 0x0C92, 0x0CA8, 0x0CAA, 0x0CB3,
+ 0x0CB5, 0x0CB9, 0x0CE0, 0x0CE1, 0x0D05, 0x0D0C, 0x0D0E, 0x0D10,
+ 0x0D12, 0x0D28, 0x0D2A, 0x0D39, 0x0D60, 0x0D61, 0x0E01, 0x0E2E,
+ 0x0E32, 0x0E33, 0x0E40, 0x0E45, 0x0E81, 0x0E82, 0x0E87, 0x0E88,
+ 0x0E94, 0x0E97, 0x0E99, 0x0E9F, 0x0EA1, 0x0EA3, 0x0EAA, 0x0EAB,
+ 0x0EAD, 0x0EAE, 0x0EB2, 0x0EB3, 0x0EC0, 0x0EC4, 0x0F40, 0x0F47,
+ 0x0F49, 0x0F69, 0x10A0, 0x10C5, 0x10D0, 0x10F6, 0x1102, 0x1103,
+ 0x1105, 0x1107, 0x110B, 0x110C, 0x110E, 0x1112, 0x1154, 0x1155,
+ 0x115F, 0x1161, 0x116D, 0x116E, 0x1172, 0x1173, 0x11AE, 0x11AF,
+ 0x11B7, 0x11B8, 0x11BC, 0x11C2, 0x1E00, 0x1E9B, 0x1EA0, 0x1EF9,
+ 0x1F00, 0x1F15, 0x1F18, 0x1F1D, 0x1F20, 0x1F45, 0x1F48, 0x1F4D,
+ 0x1F50, 0x1F57, 0x1F5F, 0x1F7D, 0x1F80, 0x1FB4, 0x1FB6, 0x1FBC,
+ 0x1FC2, 0x1FC4, 0x1FC6, 0x1FCC, 0x1FD0, 0x1FD3, 0x1FD6, 0x1FDB,
+ 0x1FE0, 0x1FEC, 0x1FF2, 0x1FF4, 0x1FF6, 0x1FFC, 0x212A, 0x212B,
+ 0x2180, 0x2182, 0x3041, 0x3094, 0x30A1, 0x30FA, 0x3105, 0x312C,
+ 0xAC00, 0xD7A3,
+ // Ideographic
+ 0x3021, 0x3029, 0x4E00, 0x9FA5,
};
int letterChar[] = {
- // BaseChar
- 0x0386, 0x038C, 0x03DA, 0x03DC, 0x03DE, 0x03E0, 0x0559, 0x06D5,
- 0x093D, 0x09B2, 0x0A5E, 0x0A8D, 0x0ABD, 0x0AE0, 0x0B3D, 0x0B9C,
- 0x0CDE, 0x0E30, 0x0E84, 0x0E8A, 0x0E8D, 0x0EA5, 0x0EA7, 0x0EB0,
- 0x0EBD, 0x1100, 0x1109, 0x113C, 0x113E, 0x1140, 0x114C, 0x114E,
- 0x1150, 0x1159, 0x1163, 0x1165, 0x1167, 0x1169, 0x1175, 0x119E,
- 0x11A8, 0x11AB, 0x11BA, 0x11EB, 0x11F0, 0x11F9, 0x1F59, 0x1F5B,
- 0x1F5D, 0x1FBE, 0x2126, 0x212E,
- // Ideographic
- 0x3007,
+ // BaseChar
+ 0x0386, 0x038C, 0x03DA, 0x03DC, 0x03DE, 0x03E0, 0x0559, 0x06D5,
+ 0x093D, 0x09B2, 0x0A5E, 0x0A8D, 0x0ABD, 0x0AE0, 0x0B3D, 0x0B9C,
+ 0x0CDE, 0x0E30, 0x0E84, 0x0E8A, 0x0E8D, 0x0EA5, 0x0EA7, 0x0EB0,
+ 0x0EBD, 0x1100, 0x1109, 0x113C, 0x113E, 0x1140, 0x114C, 0x114E,
+ 0x1150, 0x1159, 0x1163, 0x1165, 0x1167, 0x1169, 0x1175, 0x119E,
+ 0x11A8, 0x11AB, 0x11BA, 0x11EB, 0x11F0, 0x11F9, 0x1F59, 0x1F5B,
+ 0x1F5D, 0x1FBE, 0x2126, 0x212E,
+ // Ideographic
+ 0x3007,
};
//
@@ -190,30 +185,30 @@
//
int combiningCharRange[] = {
- 0x0300, 0x0345, 0x0360, 0x0361, 0x0483, 0x0486, 0x0591, 0x05A1,
- 0x05A3, 0x05B9, 0x05BB, 0x05BD, 0x05C1, 0x05C2, 0x064B, 0x0652,
- 0x06D6, 0x06DC, 0x06DD, 0x06DF, 0x06E0, 0x06E4, 0x06E7, 0x06E8,
- 0x06EA, 0x06ED, 0x0901, 0x0903, 0x093E, 0x094C, 0x0951, 0x0954,
- 0x0962, 0x0963, 0x0981, 0x0983, 0x09C0, 0x09C4, 0x09C7, 0x09C8,
- 0x09CB, 0x09CD, 0x09E2, 0x09E3, 0x0A40, 0x0A42, 0x0A47, 0x0A48,
- 0x0A4B, 0x0A4D, 0x0A70, 0x0A71, 0x0A81, 0x0A83, 0x0ABE, 0x0AC5,
- 0x0AC7, 0x0AC9, 0x0ACB, 0x0ACD, 0x0B01, 0x0B03, 0x0B3E, 0x0B43,
- 0x0B47, 0x0B48, 0x0B4B, 0x0B4D, 0x0B56, 0x0B57, 0x0B82, 0x0B83,
- 0x0BBE, 0x0BC2, 0x0BC6, 0x0BC8, 0x0BCA, 0x0BCD, 0x0C01, 0x0C03,
- 0x0C3E, 0x0C44, 0x0C46, 0x0C48, 0x0C4A, 0x0C4D, 0x0C55, 0x0C56,
- 0x0C82, 0x0C83, 0x0CBE, 0x0CC4, 0x0CC6, 0x0CC8, 0x0CCA, 0x0CCD,
- 0x0CD5, 0x0CD6, 0x0D02, 0x0D03, 0x0D3E, 0x0D43, 0x0D46, 0x0D48,
- 0x0D4A, 0x0D4D, 0x0E34, 0x0E3A, 0x0E47, 0x0E4E, 0x0EB4, 0x0EB9,
- 0x0EBB, 0x0EBC, 0x0EC8, 0x0ECD, 0x0F18, 0x0F19, 0x0F71, 0x0F84,
- 0x0F86, 0x0F8B, 0x0F90, 0x0F95, 0x0F99, 0x0FAD, 0x0FB1, 0x0FB7,
- 0x20D0, 0x20DC, 0x302A, 0x302F,
+ 0x0300, 0x0345, 0x0360, 0x0361, 0x0483, 0x0486, 0x0591, 0x05A1,
+ 0x05A3, 0x05B9, 0x05BB, 0x05BD, 0x05C1, 0x05C2, 0x064B, 0x0652,
+ 0x06D6, 0x06DC, 0x06DD, 0x06DF, 0x06E0, 0x06E4, 0x06E7, 0x06E8,
+ 0x06EA, 0x06ED, 0x0901, 0x0903, 0x093E, 0x094C, 0x0951, 0x0954,
+ 0x0962, 0x0963, 0x0981, 0x0983, 0x09C0, 0x09C4, 0x09C7, 0x09C8,
+ 0x09CB, 0x09CD, 0x09E2, 0x09E3, 0x0A40, 0x0A42, 0x0A47, 0x0A48,
+ 0x0A4B, 0x0A4D, 0x0A70, 0x0A71, 0x0A81, 0x0A83, 0x0ABE, 0x0AC5,
+ 0x0AC7, 0x0AC9, 0x0ACB, 0x0ACD, 0x0B01, 0x0B03, 0x0B3E, 0x0B43,
+ 0x0B47, 0x0B48, 0x0B4B, 0x0B4D, 0x0B56, 0x0B57, 0x0B82, 0x0B83,
+ 0x0BBE, 0x0BC2, 0x0BC6, 0x0BC8, 0x0BCA, 0x0BCD, 0x0C01, 0x0C03,
+ 0x0C3E, 0x0C44, 0x0C46, 0x0C48, 0x0C4A, 0x0C4D, 0x0C55, 0x0C56,
+ 0x0C82, 0x0C83, 0x0CBE, 0x0CC4, 0x0CC6, 0x0CC8, 0x0CCA, 0x0CCD,
+ 0x0CD5, 0x0CD6, 0x0D02, 0x0D03, 0x0D3E, 0x0D43, 0x0D46, 0x0D48,
+ 0x0D4A, 0x0D4D, 0x0E34, 0x0E3A, 0x0E47, 0x0E4E, 0x0EB4, 0x0EB9,
+ 0x0EBB, 0x0EBC, 0x0EC8, 0x0ECD, 0x0F18, 0x0F19, 0x0F71, 0x0F84,
+ 0x0F86, 0x0F8B, 0x0F90, 0x0F95, 0x0F99, 0x0FAD, 0x0FB1, 0x0FB7,
+ 0x20D0, 0x20DC, 0x302A, 0x302F,
};
int combiningCharChar[] = {
- 0x05BF, 0x05C4, 0x0670, 0x093C, 0x094D, 0x09BC, 0x09BE, 0x09BF,
- 0x09D7, 0x0A02, 0x0A3C, 0x0A3E, 0x0A3F, 0x0ABC, 0x0B3C, 0x0BD7,
- 0x0D57, 0x0E31, 0x0EB1, 0x0F35, 0x0F37, 0x0F39, 0x0F3E, 0x0F3F,
- 0x0F97, 0x0FB9, 0x20E1, 0x3099, 0x309A,
+ 0x05BF, 0x05C4, 0x0670, 0x093C, 0x094D, 0x09BC, 0x09BE, 0x09BF,
+ 0x09D7, 0x0A02, 0x0A3C, 0x0A3E, 0x0A3F, 0x0ABC, 0x0B3C, 0x0BD7,
+ 0x0D57, 0x0E31, 0x0EB1, 0x0F35, 0x0F37, 0x0F39, 0x0F3E, 0x0F3F,
+ 0x0F97, 0x0FB9, 0x20E1, 0x3099, 0x309A,
};
//
@@ -221,10 +216,10 @@
//
int digitRange[] = {
- 0x0030, 0x0039, 0x0660, 0x0669, 0x06F0, 0x06F9, 0x0966, 0x096F,
- 0x09E6, 0x09EF, 0x0A66, 0x0A6F, 0x0AE6, 0x0AEF, 0x0B66, 0x0B6F,
- 0x0BE7, 0x0BEF, 0x0C66, 0x0C6F, 0x0CE6, 0x0CEF, 0x0D66, 0x0D6F,
- 0x0E50, 0x0E59, 0x0ED0, 0x0ED9, 0x0F20, 0x0F29,
+ 0x0030, 0x0039, 0x0660, 0x0669, 0x06F0, 0x06F9, 0x0966, 0x096F,
+ 0x09E6, 0x09EF, 0x0A66, 0x0A6F, 0x0AE6, 0x0AEF, 0x0B66, 0x0B6F,
+ 0x0BE7, 0x0BEF, 0x0C66, 0x0C6F, 0x0CE6, 0x0CEF, 0x0D66, 0x0D6F,
+ 0x0E50, 0x0E59, 0x0ED0, 0x0ED9, 0x0F20, 0x0F29,
};
//
@@ -232,11 +227,11 @@
//
int extenderRange[] = {
- 0x3031, 0x3035, 0x309D, 0x309E, 0x30FC, 0x30FE,
+ 0x3031, 0x3035, 0x309D, 0x309E, 0x30FC, 0x30FE,
};
int extenderChar[] = {
- 0x00B7, 0x02D0, 0x02D1, 0x0387, 0x0640, 0x0E46, 0x0EC6, 0x3005,
+ 0x00B7, 0x02D0, 0x02D1, 0x0387, 0x0640, 0x0E46, 0x0EC6, 0x3005,
};
//
@@ -244,7 +239,7 @@
//
int specialChar[] = {
- '<', '&', '\n', '\r', ']',
+ '<', '&', '\n', '\r', ']',
};
//
@@ -260,7 +255,7 @@
// remove special characters
for (int i = 0; i < specialChar.length; i++) {
- CHARS[specialChar[i]] = (byte)(CHARS[specialChar[i]] & ~MASK_CONTENT);
+ CHARS[specialChar[i]] = (byte) (CHARS[specialChar[i]] & ~MASK_CONTENT);
}
// set space characters
@@ -271,17 +266,17 @@
// set name start characters
for (int i = 0; i < nameStartChar.length; i++) {
CHARS[nameStartChar[i]] |= MASK_NAME_START | MASK_NAME |
- MASK_NCNAME_START | MASK_NCNAME;
+ MASK_NCNAME_START | MASK_NCNAME;
}
for (int i = 0; i < letterRange.length; i += 2) {
for (int j = letterRange[i]; j <= letterRange[i + 1]; j++) {
CHARS[j] |= MASK_NAME_START | MASK_NAME |
- MASK_NCNAME_START | MASK_NCNAME;
+ MASK_NCNAME_START | MASK_NCNAME;
}
}
for (int i = 0; i < letterChar.length; i++) {
CHARS[letterChar[i]] |= MASK_NAME_START | MASK_NAME |
- MASK_NCNAME_START | MASK_NCNAME;
+ MASK_NCNAME_START | MASK_NCNAME;
}
// set name characters
@@ -339,8 +334,7 @@
}
/**
- * Returns true the supplemental character corresponding to the given
- * surrogates.
+ * Returns true the supplemental character corresponding to the given surrogates.
*
* @param h The high surrogate.
* @param l The low surrogate.
@@ -387,18 +381,17 @@
/**
- * Returns true if the specified character is valid. This method
- * also checks the surrogate character range from 0x10000 to 0x10FFFF.
- * <p>
- * If the program chooses to apply the mask directly to the
- * <code>CHARS</code> array, then they are responsible for checking
- * the surrogate character range.
+ * Returns true if the specified character is valid. This method also checks the surrogate
+ * character range from 0x10000 to 0x10FFFF.
+ * <p/>
+ * If the program chooses to apply the mask directly to the <code>CHARS</code> array, then they
+ * are responsible for checking the surrogate character range.
*
* @param c The character to check.
*/
public static boolean isValid(int c) {
return (c < 0x10000 && (CHARS[c] & MASK_VALID) != 0) ||
- (0x10000 <= c && c <= 0x10FFFF);
+ (0x10000 <= c && c <= 0x10FFFF);
} // isValid(int):boolean
/**
@@ -417,12 +410,12 @@
*/
public static boolean isContent(int c) {
return (c < 0x10000 && (CHARS[c] & MASK_CONTENT) != 0) ||
- (0x10000 <= c && c <= 0x10FFFF);
+ (0x10000 <= c && c <= 0x10FFFF);
} // isContent(int):boolean
/**
- * Returns true if the specified character can be considered markup.
- * Markup characters include '<', '&', and '%'.
+ * Returns true if the specified character can be considered markup. Markup characters include
+ * '<', '&', and '%'.
*
* @param c The character to check.
*/
@@ -431,8 +424,8 @@
} // isMarkup(int):boolean
/**
- * Returns true if the specified character is a space character
- * as defined by production [3] in the XML 1.0 specification.
+ * Returns true if the specified character is a space character as defined by production [3] in
+ * the XML 1.0 specification.
*
* @param c The character to check.
*/
@@ -441,20 +434,19 @@
} // isSpace(int):boolean
/**
- * Returns true if the specified character is a space character
- * as amdended in the XML 1.1 specification.
+ * Returns true if the specified character is a space character as amdended in the XML 1.1
+ * specification.
*
* @param c The character to check.
*/
public static boolean isXML11Space(int c) {
return (c < 0x10000 && (CHARS[c] & MASK_SPACE) != 0) ||
- c == 0x85 || c == 0x2028;
+ c == 0x85 || c == 0x2028;
} // isXML11Space(int):boolean
/**
- * Returns true if the specified character is a valid name start
- * character as defined by production [5] in the XML 1.0
- * specification.
+ * Returns true if the specified character is a valid name start character as defined by
+ * production [5] in the XML 1.0 specification.
*
* @param c The character to check.
*/
@@ -463,9 +455,8 @@
} // isNameStart(int):boolean
/**
- * Returns true if the specified character is a valid name
- * character as defined by production [4] in the XML 1.0
- * specification.
+ * Returns true if the specified character is a valid name character as defined by production
+ * [4] in the XML 1.0 specification.
*
* @param c The character to check.
*/
@@ -474,9 +465,8 @@
} // isName(int):boolean
/**
- * Returns true if the specified character is a valid NCName start
- * character as defined by production [4] in Namespaces in XML
- * recommendation.
+ * Returns true if the specified character is a valid NCName start character as defined by
+ * production [4] in Namespaces in XML recommendation.
*
* @param c The character to check.
*/
@@ -485,9 +475,8 @@
} // isNCNameStart(int):boolean
/**
- * Returns true if the specified character is a valid NCName
- * character as defined by production [5] in Namespaces in XML
- * recommendation.
+ * Returns true if the specified character is a valid NCName character as defined by production
+ * [5] in Namespaces in XML recommendation.
*
* @param c The character to check.
*/
@@ -496,9 +485,8 @@
} // isNCName(int):boolean
/**
- * Returns true if the specified character is a valid Pubid
- * character as defined by production [13] in the XML 1.0
- * specification.
+ * Returns true if the specified character is a valid Pubid character as defined by production
+ * [13] in the XML 1.0 specification.
*
* @param c The character to check.
*/
@@ -520,13 +508,13 @@
if (name.length() == 0)
return false;
char ch = name.charAt(0);
- if(!isNameStart(ch))
- return false;
- for (int i = 1; i < name.length(); i++ ) {
- ch = name.charAt(i);
- if(!isName(ch) ){
- return false;
- }
+ if (!isNameStart(ch))
+ return false;
+ for (int i = 1; i < name.length(); i++) {
+ ch = name.charAt(i);
+ if (!isName(ch)) {
+ return false;
+ }
}
return true;
} // isValidName(String):boolean
@@ -547,13 +535,13 @@
if (ncName.length() == 0)
return false;
char ch = ncName.charAt(0);
- if(!isNCNameStart(ch))
- return false;
- for (int i = 1; i < ncName.length(); i++ ) {
- ch = ncName.charAt(i);
- if(!isNCName(ch) ){
- return false;
- }
+ if (!isNCNameStart(ch))
+ return false;
+ for (int i = 1; i < ncName.length(); i++) {
+ ch = ncName.charAt(i);
+ if (!isNCName(ch)) {
+ return false;
+ }
}
return true;
} // isValidNCName(String):boolean
@@ -571,25 +559,20 @@
public static boolean isValidNmtoken(String nmtoken) {
if (nmtoken.length() == 0)
return false;
- for (int i = 0; i < nmtoken.length(); i++ ) {
- char ch = nmtoken.charAt(i);
- if( ! isName( ch ) ){
- return false;
- }
+ for (int i = 0; i < nmtoken.length(); i++) {
+ char ch = nmtoken.charAt(i);
+ if (! isName(ch)) {
+ return false;
+ }
}
return true;
} // isValidName(String):boolean
-
-
-
-
// encodings
/**
- * Returns true if the encoding name is a valid IANA encoding.
- * This method does not verify that there is a decoder available
- * for this encoding, only that the characters are valid for an
+ * Returns true if the encoding name is a valid IANA encoding. This method does not verify that
+ * there is a decoder available for this encoding, only that the characters are valid for an
* IANA encoding name.
*
* @param ianaEncoding The IANA encoding name.
@@ -603,8 +586,8 @@
for (int i = 1; i < length; i++) {
c = ianaEncoding.charAt(i);
if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') &&
- (c < '0' || c > '9') && c != '.' && c != '_' &&
- c != '-') {
+ (c < '0' || c > '9') && c != '.' && c != '_' &&
+ c != '-') {
return false;
}
}
@@ -616,9 +599,8 @@
} // isValidIANAEncoding(String):boolean
/**
- * Returns true if the encoding name is a valid Java encoding.
- * This method does not verify that there is a decoder available
- * for this encoding, only that the characters are valid for an
+ * Returns true if the encoding name is a valid Java encoding. This method does not verify that
+ * there is a decoder available for this encoding, only that the characters are valid for an
* Java encoding name.
*
* @param javaEncoding The Java encoding name.
@@ -630,8 +612,8 @@
for (int i = 1; i < length; i++) {
char c = javaEncoding.charAt(i);
if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') &&
- (c < '0' || c > '9') && c != '.' && c != '_' &&
- c != '-') {
+ (c < '0' || c > '9') && c != '.' && c != '_' &&
+ c != '-') {
return false;
}
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/factory/OMDOMFactory.java Wed Mar 7 06:59:00 2007
@@ -73,71 +73,70 @@
public OMElement createOMElement(String localName, OMNamespace ns) {
return new ElementImpl((DocumentImpl) this.createOMDocument(),
- localName, (NamespaceImpl) ns, this);
+ localName, (NamespaceImpl) ns, this);
}
public OMElement createOMElement(String localName, OMNamespace ns,
- OMContainer parent) throws OMDOMException {
+ OMContainer parent) throws OMDOMException {
switch (((ParentNode) parent).getNodeType()) {
- case Node.ELEMENT_NODE: // We are adding a new child to an elem
- ElementImpl parentElem = (ElementImpl) parent;
- ElementImpl elem = new ElementImpl((DocumentImpl) parentElem
- .getOwnerDocument(), localName, (NamespaceImpl) ns, this);
- parentElem.appendChild(elem);
- return elem;
-
- case Node.DOCUMENT_NODE:
- DocumentImpl docImpl = (DocumentImpl) parent;
- return new ElementImpl(docImpl, localName,
- (NamespaceImpl) ns, this);
-
- case Node.DOCUMENT_FRAGMENT_NODE:
- DocumentFragmentImpl docFragImpl = (DocumentFragmentImpl) parent;
- return new ElementImpl((DocumentImpl) docFragImpl
- .getOwnerDocument(), localName, (NamespaceImpl) ns, this);
- default:
- throw new OMDOMException(
- "The parent container can only be an ELEMENT, DOCUMENT " +
- "or a DOCUMENT FRAGMENT");
+ case Node.ELEMENT_NODE: // We are adding a new child to an elem
+ ElementImpl parentElem = (ElementImpl) parent;
+ ElementImpl elem = new ElementImpl((DocumentImpl) parentElem
+ .getOwnerDocument(), localName, (NamespaceImpl) ns, this);
+ parentElem.appendChild(elem);
+ return elem;
+
+ case Node.DOCUMENT_NODE:
+ DocumentImpl docImpl = (DocumentImpl) parent;
+ return new ElementImpl(docImpl, localName,
+ (NamespaceImpl) ns, this);
+
+ case Node.DOCUMENT_FRAGMENT_NODE:
+ DocumentFragmentImpl docFragImpl = (DocumentFragmentImpl) parent;
+ return new ElementImpl((DocumentImpl) docFragImpl
+ .getOwnerDocument(), localName, (NamespaceImpl) ns, this);
+ default:
+ throw new OMDOMException(
+ "The parent container can only be an ELEMENT, DOCUMENT " +
+ "or a DOCUMENT FRAGMENT");
}
}
- /**
- * Creates an OMElement with the builder.
- */
+ /** Creates an OMElement with the builder. */
public OMElement createOMElement(String localName, OMNamespace ns,
- OMContainer parent, OMXMLParserWrapper builder) {
+ OMContainer parent, OMXMLParserWrapper builder) {
switch (((ParentNode) parent).getNodeType()) {
- case Node.ELEMENT_NODE: // We are adding a new child to an elem
- ElementImpl parentElem = (ElementImpl) parent;
- ElementImpl elem = new ElementImpl((DocumentImpl) parentElem
- .getOwnerDocument(), localName, (NamespaceImpl) ns,
- builder, this);
- parentElem.appendChild(elem);
- return elem;
- case Node.DOCUMENT_NODE:
- DocumentImpl docImpl = (DocumentImpl) parent;
- ElementImpl elem2 = new ElementImpl(docImpl, localName,
- (NamespaceImpl) ns, builder, this);
- docImpl.appendChild(elem2);
- return elem2;
-
- case Node.DOCUMENT_FRAGMENT_NODE:
- DocumentFragmentImpl docFragImpl = (DocumentFragmentImpl) parent;
- return new ElementImpl((DocumentImpl) docFragImpl
- .getOwnerDocument(), localName, (NamespaceImpl) ns,
- builder, this);
- default:
- throw new OMDOMException(
- "The parent container can only be an ELEMENT, DOCUMENT " +
- "or a DOCUMENT FRAGMENT");
+ case Node.ELEMENT_NODE: // We are adding a new child to an elem
+ ElementImpl parentElem = (ElementImpl) parent;
+ ElementImpl elem = new ElementImpl((DocumentImpl) parentElem
+ .getOwnerDocument(), localName, (NamespaceImpl) ns,
+ builder, this);
+ parentElem.appendChild(elem);
+ return elem;
+ case Node.DOCUMENT_NODE:
+ DocumentImpl docImpl = (DocumentImpl) parent;
+ ElementImpl elem2 = new ElementImpl(docImpl, localName,
+ (NamespaceImpl) ns, builder, this);
+ docImpl.appendChild(elem2);
+ return elem2;
+
+ case Node.DOCUMENT_FRAGMENT_NODE:
+ DocumentFragmentImpl docFragImpl = (DocumentFragmentImpl) parent;
+ return new ElementImpl((DocumentImpl) docFragImpl
+ .getOwnerDocument(), localName, (NamespaceImpl) ns,
+ builder, this);
+ default:
+ throw new OMDOMException(
+ "The parent container can only be an ELEMENT, DOCUMENT " +
+ "or a DOCUMENT FRAGMENT");
}
}
/* (non-Javadoc)
* @see org.apache.axiom.om.OMFactory#createOMElement(org.apache.axiom.om.OMDataSource, java.lang.String, org.apache.axiom.om.OMNamespace, org.apache.axiom.om.OMContainer)
*/
- public OMElement createOMElement(OMDataSource source, String localName, OMNamespace ns, OMContainer parent) {
+ public OMElement createOMElement(OMDataSource source, String localName, OMNamespace ns,
+ OMContainer parent) {
throw new UnsupportedOperationException("Not supported for DOM");
}
@@ -150,22 +149,22 @@
/**
* Creates an OMElement.
- *
- * @see org.apache.axiom.om.OMFactory#createOMElement(java.lang.String,
- * java.lang.String, java.lang.String)
+ *
+ * @see org.apache.axiom.om.OMFactory#createOMElement(String, String,
+ * String)
*/
public OMElement createOMElement(String localName, String namespaceURI,
- String namespacePrefix) {
+ String namespacePrefix) {
NamespaceImpl ns = new NamespaceImpl(namespaceURI, namespacePrefix);
return this.createOMElement(localName, ns);
}
/**
* Creates a new OMDOM Element node and adds it to the given parent.
- *
+ *
* @see #createOMElement(String, OMNamespace, OMContainer)
- * @see org.apache.axiom.om.OMFactory#createOMElement(
- * javax.xml.namespace.QName, org.apache.axiom.om.OMContainer)
+ * @see org.apache.axiom.om.OMFactory#createOMElement( javax.xml.namespace.QName,
+ * org.apache.axiom.om.OMContainer)
*/
public OMElement createOMElement(QName qname, OMContainer parent)
throws OMException {
@@ -180,20 +179,18 @@
/**
* Creates a new OMNamespace.
- *
- * @see org.apache.axiom.om.OMFactory#createOMNamespace(java.lang.String,
- * java.lang.String)
+ *
+ * @see org.apache.axiom.om.OMFactory#createOMNamespace(String, String)
*/
public OMNamespace createOMNamespace(String uri, String prefix) {
return new NamespaceImpl(uri, prefix);
}
/**
- * Creates a new OMDOM Text node with the given value and appends it to the
- * given parent element.
- *
- * @see org.apache.axiom.om.OMFactory#createOMText(
- * org.apache.axiom.om.OMElement,java.lang.String)
+ * Creates a new OMDOM Text node with the given value and appends it to the given parent
+ * element.
+ *
+ * @see org.apache.axiom.om.OMFactory#createOMText( org.apache.axiom.om.OMElement,String)
*/
public OMText createOMText(OMContainer parent, String text) {
ElementImpl parentElem = (ElementImpl) parent;
@@ -206,11 +203,11 @@
public OMText createOMText(OMContainer parent, QName text) {
return new TextImpl(parent, text, this);
}
-
+
public OMText createOMText(OMContainer parent, QName text, int type) {
return new TextImpl(parent, text, type, this);
}
-
+
public OMText createOMText(OMContainer parent, String text, int type) {
OMText textNode = createOMText(parent, text);
((OMNodeEx) textNode).setType(type);
@@ -227,54 +224,52 @@
/**
* Creates a OMDOM Text node carrying the given value.
- *
- * @see org.apache.axiom.om.OMFactory#createOMText(java.lang.String)
+ *
+ * @see org.apache.axiom.om.OMFactory#createOMText(String)
*/
public OMText createOMText(String s) {
- return new TextImpl(this.document,s, this);
+ return new TextImpl(this.document, s, this);
}
/**
* Creates a Character node of the given type.
- *
- * @see org.apache.axiom.om.OMFactory#createOMText(java.lang.String, int)
+ *
+ * @see org.apache.axiom.om.OMFactory#createOMText(String, int)
*/
public OMText createOMText(String text, int type) {
switch (type) {
- case OMNode.TEXT_NODE:
- return new TextImpl(this.document, text, this);
- default:
- throw new OMDOMException("Only Text nodes are supported right now");
+ case OMNode.TEXT_NODE:
+ return new TextImpl(this.document, text, this);
+ default:
+ throw new OMDOMException("Only Text nodes are supported right now");
}
}
/**
- * Creates a new OMDOM Text node with the value of the given text value
- * along with the MTOM optimization parameters and returns it.
- *
- * @see org.apache.axiom.om.OMFactory#createOMText(java.lang.String,
- * java.lang.String, boolean)
+ * Creates a new OMDOM Text node with the value of the given text value along with the MTOM
+ * optimization parameters and returns it.
+ *
+ * @see org.apache.axiom.om.OMFactory#createOMText(String, String, boolean)
*/
public OMText createOMText(String text, String mimeType, boolean optimize) {
return new TextImpl(this.document, text, mimeType, optimize, this);
}
/**
- * Creates a new OMDOM Text node with the given datahandler and the given
- * MTOM optimization configuration and returns it.
- *
- * @see org.apache.axiom.om.OMFactory#createOMText(java.lang.Object, boolean)
+ * Creates a new OMDOM Text node with the given datahandler and the given MTOM optimization
+ * configuration and returns it.
+ *
+ * @see org.apache.axiom.om.OMFactory#createOMText(Object, boolean)
*/
public OMText createOMText(Object dataHandler, boolean optimize) {
return new TextImpl(this.document, dataHandler, optimize, this);
}
/**
- * Creates an OMDOM Text node, adds it to the give parent element and
- * returns it.
- *
- * @see org.apache.axiom.om.OMFactory#createOMText(OMContainer,
- * java.lang.String, java.lang.String, boolean)
+ * Creates an OMDOM Text node, adds it to the give parent element and returns it.
+ *
+ * @see org.apache.axiom.om.OMFactory#createOMText(OMContainer, String,
+ * String, boolean)
*/
public OMText createOMText(OMContainer parent, String s, String mimeType,
boolean optimize) {
@@ -292,7 +287,7 @@
}
public OMAttribute createOMAttribute(String localName, OMNamespace ns,
- String value) {
+ String value) {
return new AttrImpl(this.getDocument(), localName, ns, value, this);
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderFactoryImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderFactoryImpl.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderFactoryImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderFactoryImpl.java Wed Mar 7 06:59:00 2007
@@ -23,43 +23,48 @@
public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory {
/**
- * Temporary solution until DOOM's DocumentBuilder module is done.
- * Use ThreadLocal to determine whether or not DOOM implementation is required.
- * By default (isDOOMRequired() == false), we will use the one from JDK (Crimson)
+ * Temporary solution until DOOM's DocumentBuilder module is done. Use ThreadLocal to determine
+ * whether or not DOOM implementation is required. By default (isDOOMRequired() == false), we
+ * will use the one from JDK (Crimson)
*/
- private static DocumentBuilderFactory originalDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
+ private static DocumentBuilderFactory originalDocumentBuilderFactory =
+ DocumentBuilderFactory.newInstance();
private static String originalDocumentBuilderFactoryClassName = null;
private static ThreadLocal documentBuilderFactoryTracker = new ThreadLocal();
-
+
protected Schema schema;
-
+
public static boolean isDOOMRequired() {
Object value = documentBuilderFactoryTracker.get();
return (value != null);
}
-
+
public static void setDOOMRequired(boolean isDOOMRequired) {
String systemKey = DocumentBuilderFactory.class.getName();
if (isDOOMRequired) {
if (!isDOOMRequired()) {
originalDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
- originalDocumentBuilderFactoryClassName = originalDocumentBuilderFactory.getClass().getName();
+ originalDocumentBuilderFactoryClassName =
+ originalDocumentBuilderFactory.getClass().getName();
documentBuilderFactoryTracker.set(Boolean.TRUE);
System.setProperty(systemKey, DocumentBuilderFactoryImpl.class.getName());
}
} else {
- String currentFactoryClassName = DocumentBuilderFactory.newInstance().getClass().getName();
- if (currentFactoryClassName != null && currentFactoryClassName.equals(DocumentBuilderFactoryImpl.class.getName())) {
+ String currentFactoryClassName =
+ DocumentBuilderFactory.newInstance().getClass().getName();
+ if (currentFactoryClassName != null &&
+ currentFactoryClassName.equals(DocumentBuilderFactoryImpl.class.getName())) {
System.getProperties().remove(systemKey);
if (originalDocumentBuilderFactoryClassName != null) {
- System.setProperty(DocumentBuilderFactory.class.getName(), originalDocumentBuilderFactoryClassName);
+ System.setProperty(DocumentBuilderFactory.class.getName(),
+ originalDocumentBuilderFactoryClassName);
}
}
documentBuilderFactoryTracker.set(null);
originalDocumentBuilderFactory = null;
}
}
-
+
public DocumentBuilderFactoryImpl() {
super();
@@ -115,8 +120,6 @@
//HACK: Overriding to get opensaml working !!
return this.schema;
}
-
-
-
-
+
+
}
Modified: webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderImpl.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderImpl.java?view=diff&rev=515594&r1=515593&r2=515594
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderImpl.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/jaxp/DocumentBuilderImpl.java Wed Mar 7 06:59:00 2007
@@ -32,7 +32,6 @@
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.validation.Schema;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -40,21 +39,18 @@
public class DocumentBuilderImpl extends DocumentBuilder {
- /**
- * The DocumentBuilderFactory used to create this document builder
- */
+ /** The DocumentBuilderFactory used to create this document builder */
private DocumentBuilderFactoryImpl factory;
-
+
protected DocumentBuilderImpl(DocumentBuilderFactoryImpl fac) {
super();
this.factory = fac;
}
/**
- * Returns whether the parser is configured to understand namespaces or not.
- * The StAX parser used by this DOM impl is namespace aware therefore this
- * will always return true.
- *
+ * Returns whether the parser is configured to understand namespaces or not. The StAX parser
+ * used by this DOM impl is namespace aware therefore this will always return true.
+ *
* @see javax.xml.parsers.DocumentBuilder#isNamespaceAware()
*/
public boolean isNamespaceAware() {
@@ -62,9 +58,9 @@
}
/**
- * The StAX builder used is the org.apache.axiom.om.impl.llom.StAXOMBuilder
- * is a validating builder.
- *
+ * The StAX builder used is the org.apache.axiom.om.impl.llom.StAXOMBuilder is a validating
+ * builder.
+ *
* @see javax.xml.parsers.DocumentBuilder#isValidating()
*/
public boolean isValidating() {
@@ -77,7 +73,7 @@
/**
* Returns a new document impl.
- *
+ *
* @see javax.xml.parsers.DocumentBuilder#newDocument()
*/
public Document newDocument() {
@@ -111,9 +107,7 @@
}
}
- /**
- * @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream)
- */
+ /** @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream) */
public Document parse(InputStream is) throws SAXException, IOException {
try {
OMDOMFactory factory = new OMDOMFactory();
@@ -126,9 +120,7 @@
}
}
- /**
- * @see javax.xml.parsers.DocumentBuilder#parse(java.io.File)
- */
+ /** @see javax.xml.parsers.DocumentBuilder#parse(java.io.File) */
public Document parse(File file) throws SAXException, IOException {
try {
OMDOMFactory factory = new OMDOMFactory();
@@ -141,19 +133,14 @@
}
}
- /**
- * @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream,
- * java.lang.String)
- */
+ /** @see javax.xml.parsers.DocumentBuilder#parse(java.io.InputStream, String) */
public Document parse(InputStream is, String systemId) throws SAXException,
IOException {
// TODO
throw new UnsupportedOperationException("TODO");
}
- /**
- * @see javax.xml.parsers.DocumentBuilder#parse(java.lang.String)
- */
+ /** @see javax.xml.parsers.DocumentBuilder#parse(String) */
public Document parse(String uri) throws SAXException, IOException {
// TODO
throw new UnsupportedOperationException("TODO");
@@ -167,6 +154,5 @@
return this.factory.schema;
}
-
-
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: commons-dev-help@ws.apache.org