Modified: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/DomImpl.java URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/DomImpl.java?rev=1877931&r1=1877930&r2=1877931&view=diff ============================================================================== --- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/DomImpl.java (original) +++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/DomImpl.java Tue May 19 20:10:55 2020 @@ -15,58 +15,23 @@ package org.apache.xmlbeans.impl.store; -import org.w3c.dom.Attr; -import org.w3c.dom.CDATASection; -import org.w3c.dom.CharacterData; -import org.w3c.dom.Comment; -import org.w3c.dom.Document; -import org.w3c.dom.DocumentFragment; -import org.w3c.dom.DocumentType; -import org.w3c.dom.DOMException; -import org.w3c.dom.DOMImplementation; -import org.w3c.dom.Element; -import org.w3c.dom.EntityReference; -import org.w3c.dom.NamedNodeMap; +import org.apache.xmlbeans.XmlCursor; +import org.apache.xmlbeans.XmlException; +import org.apache.xmlbeans.XmlObject; +import org.apache.xmlbeans.XmlRuntimeException; +import org.apache.xmlbeans.impl.common.XMLChar; +import org.apache.xmlbeans.impl.soap.*; import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.ProcessingInstruction; import org.w3c.dom.Text; -import org.w3c.dom.DOMImplementation; - -// DOM Level 3 -import org.w3c.dom.UserDataHandler; - - -import org.apache.xmlbeans.impl.common.XMLChar; -import org.apache.xmlbeans.impl.soap.Detail; -import org.apache.xmlbeans.impl.soap.DetailEntry; -import org.apache.xmlbeans.impl.soap.MimeHeaders; -import org.apache.xmlbeans.impl.soap.Name; -import org.apache.xmlbeans.impl.soap.SOAPBody; -import org.apache.xmlbeans.impl.soap.SOAPBodyElement; -import org.apache.xmlbeans.impl.soap.SOAPElement; -import org.apache.xmlbeans.impl.soap.SOAPEnvelope; -import org.apache.xmlbeans.impl.soap.SOAPException; -import org.apache.xmlbeans.impl.soap.SOAPFactory; -import org.apache.xmlbeans.impl.soap.SOAPFault; -import org.apache.xmlbeans.impl.soap.SOAPHeader; -import org.apache.xmlbeans.impl.soap.SOAPHeaderElement; -import org.apache.xmlbeans.impl.soap.SOAPPart; +import org.w3c.dom.*; +import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamReader; - -import java.io.PrintStream; - -import java.util.ArrayList; -import java.util.Iterator; - import javax.xml.transform.Source; -import javax.xml.namespace.QName; +import java.io.PrintStream; +import java.util.*; -import org.apache.xmlbeans.XmlException; -import org.apache.xmlbeans.XmlRuntimeException; -import org.apache.xmlbeans.XmlCursor; -import org.apache.xmlbeans.XmlObject; +// DOM Level 3 final class DomImpl { @@ -95,7 +60,7 @@ final class DomImpl void dump ( PrintStream o ); void dump ( PrintStream o, Object ref ); }; - + static Dom parent ( Dom d ) { return node_getParentNode ( d ); } static Dom firstChild ( Dom d ) { return node_getFirstChild ( d ); } static Dom nextSibling ( Dom d ) { return node_getNextSibling( d ); } @@ -131,13 +96,13 @@ final class DomImpl HierarchyRequestErr ( ) { this( "This node isn't allowed there" ); } HierarchyRequestErr ( String message ) { super( HIERARCHY_REQUEST_ERR, message ); } } - + static class WrongDocumentErr extends DOMException { WrongDocumentErr ( ) { this( "Nodes do not belong to the same document" ); } WrongDocumentErr ( String message ) { super( WRONG_DOCUMENT_ERR, message ); } } - + static class NotFoundErr extends DOMException { NotFoundErr ( ) { this( "Node not found" ); } @@ -155,13 +120,13 @@ final class DomImpl NoModificationAllowedErr ( ) { this( "No modification allowed error" ); } NoModificationAllowedErr ( String message ) { super( NO_MODIFICATION_ALLOWED_ERR, message ); } } - + static class InuseAttributeError extends DOMException { InuseAttributeError ( ) { this( "Attribute currently in use error" ); } InuseAttributeError ( String message ) { super( INUSE_ATTRIBUTE_ERR, message ); } } - + static class IndexSizeError extends DOMException { IndexSizeError ( ) { this( "Index Size Error" ); } @@ -183,7 +148,7 @@ final class DomImpl // // Helper fcns // - + private static final class EmptyNodeList implements NodeList { public int getLength ( ) { return 0; } @@ -191,7 +156,7 @@ final class DomImpl } public static NodeList _emptyNodeList = new EmptyNodeList(); - + static String nodeKindName ( int t ) { switch ( t ) @@ -208,7 +173,7 @@ final class DomImpl case NOTATION : return "notation"; case PROCINST : return "processing instruction"; case TEXT : return "text"; - + default : throw new RuntimeException( "Unknown node type" ); } } @@ -235,7 +200,7 @@ final class DomImpl { if (document_getDoctype( parent ) != null) return "Documents may only have a maximum of one document type node"; - + return null; } case PROCINST : @@ -256,7 +221,7 @@ final class DomImpl break; } - + case DOCFRAG : case ELEMENT : case ENTITY : @@ -304,7 +269,7 @@ final class DomImpl { // TODO - use read only state on a node to know if it is under an // entity ref - + if (child.nodeType() == ENTITYREF) throw new NoModificationAllowedErr( "Entity reference trees may not be modified" ); @@ -317,7 +282,7 @@ final class DomImpl String prefix, String uri, String local, boolean isAttr ) { validateNcName( prefix ); - + if (prefix == null) prefix = ""; @@ -354,36 +319,36 @@ final class DomImpl return prefix; } - + private static void validateName ( String name ) { if (name == null) throw new IllegalArgumentException( "Name is null" ); - + if (name.length() == 0) throw new IllegalArgumentException( "Name is empty" ); - + if (!XMLChar.isValidName( name )) throw new InvalidCharacterError( "Name has an invalid character" ); } - + private static void validateNcName ( String name ) { if (name != null && name.length() > 0 && !XMLChar.isValidNCName( name )) throw new InvalidCharacterError(); } - + private static void validateQualifiedName ( String name, String uri, boolean isAttr ) { assert name != null; if (uri == null) uri = ""; - + int i = name.indexOf( ':' ); String local; - + if (i < 0) { validateNcName( local = name ); @@ -401,23 +366,23 @@ final class DomImpl throw new NamespaceErr( "Invalid qualified name, no prefix specified" ); String prefix = name.substring( 0, i ); - + validateNcName( prefix ); if (uri.length() == 0) throw new NamespaceErr( "Attempt to give a prefix for no namespace" ); - + local = name.substring( i + 1 ); - + if (local.indexOf( ':' ) >= 0) throw new NamespaceErr( "Invalid qualified name, more than one colon" ); - + validateNcName( local ); if (prefix.equals( "xml" ) && !uri.equals( Locale._xml1998Uri )) throw new NamespaceErr( "Invalid prefix - begins with 'xml'" ); } - + if (local.length() == 0) throw new NamespaceErr( "Invalid qualified name, no local part specified" ); } @@ -425,7 +390,7 @@ final class DomImpl private static void removeNode ( Dom n ) { assert n.nodeType() != TEXT && n.nodeType() != CDATA; - + Cur cFrom = n.tempCur(); cFrom.toEnd(); @@ -433,7 +398,7 @@ final class DomImpl // Move any char nodes which ater after the node to remove to be before it. The call to // Next here does two things, it tells me if I can get after the move to remove (all nodes // but the root) and it positions me at the place where there are char nodes after. - + if (cFrom.next()) { CharNode fromNodes = cFrom.getCharNodes(); @@ -469,14 +434,14 @@ final class DomImpl return _elements.size(); } - + public Node item ( int i ) { ensureElements(); return i < 0 || i >= _elements.size() ? (Node) null : (Node) _elements.get( i ); } - + private void ensureElements ( ) { if (_version == _locale.version()) @@ -530,7 +495,7 @@ final class DomImpl private String _name; } - + private static class ElementsByTagNameNSNodeList extends ElementsNodeList { ElementsByTagNameNSNodeList ( Dom root, String uri, String local ) @@ -552,7 +517,7 @@ final class DomImpl private String _uri; private String _local; } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// @@ -570,13 +535,13 @@ final class DomImpl Locale l, String namespaceURI, String qualifiedName, DocumentType doctype ) { validateQualifiedName( qualifiedName, namespaceURI, false ); - + Cur c = l.tempCur(); c.createDomDocumentRoot(); Document doc = (Document) c.getDom(); - + c.next(); c.createElement( l.makeQualifiedQName( namespaceURI, qualifiedName ) ); @@ -596,10 +561,10 @@ final class DomImpl } c.release(); - + return doc; } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// @@ -608,7 +573,7 @@ final class DomImpl { if (feature == null) return false; - + if (version != null && version.length() > 0 && !version.equals( "1.0" ) && !version.equals( "2.0" )) { @@ -617,7 +582,7 @@ final class DomImpl if (feature.equalsIgnoreCase( "core" )) return true; - + if (feature.equalsIgnoreCase( "xml" )) return true; @@ -627,7 +592,7 @@ final class DomImpl ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - + public static Element _document_getDocumentElement ( Dom d ) { Locale l = d.locale(); @@ -666,7 +631,7 @@ final class DomImpl return (DocumentFragment) f; } - + public static Dom document_createDocumentFragment ( Dom d ) { Cur c = d.locale().tempCur(); @@ -674,7 +639,7 @@ final class DomImpl c.createDomDocFragRoot(); Dom f = c.getDom(); - + c.release(); return f; @@ -699,7 +664,7 @@ final class DomImpl public static Dom document_createElement ( Dom d, String name ) { validateName( name ); - + Locale l = d.locale(); Cur c = l.tempCur(); @@ -709,7 +674,7 @@ final class DomImpl Dom e = c.getDom(); c.release(); - ((Xobj.ElementXobj)e)._canHavePrefixUri = false; + ((ElementXobj)e)._canHavePrefixUri = false; return e; } @@ -732,11 +697,11 @@ final class DomImpl public static Dom document_createElementNS ( Dom d, String uri, String qname ) { validateQualifiedName( qname, uri, false ); - + Locale l = d.locale(); - + Cur c = l.tempCur(); - + c.createElement( l.makeQualifiedQName( uri, qname ) ); Dom e = c.getDom(); @@ -745,7 +710,7 @@ final class DomImpl return e; } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// @@ -775,7 +740,7 @@ final class DomImpl Dom e = c.getDom(); c.release(); - ((Xobj.AttrXobj)e)._canHavePrefixUri = false; + ((AttrXobj)e)._canHavePrefixUri = false; return e; } @@ -794,7 +759,7 @@ final class DomImpl return (Attr) a; } - + public static Dom document_createAttributeNS ( Dom d, String uri, String qname ) { validateQualifiedName( qname, uri, true ); @@ -827,7 +792,7 @@ final class DomImpl return (Comment) c; } - + public static Dom document_createComment ( Dom d, String data ) { Locale l = d.locale(); @@ -864,21 +829,21 @@ final class DomImpl return (ProcessingInstruction) pi; } - + public static Dom document_createProcessingInstruction ( Dom d, String target, String data ) { if (target == null) throw new IllegalArgumentException( "Target is null" ); - + if (target.length() == 0) throw new IllegalArgumentException( "Target is empty" ); - + if (!XMLChar.isValidName( target )) throw new InvalidCharacterError( "Target has an invalid character" ); - + if (Locale.beginsWithXml( target ) && target.length() == 3) throw new InvalidCharacterError( "Invalid target - is 'xml'" ); - + Locale l = d.locale(); Cur c = l.tempCur(); @@ -906,7 +871,7 @@ final class DomImpl { return (CDATASection) document_createCDATASection( d, data ); } - + public static Dom document_createCDATASection ( Dom d, String data ) { TextNode t = d.locale().createCdataNode(); @@ -915,7 +880,7 @@ final class DomImpl data = ""; t.setChars( data, 0, data.length() ); - + return t; } @@ -969,7 +934,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return document_getElementsByTagName( d, name ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return document_getElementsByTagName( d, name ); } finally { l.exit(); } } } - + public static NodeList document_getElementsByTagName ( Dom d, String name ) { return new ElementsByTagNameNodeList( d, name ); @@ -986,7 +951,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return document_getElementsByTagNameNS( d, uri, local ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return document_getElementsByTagNameNS( d, uri, local ); } finally { l.exit(); } } } - + public static NodeList document_getElementsByTagNameNS ( Dom d, String uri, String local ) { return new ElementsByTagNameNSNodeList( d, uri, local ); @@ -1027,11 +992,11 @@ final class DomImpl { if (n == null) return null; - + Dom i; boolean copyChildren = false; - + switch ( n.getNodeType() ) { case DOCUMENT : @@ -1064,7 +1029,7 @@ final class DomImpl attributes_setNamedItem( i, document_importNode( d, attrs.item( a ), true ) ); copyChildren = deep; - + break; } @@ -1087,43 +1052,43 @@ final class DomImpl } copyChildren = true; - + break; } - + case DOCFRAG : { i = document_createDocumentFragment( d ); - + copyChildren = deep; break; } - + case PROCINST : { i = document_createProcessingInstruction( d, n.getNodeName(), n.getNodeValue() ); break; } - + case COMMENT : { i = document_createComment( d, n.getNodeValue() ); break; } - + case TEXT : { i = document_createTextNode( d, n.getNodeValue() ); break; } - + case CDATA : { i = document_createCDATASection( d, n.getNodeValue() ); break; } - + case ENTITYREF : case ENTITY : case NOTATION : @@ -1135,7 +1100,7 @@ final class DomImpl if (copyChildren) { NodeList children = n.getChildNodes(); - + for ( int c = 0 ; c < children.getLength() ; c++ ) node_insertBefore( i, document_importNode( d, children.item( c ), true ), null); } @@ -1179,12 +1144,12 @@ final class DomImpl return (Document) d; } - + public static Dom node_getOwnerDocument ( Dom n ) { if (n.nodeType() == DOCUMENT) return null; - + Locale l = n.locale(); if (l._ownerDoc == null) @@ -1207,7 +1172,7 @@ final class DomImpl Locale l = n.locale(); Dom p; - + if (l.noSync()) { l.enter(); try { p = node_getParentNode( n ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { p = node_getParentNode( n ); } finally { l.exit(); } } @@ -1224,7 +1189,7 @@ final class DomImpl case DOCFRAG : case ATTR : break; - + case PROCINST : case COMMENT : case ELEMENT : @@ -1246,25 +1211,25 @@ final class DomImpl break; } - + case ENTITYREF : throw new RuntimeException( "Not impl" ); - + case ENTITY : case DOCTYPE : case NOTATION : throw new RuntimeException( "Not impl" ); - + default : throw new RuntimeException( "Unknown kind" ); } if (c == null) return null; - + Dom d = c.getDom(); - + c.release(); - + return d; } @@ -1272,8 +1237,7 @@ final class DomImpl ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - public static Node _node_getFirstChild ( Dom n ) - { + public static Node _node_getFirstChild ( Dom n ) { Locale l = n.locale(); Dom fc; @@ -1286,7 +1250,7 @@ final class DomImpl Xobj lastAttr = node.lastAttr(); if (lastAttr != null && lastAttr.isNextSiblingPtrDomUsable()) - return (Xobj.NodeXobj) lastAttr._nextSibling; + return (NodeXobj) lastAttr._nextSibling; if (node.isExistingCharNodesValueUsable()) return node._charNodesValue; } @@ -1307,15 +1271,15 @@ final class DomImpl case PROCINST : case COMMENT : break; - + case ENTITYREF : throw new RuntimeException( "Not impl" ); - + case ENTITY : case DOCTYPE : case NOTATION : throw new RuntimeException( "Not impl" ); - + case ELEMENT : case DOCUMENT : case DOCFRAG : @@ -1325,12 +1289,12 @@ final class DomImpl Xobj node = (Xobj) n; node.ensureOccupancy(); if (node.isFirstChildPtrDomUsable()) - return (Xobj.NodeXobj) node._firstChild; + return (NodeXobj) node._firstChild; Xobj lastAttr = node.lastAttr(); if (lastAttr != null) { if (lastAttr.isNextSiblingPtrDomUsable()) - return (Xobj.NodeXobj) lastAttr._nextSibling; + return (NodeXobj) lastAttr._nextSibling; else if (lastAttr.isCharNodesAfterUsable()) return (CharNode) lastAttr._charNodesAfter; } @@ -1346,7 +1310,7 @@ final class DomImpl return fc; } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// @@ -1362,7 +1326,7 @@ final class DomImpl return (Node) lc; } - + public static Dom node_getLastChild ( Dom n ) { switch ( n.nodeType() ) @@ -1387,7 +1351,7 @@ final class DomImpl case ATTR : break; } - + Dom lc = null; CharNode nodes; @@ -1396,7 +1360,7 @@ final class DomImpl if (c.toLastChild()) { lc = c.getDom(); - + c.skip(); if ((nodes = c.getCharNodes()) != null) @@ -1449,7 +1413,7 @@ final class DomImpl case DOCFRAG : case ATTR : break; - + case TEXT : case CDATA : { @@ -1460,9 +1424,9 @@ final class DomImpl // b) this node is value && src._fc = null; ret null - if (! (cn._src instanceof Xobj) ) + if (! (cn.getObject() instanceof Xobj) ) return null; - Xobj src = (Xobj) cn._src; + Xobj src = (Xobj) cn.getObject(); //if src is attr this node is always value and // next is always the next ptr of the attr src._charNodesAfter = @@ -1479,9 +1443,9 @@ final class DomImpl boolean isThisNodeAfterText = cn.isNodeAftertext(); if (isThisNodeAfterText) - ns = (Xobj.NodeXobj) src._nextSibling; + ns = (NodeXobj) src._nextSibling; else //srcValue or attribute source - ns = (Xobj.NodeXobj) src._firstChild; + ns = (NodeXobj) src._firstChild; break; } @@ -1495,7 +1459,7 @@ final class DomImpl node.ensureOccupancy(); if (node.isNextSiblingPtrDomUsable()) return - (Xobj.NodeXobj) node._nextSibling; + (NodeXobj) node._nextSibling; if (node.isCharNodesAfterUsable()) return node._charNodesAfter; break; @@ -1528,21 +1492,18 @@ final class DomImpl return (Node) ps; } - + public static Dom node_getPreviousSibling ( Dom n ) { - Dom prev = null; - Dom temp; - switch (n.nodeType()) - { - case TEXT: - case CDATA: - { + Dom prev; + switch (n.nodeType()) { + case TEXT: + case CDATA: { assert n instanceof CharNode: "Text/CData should be a CharNode"; CharNode node = (CharNode) n; - if (!(node._src instanceof Xobj)) + if (!(node.getObject() instanceof Xobj)) return null; - Xobj src = (Xobj) node._src; + Xobj src = (Xobj) node.getObject(); src.ensureOccupancy(); boolean isThisNodeAfterText = node.isNodeAftertext(); prev = node._prev; @@ -1551,19 +1512,20 @@ final class DomImpl src._charNodesValue; break; } - default: - { + default: { assert n instanceof Xobj; Xobj node = (Xobj) n; prev = (Dom) node._prevSibling; - if (prev == null && node._parent != null) - prev = (Dom) node_getFirstChild((Dom) node._parent); + if ((prev == null || !(node instanceof AttrXobj) && prev instanceof AttrXobj) && + node._parent != null) { + prev = node_getFirstChild((Dom) node._parent); + } } } - temp = (Dom) prev; - while (temp != null && - (temp = node_getNextSibling(temp)) != n) + Dom temp = prev; + while (temp != null && (temp = node_getNextSibling(temp)) != n) { prev = temp; + } return prev; } @@ -1578,15 +1540,15 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return node_hasAttributes( n ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return node_hasAttributes( n ); } finally { l.exit(); } } } - + public static boolean node_hasAttributes ( Dom n ) { boolean hasAttrs = false; - + if (n.nodeType() == ELEMENT) { Cur c = n.tempCur(); - + hasAttrs = c.hasAttrs(); c.release(); @@ -1615,7 +1577,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { node_normalize( n ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { node_normalize( n ); } finally { l.exit(); } } } - + public static void node_normalize ( Dom n ) { switch ( n.nodeType() ) @@ -1678,7 +1640,7 @@ final class DomImpl while ( ! c.isAtEndOfLastPush() ); c.release(); - + n.locale().invalidateDomCaches(n); } @@ -1686,10 +1648,9 @@ final class DomImpl ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - public static boolean _node_hasChildNodes ( Dom n ) - { + public static boolean _node_hasChildNodes ( Dom n ) { // TODO - make this faster - return _node_getFirstChild( n ) != null; + return n instanceof Xobj && _node_getFirstChild( n ) != null; } ////////////////////////////////////////////////////////////////////////////////////// @@ -1732,14 +1693,14 @@ final class DomImpl return (Node) d; } - + public static Dom node_replaceChild ( Dom p, Dom newChild, Dom oldChild ) { // Remove the old child firest to avoid a dom exception raised // when inserting two document elements - + Dom nextNode = node_getNextSibling( oldChild ); - + node_removeChild( p, oldChild ); try @@ -1768,7 +1729,7 @@ final class DomImpl throw new IllegalArgumentException( "Child to add is null" ); Dom nc; - + if (!(newChild instanceof Dom) || (nc = (Dom) newChild).locale() != l) throw new WrongDocumentErr( "Child to add is from another document" ); @@ -1817,10 +1778,10 @@ final class DomImpl append( c, p ); else insert( c, rc ); - + c = n; } - + return nc; } @@ -1835,7 +1796,7 @@ final class DomImpl // remove( nc ); - + int pk = p.nodeType(); // Only these nodes can be modifiable parents @@ -1861,9 +1822,9 @@ final class DomImpl if (rck == TEXT || rck == CDATA) { // Quick and dirty impl.... - + ArrayList charNodes = new ArrayList(); - + while ( rc != null && (rc.nodeType() == TEXT || rc.nodeType() == CDATA ) ) { Dom next = nextSibling( rc ); @@ -1903,7 +1864,7 @@ final class DomImpl break; } - + case TEXT : case CDATA : { @@ -1913,13 +1874,13 @@ final class DomImpl CharNode refCharNode = null; Cur c = p.tempCur(); - + if (rc == null) c.toEnd(); else { int rck = rc.nodeType(); - + if (rck == TEXT || rck == CDATA) c.moveToCharNode( refCharNode = (CharNode) rc ); else if (rck == ENTITYREF) @@ -1932,7 +1893,7 @@ final class DomImpl nodes = CharNode.insertNode( nodes, n, refCharNode ); - c.insertChars( n._src, n._off, n._cch ); + c.insertChars( n.getObject(), n._off, n._cch ); c.setCharNodes( nodes ); @@ -1945,22 +1906,22 @@ final class DomImpl { throw new RuntimeException( "Not implemented" ); } - + case DOCTYPE : { // TODO - don't actually insert this here, associate it with the // doc?? Hmm .. Perhaps I should disallow insertion into the tree // at all. - + throw new RuntimeException( "Not implemented" ); } - + default : throw new RuntimeException( "Unexpected child node type" ); } - + return nc; } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// @@ -1973,7 +1934,7 @@ final class DomImpl throw new NotFoundErr( "Child to remove is null" ); Dom c; - + if (!(child instanceof Dom) || (c = (Dom) child).locale() != l) throw new WrongDocumentErr( "Child to remove is from another document" ); @@ -1989,14 +1950,14 @@ final class DomImpl { if (parent( child ) != parent) throw new NotFoundErr( "Child to remove is not a child of given parent" ); - + switch ( child.nodeType() ) { case DOCUMENT : case DOCFRAG : case ATTR : throw new IllegalStateException(); - + case ELEMENT : case PROCINST : case COMMENT : @@ -2007,30 +1968,30 @@ final class DomImpl case CDATA : { Cur c = child.tempCur(); - + CharNode nodes = c.getCharNodes(); CharNode cn = (CharNode) child; - assert cn._src instanceof Dom; + assert(cn.getDom() != null); cn.setChars( c.moveChars( null, cn._cch ), c._offSrc, c._cchSrc ); - + c.setCharNodes( CharNode.remove( nodes, cn ) ); c.release(); break; } - + case ENTITYREF : throw new RuntimeException( "Not impl" ); - + case ENTITY : case DOCTYPE : case NOTATION : throw new RuntimeException( "Not impl" ); - + default : throw new RuntimeException( "Unknown kind" ); } @@ -2052,29 +2013,29 @@ final class DomImpl return (Node) c; } - + public static Dom node_cloneNode ( Dom n, boolean deep ) { Locale l = n.locale(); - + Dom clone = null; - + if (!deep) { Cur shallow = null; - + switch ( n.nodeType() ) { case DOCUMENT : shallow = l.tempCur(); shallow.createDomDocumentRoot(); break; - + case DOCFRAG : shallow = l.tempCur(); shallow.createDomDocFragRoot(); break; - + case ELEMENT : { shallow = l.tempCur(); @@ -2082,13 +2043,13 @@ final class DomImpl Element elem = (Element) shallow.getDom(); NamedNodeMap attrs = ((Element) n).getAttributes(); - + for ( int i = 0 ; i < attrs.getLength() ; i++ ) elem.setAttributeNodeNS( (Attr) attrs.item( i ).cloneNode( true ) ); - + break; } - + case ATTR : shallow = l.tempCur(); shallow.createAttr( n.getQName() ); @@ -2198,7 +2159,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { node_setPrefix( n, prefix ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { node_setPrefix( n, prefix ); } finally { l.exit(); } } } - + public static void node_setPrefix ( Dom n, String prefix ) { // TODO - make it possible to set the prefix of an xmlns @@ -2216,9 +2177,9 @@ final class DomImpl String local = name.getLocalPart(); prefix = validatePrefix( prefix, uri, local, n.nodeType() == ATTR ); - + c.setName( n.locale().makeQName( uri, local, prefix ) ); - + c.release(); } else @@ -2251,7 +2212,7 @@ final class DomImpl case DOCUMENT : return "#document"; case PROCINST : return n.getQName().getLocalPart(); case TEXT : return "#text"; - + case ATTR : case ELEMENT : { @@ -2265,7 +2226,7 @@ final class DomImpl case ENTITYREF : case NOTATION : throw new RuntimeException( "Not impl" ); - + default : throw new RuntimeException( "Unknown node type" ); } } @@ -2290,12 +2251,12 @@ final class DomImpl if (l.noSync()) { l.enter(); try { node_setNodeValue( n, nodeValue ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { node_setNodeValue( n, nodeValue ); } finally { l.exit(); } } } - + public static void node_setNodeValue ( Dom n, String nodeValue ) { if (nodeValue == null) nodeValue = ""; - + switch ( n.nodeType() ) { case TEXT : @@ -2317,16 +2278,16 @@ final class DomImpl break; } - + case ATTR : { // Try to set an exisiting text node to contain the new value - + NodeList children = ((Node) n).getChildNodes(); while ( children.getLength() > 1 ) node_removeChild( n, (Dom) children.item( 1 ) ); - + if (children.getLength() == 0) { TextNode tn = n.locale().createTextNode(); @@ -2338,31 +2299,31 @@ final class DomImpl assert children.getLength() == 1; children.item( 0 ).setNodeValue( nodeValue ); } - if (((Xobj.AttrXobj) n).isId()) + if (((AttrXobj) n).isId()) { Dom d = DomImpl.node_getOwnerDocument(n); String val = node_getNodeValue(n); - if (d instanceof Xobj.DocumentXobj) + if (d instanceof DocumentXobj) { - ((Xobj.DocumentXobj) d).removeIdElement(val); - ((Xobj.DocumentXobj) d).addIdElement(nodeValue, + ((DocumentXobj) d).removeIdElement(val); + ((DocumentXobj) d).addIdElement(nodeValue, attr_getOwnerElement(n)); } } break; } - + case PROCINST : case COMMENT : { Cur c = n.tempCur(); c.next(); - + c.getChars( -1 ); c.moveChars( null, c._cchSrc ); c.insertString( nodeValue ); - + c.release(); break; @@ -2401,10 +2362,10 @@ final class DomImpl { assert n instanceof CharNode: "Text/CData should be a CharNode"; CharNode node = (CharNode) n; - if (! (node._src instanceof Xobj) ) - s = CharUtil.getString( node._src, node._off, node._cch ); - else{ - Xobj src = (Xobj) node._src; + if (! (node.getObject() instanceof Xobj) ) { + s = CharUtil.getString(node.getObject(), node._off, node._cch); + }else{ + Xobj src = (Xobj) node.getObject(); src.ensureOccupancy(); boolean isThisNodeAfterText = node.isNodeAftertext(); if( isThisNodeAfterText ){ @@ -2430,108 +2391,152 @@ final class DomImpl ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - public static Object _node_getUserData ( Dom n, String key ) - { - throw new RuntimeException( "DOM Level 3 Not implemented" ); + public static Object _node_getUserData ( Dom n, String key ) { + throw new DomLevel3NotImplemented(); } ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - public static Object _node_setUserData ( Dom n, String key, Object data, UserDataHandler handler ) - { - throw new RuntimeException( "DOM Level 3 Not implemented" ); + public static Object _node_setUserData ( Dom n, String key, Object data, UserDataHandler handler ) { + throw new DomLevel3NotImplemented(); } ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - public static Object _node_getFeature ( Dom n, String feature, String version ) - { - throw new RuntimeException( "DOM Level 3 Not implemented" ); + public static Object _node_getFeature ( Dom n, String feature, String version ) { + throw new DomLevel3NotImplemented(); } ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - public static boolean _node_isEqualNode ( Dom n, Node arg ) - { - throw new RuntimeException( "DOM Level 3 Not implemented" ); + public static boolean _node_isEqualNode ( Dom n, Node arg ) { + throw new DomLevel3NotImplemented(); } ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - public static boolean _node_isSameNode ( Dom n, Node arg ) - { - throw new RuntimeException( "DOM Level 3 Not implemented" ); + public static boolean _node_isSameNode ( Dom n, Node arg ) { + // TODO: check if relying on object identity is ok + boolean ret; + if (n instanceof CharNode) { +// ret = ((CharNode)n).getDom().equals(arg); + ret = n.equals(arg); + } else if (n instanceof NodeXobj) { + ret = ((NodeXobj)n).getDom().equals(arg); + } else { + throw new DomLevel3NotImplemented(); + } + return ret; } ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - public static String _node_lookupNamespaceURI ( Dom n, String prefix ) - { - throw new RuntimeException( "DOM Level 3 Not implemented" ); + public static String _node_lookupNamespaceURI ( Dom n, String prefix ) { + throw new DomLevel3NotImplemented(); } ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - public static boolean _node_isDefaultNamespace ( Dom n, String namespaceURI ) - { - throw new RuntimeException( "DOM Level 3 Not implemented" ); + public static boolean _node_isDefaultNamespace ( Dom n, String namespaceURI ) { + throw new DomLevel3NotImplemented(); } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - public static String _node_lookupPrefix ( Dom n, String namespaceURI ) - { - throw new RuntimeException( "DOM Level 3 Not implemented" ); + public static String _node_lookupPrefix ( Dom n, String namespaceURI ) { + throw new DomLevel3NotImplemented(); } ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - public static void _node_setTextContent ( Dom n, String textContent ) - { - throw new RuntimeException( "DOM Level 3 Not implemented" ); + public static void _node_setTextContent ( Dom n, String textContent ) { + throw new DomLevel3NotImplemented(); } ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - public static String _node_getTextContent ( Dom n ) - { - throw new RuntimeException( "DOM Level 3 Not implemented" ); + public static String _node_getTextContent ( Dom n ) { + throw new DomLevel3NotImplemented(); } ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - public static short _node_compareDocumentPosition ( Dom n, Node other ) - { - throw new RuntimeException( "DOM Level 3 Not implemented" ); + public static short _node_compareDocumentPosition ( Dom n, Node other ) { + // TODO: find a faster way to compare, may be based on the locale / cursor elements inside the nodes + if (!(n instanceof Node)) { + return Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC; + } + Iterator<Node> nAncIter = ancestorAndSelf((Node)n).iterator(); + Iterator<Node> oAncIter = ancestorAndSelf(other).iterator(); + + Node nAnc, oAnc; + boolean isFirst = true, isEqual; + do { + nAnc = nAncIter.next(); + oAnc = oAncIter.next(); + isEqual = Objects.equals(nAnc,oAnc); + if (isFirst && !isEqual) { + // if root node differ, the elements are from different documents + return Node.DOCUMENT_POSITION_DISCONNECTED; + } + isFirst = false; + } while (isEqual && nAncIter.hasNext() && oAncIter.hasNext()); + + if (isEqual) { + return nAncIter.hasNext() + ? Node.DOCUMENT_POSITION_CONTAINS | Node.DOCUMENT_POSITION_PRECEDING + : (oAncIter.hasNext() + ? Node.DOCUMENT_POSITION_CONTAINED_BY | Node.DOCUMENT_POSITION_FOLLOWING + : Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC + ); + } else { + Node prevSib = nAnc; + while ((prevSib = prevSib.getPreviousSibling()) != null) { + if (Objects.equals(prevSib, oAnc)) { + return Node.DOCUMENT_POSITION_PRECEDING; + } + } + return Node.DOCUMENT_POSITION_FOLLOWING; + } } + private static List<Node> ancestorAndSelf(Node node) { + LinkedList<Node> nodes = new LinkedList<>(); + Node n = node; + do { + nodes.addFirst(n); + n = n.getParentNode(); + } while (n != null); + return nodes; + } + + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - public static String _node_getBaseURI ( Dom n ) - { - throw new RuntimeException( "DOM Level 3 Not implemented" ); + public static String _node_getBaseURI ( Dom n ) { + throw new DomLevel3NotImplemented(); } ////////////////////////////////////////////////////////////////////////////////////// @@ -2549,12 +2554,12 @@ final class DomImpl return (Node) d; } - + public static Dom childNodes_item ( Dom n, int i ) { if (i < 0) return null; - + switch ( n.nodeType() ) { case TEXT : @@ -2598,7 +2603,7 @@ final class DomImpl if (l.noSync()) { return childNodes_getLength( n ); } else synchronized ( l ) { return childNodes_getLength( n ); } } - + public static int childNodes_getLength ( Dom n ) { switch ( n.nodeType() ) @@ -2668,7 +2673,7 @@ final class DomImpl { return (Attr) _attributes_setNamedItem( e, newAttr ); } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// @@ -2754,7 +2759,7 @@ final class DomImpl { if (oldAttr == null) throw new NotFoundErr( "Attribute to remove is null" ); - + if (oldAttr.getOwnerElement() != e) throw new NotFoundErr( "Attribute to remove does not belong to this element" ); @@ -2775,7 +2780,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { element_setAttribute( e, name, value ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { element_setAttribute( e, name, value ); } finally { l.exit(); } } } - + public static void element_setAttribute ( Dom e, String name, String value ) { Dom a = attributes_getNamedItem( e, name ); @@ -2785,7 +2790,7 @@ final class DomImpl a = document_createAttribute( node_getOwnerDocument( e ), name ); attributes_setNamedItem( e, a ); } - + node_setNodeValue( a, value ); } @@ -2800,11 +2805,11 @@ final class DomImpl if (l.noSync()) { l.enter(); try { element_setAttributeNS( e, uri, qname, value ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { element_setAttributeNS( e, uri, qname, value ); } finally { l.exit(); } } } - + public static void element_setAttributeNS ( Dom e, String uri, String qname, String value ) { validateQualifiedName( qname, uri, true ); - + QName name = e.locale().makeQualifiedQName( uri, qname ); String local = name.getLocalPart(); String prefix = validatePrefix( name.getPrefix(), uri, local, true ); @@ -2849,12 +2854,12 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return element_getElementsByTagNameNS( e, uri, local ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return element_getElementsByTagNameNS( e, uri, local ); } finally { l.exit(); } } } - + public static NodeList element_getElementsByTagNameNS ( Dom e, String uri, String local ) { return new ElementsByTagNameNSNodeList( e, uri, local ); } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// @@ -2866,7 +2871,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return attributes_getLength( e ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return attributes_getLength( e ); } finally { l.exit(); } } } - + public static int attributes_getLength ( Dom e ) { int n = 0; @@ -2893,10 +2898,10 @@ final class DomImpl throw new IllegalArgumentException( "Attr to set is null" ); Dom a; - + if (!(attr instanceof Dom) || (a = (Dom) attr).locale() != l) throw new WrongDocumentErr( "Attr to set is from another document" ); - + Dom oldA; if (l.noSync()) { l.enter(); try { oldA = attributes_setNamedItem( e, a ); } finally { l.exit(); } } @@ -2904,7 +2909,7 @@ final class DomImpl return (Node) oldA; } - + public static Dom attributes_setNamedItem ( Dom e, Dom a ) { if (attr_getOwnerElement( a ) != null) @@ -2948,7 +2953,7 @@ final class DomImpl } c.release(); - + return oldAttr; } @@ -2967,7 +2972,7 @@ final class DomImpl return (Node) n; } - + public static Dom attributes_getNamedItem ( Dom e, String name ) { Dom a = null; @@ -2989,7 +2994,7 @@ final class DomImpl return a; } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// @@ -3005,12 +3010,12 @@ final class DomImpl return (Node) n; } - + public static Dom attributes_getNamedItemNS ( Dom e, String uri, String local ) { if (uri == null) uri = ""; - + Dom a = null; Cur c = e.tempCur(); @@ -3032,7 +3037,7 @@ final class DomImpl return a; } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// @@ -3048,7 +3053,7 @@ final class DomImpl return (Node) n; } - + public static Dom attributes_removeNamedItem ( Dom e, String name ) { Dom oldAttr = null; @@ -3064,18 +3069,18 @@ final class DomImpl if (oldAttr == null) oldAttr = aa; - if (((Xobj.AttrXobj) aa).isId()) + if (((AttrXobj) aa).isId()) { Dom d = DomImpl.node_getOwnerDocument(aa); String val = node_getNodeValue( aa ); - if (d instanceof Xobj.DocumentXobj) - ((Xobj.DocumentXobj) d).removeIdElement(val); + if (d instanceof DocumentXobj) + ((DocumentXobj) d).removeIdElement(val); } removeNode(aa); c.toPrevAttr(); } } - + c.release(); if (oldAttr == null) @@ -3083,7 +3088,7 @@ final class DomImpl return oldAttr; } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// @@ -3099,12 +3104,12 @@ final class DomImpl return (Node) n; } - + public static Dom attributes_removeNamedItemNS ( Dom e, String uri, String local ) { if (uri == null) uri = ""; - + Dom oldAttr = null; Cur c = e.tempCur(); @@ -3119,15 +3124,15 @@ final class DomImpl { if (oldAttr == null) oldAttr = aa; - if (((Xobj.AttrXobj) aa).isId()) + if (((AttrXobj) aa).isId()) { Dom d = DomImpl.node_getOwnerDocument(aa); String val = node_getNodeValue( aa ); - if (d instanceof Xobj.DocumentXobj) - ((Xobj.DocumentXobj) d).removeIdElement(val); + if (d instanceof DocumentXobj) + ((DocumentXobj) d).removeIdElement(val); } removeNode( aa ); - + c.toPrevAttr(); } } @@ -3139,7 +3144,7 @@ final class DomImpl return oldAttr; } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// @@ -3163,14 +3168,14 @@ final class DomImpl return (Node) oldA; } - + public static Dom attributes_setNamedItemNS ( Dom e, Dom a ) { Dom owner = attr_getOwnerElement( a ); if (owner == e) return a; - + if (owner != null) throw new InuseAttributeError(); @@ -3225,18 +3230,18 @@ final class DomImpl Locale l = e.locale(); Dom a; - + if (l.noSync()) { l.enter(); try { a = attributes_item( e, index ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { a = attributes_item( e, index ); } finally { l.exit(); } } return (Node) a; } - + public static Dom attributes_item ( Dom e, int index ) { if (index < 0) return null; - + Cur c = e.tempCur(); Dom a = null; @@ -3381,7 +3386,7 @@ final class DomImpl public static void _characterData_insertData ( Dom c, int offset, String arg ) { String s = _characterData_getData( c ); - + if (offset < 0 || offset > s.length()) throw new IndexSizeError(); @@ -3444,7 +3449,7 @@ final class DomImpl public static Text _text_splitText ( Dom t, int offset ) { assert t.nodeType() == TEXT; - + String s = _characterData_getData( t ); if (offset < 0 || offset > s.length()) @@ -3453,7 +3458,7 @@ final class DomImpl _characterData_deleteData( t, offset, s.length() - offset ); // Don't need to pass a doc here, any node will do.. - + Dom t2 = (Dom) _document_createTextNode( t, s.substring( offset ) ); Dom p = (Dom) _node_getParentNode( t ); @@ -3463,41 +3468,38 @@ final class DomImpl _node_insertBefore( p, (Text) t2, _node_getNextSibling( t ) ); t.locale().invalidateDomCaches(p); } - + return (Text) t2; } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - - public static String _text_getWholeText ( Dom t ) - { - throw new RuntimeException( "DOM Level 3 Not implemented" ); + + public static String _text_getWholeText ( Dom t ) { + throw new DomLevel3NotImplemented(); } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - - public static boolean _text_isElementContentWhitespace ( Dom t ) - { - throw new RuntimeException( "DOM Level 3 Not implemented" ); + + public static boolean _text_isElementContentWhitespace ( Dom t ) { + throw new DomLevel3NotImplemented(); } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - - public static Text _text_replaceWholeText ( Dom t, String content ) - { - throw new RuntimeException( "DOM Level 3 Not implemented" ); + + public static Text _text_replaceWholeText ( Dom t, String content ) { + throw new DomLevel3NotImplemented(); } ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - + public static XMLStreamReader _getXmlStreamReader ( Dom n ) { Locale l = n.locale(); @@ -3505,11 +3507,11 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return getXmlStreamReader( n ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return getXmlStreamReader( n ); } finally { l.exit(); } } } - + public static XMLStreamReader getXmlStreamReader ( Dom n ) { XMLStreamReader xs; - + switch ( n.nodeType() ) { case DOCUMENT : @@ -3524,7 +3526,7 @@ final class DomImpl c.release(); break; } - + case TEXT : case CDATA : { @@ -3535,34 +3537,34 @@ final class DomImpl if ((c = cn.tempCur()) == null) { c = n.locale().tempCur(); - - xs = Jsr173.newXmlStreamReader( c, cn._src, cn._off, cn._cch ); + + xs = Jsr173.newXmlStreamReader( c, cn.getObject(), cn._off, cn._cch ); } else { xs = Jsr173.newXmlStreamReader( c , c.getChars( cn._cch ), c._offSrc, c._cchSrc ); - + } c.release(); - + break; } - + case ENTITYREF : case ENTITY : case DOCTYPE : case NOTATION : throw new RuntimeException( "Not impl" ); - + default : throw new RuntimeException( "Unknown kind" ); } return xs; } - + ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// @@ -3613,355 +3615,6 @@ final class DomImpl ////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////// - static abstract class CharNode implements Dom, Node, CharacterData - { - public CharNode ( Locale l ) - { - assert l != null; - - _locale = l; - } - - public QName getQName ( ) - { - return null; - } - - public Locale locale ( ) - { - assert isValid(); - - return _locale == null ? ((Dom) _src).locale() : _locale; - } - - public void setChars ( Object src, int off, int cch ) - { - assert CharUtil.isValid( src, off, cch ); - assert _locale != null || _src instanceof Dom; - - if (_locale == null) - _locale = ((Dom) _src).locale(); - - _src = src; - _off = off; - _cch = cch; - } - - public Dom getDom ( ) - { - assert isValid(); - - if (_src instanceof Dom) - return (Dom) _src; - - return null; - } - - public void setDom ( Dom d ) - { - assert d != null; - - _src = d; - _locale = null; - } - - public Cur tempCur ( ) - { - assert isValid(); - - if (!(_src instanceof Dom)) - return null; - - Cur c = locale().tempCur(); - c.moveToCharNode( this ); - - return c; - } - - private boolean isValid ( ) - { - if (_src instanceof Dom) - return _locale == null; - - if (_locale == null) - return false; - - return true; - } - - public static boolean isOnList ( CharNode nodes, CharNode node ) - { - assert node != null; - - for ( CharNode cn = nodes ; cn != null ; cn = cn._next ) - if (cn == node) - return true; - - return false; - } - - public static CharNode remove ( CharNode nodes, CharNode node ) - { - assert isOnList( nodes, node ); - - if (nodes == node) - nodes = node._next; - else - node._prev._next = node._next; - - if (node._next != null) - node._next._prev = node._prev; - - node._prev = node._next = null; - - return nodes; - } - - public static CharNode insertNode ( CharNode nodes, CharNode newNode, CharNode before ) - { - assert !isOnList( nodes, newNode ); - assert before == null || isOnList( nodes, before ); - assert newNode != null; - assert newNode._prev == null && newNode._next == null; - - if (nodes == null) - { - assert before == null; - nodes = newNode; - } - else if (nodes == before) - { - nodes._prev = newNode; - newNode._next = nodes; - nodes = newNode; - } - else - { - CharNode n = nodes; - - while ( n._next != before ) - n = n._next; - - if ((newNode._next = n._next) != null) - n._next._prev = newNode; - - newNode._prev = n; - n._next = newNode; - } - - return nodes; - } - - public static CharNode appendNode ( CharNode nodes, CharNode newNode ) - { - return insertNode( nodes, newNode, null ); - } - - public static CharNode appendNodes ( CharNode nodes, CharNode newNodes ) - { - assert newNodes != null; - assert newNodes._prev == null; - - if (nodes == null) - return newNodes; - - CharNode n = nodes; - - while ( n._next != null ) - n = n._next; - - n._next = newNodes; - newNodes._prev = n; - - return nodes; - } - - public static CharNode copyNodes ( CharNode nodes, Object newSrc ) - { - CharNode newNodes = null; - - for ( CharNode n = null ; nodes != null ; nodes = nodes._next ) - { - CharNode newNode; - - if (nodes instanceof TextNode) - newNode = nodes.locale().createTextNode(); - else - newNode = nodes.locale().createCdataNode(); - - // How to deal with entity refs?? - - newNode.setChars( newSrc, nodes._off, nodes._cch ); - - if (newNodes == null) - newNodes = newNode; - - if (n != null) - { - n._next = newNode; - newNode._prev = n; - } - - n = newNode; - } - - return newNodes; - } - - public boolean nodeCanHavePrefixUri() - { - return false; - } - - public boolean isNodeAftertext() - { - assert _src instanceof Xobj : - "this method is to only be used for nodes backed up by Xobjs"; - Xobj src =(Xobj) _src; - return src._charNodesValue == null ? true : - src._charNodesAfter == null ? false : - CharNode.isOnList(src._charNodesAfter, this); - } - public void dump ( PrintStream o, Object ref ) - { - if (_src instanceof Dom) - ((Dom) _src).dump( o, ref ); - else - o.println( "Lonely CharNode: \"" + CharUtil.getString( _src, _off, _cch ) + "\"" ); - } - - public void dump ( PrintStream o ) - { - dump( o, (Object) this ); - } - - public void dump ( ) - { - dump( System.out ); - } - - public Node appendChild ( Node newChild ) { return DomImpl._node_appendChild( this, newChild ); } - public Node cloneNode ( boolean deep ) { return DomImpl._node_cloneNode( this, deep ); } - public NamedNodeMap getAttributes ( ) { return null; } - public NodeList getChildNodes ( ) { return DomImpl._emptyNodeList; } - public Node getParentNode ( ) { return DomImpl._node_getParentNode( this ); } - public Node removeChild ( Node oldChild ) { return DomImpl._node_removeChild( this, oldChild ); } - public Node getFirstChild ( ) { return null; } - public Node getLastChild ( ) { return null; } - public String getLocalName ( ) { return DomImpl._node_getLocalName( this ); } - public String getNamespaceURI ( ) { return DomImpl._node_getNamespaceURI( this ); } - public Node getNextSibling ( ) { return DomImpl._node_getNextSibling( this ); } - public String getNodeName ( ) { return DomImpl._node_getNodeName( this ); } - public short getNodeType ( ) { return DomImpl._node_getNodeType( this ); } - public String getNodeValue ( ) { return DomImpl._node_getNodeValue( this ); } - public Document getOwnerDocument ( ) { return DomImpl._node_getOwnerDocument( this ); } - public String getPrefix ( ) { return DomImpl._node_getPrefix( this ); } - public Node getPreviousSibling ( ) { return DomImpl._node_getPreviousSibling( this ); } - public boolean hasAttributes ( ) { return false; } - public boolean hasChildNodes ( ) { return false; } - public Node insertBefore ( Node newChild, Node refChild ) { return DomImpl._node_insertBefore( this, newChild, refChild ); } - public boolean isSupported ( String feature, String version ) { return DomImpl._node_isSupported( this, feature, version ); } - public void normalize ( ) { DomImpl._node_normalize( this ); } - public Node replaceChild ( Node newChild, Node oldChild ) { return DomImpl._node_replaceChild( this, newChild, oldChild ); } - public void setNodeValue ( String nodeValue ) { DomImpl._node_setNodeValue( this, nodeValue ); } - public void setPrefix ( String prefix ) { DomImpl._node_setPrefix( this, prefix ); } - - // DOM Level 3 - public Object getUserData ( String key ) { return DomImpl._node_getUserData( this, key ); } - public Object setUserData ( String key, Object data, UserDataHandler handler ) { return DomImpl._node_setUserData( this, key, data, handler ); } - public Object getFeature ( String feature, String version ) { return DomImpl._node_getFeature( this, feature, version ); } - public boolean isEqualNode ( Node arg ) { return DomImpl._node_isEqualNode( this, arg ); } - public boolean isSameNode ( Node arg ) { return DomImpl._node_isSameNode( this, arg ); } - public String lookupNamespaceURI ( String prefix ) { return DomImpl._node_lookupNamespaceURI( this, prefix ); } - public String lookupPrefix ( String namespaceURI ) { return DomImpl._node_lookupPrefix( this, namespaceURI ); } - public boolean isDefaultNamespace ( String namespaceURI ) { return DomImpl._node_isDefaultNamespace( this, namespaceURI ); } - public void setTextContent ( String textContent ) { DomImpl._node_setTextContent( this, textContent ); } - public String getTextContent ( ) { return DomImpl._node_getTextContent( this ); } - public short compareDocumentPosition ( Node other ) { return DomImpl._node_compareDocumentPosition( this, other ); } - public String getBaseURI ( ) { return DomImpl._node_getBaseURI( this ); } - - public void appendData ( String arg ) { DomImpl._characterData_appendData( this, arg ); } - public void deleteData ( int offset, int count ) { DomImpl._characterData_deleteData( this, offset, count ); } - public String getData ( ) { return DomImpl._characterData_getData( this ); } - public int getLength ( ) { return DomImpl._characterData_getLength( this ); } - public void insertData ( int offset, String arg ) { DomImpl._characterData_insertData( this, offset, arg ); } - public void replaceData ( int offset, int count, String arg ) { DomImpl._characterData_replaceData( this, offset, count, arg ); } - public void setData ( String data ) { DomImpl._characterData_setData( this, data ); } - public String substringData ( int offset, int count ) { return DomImpl._characterData_substringData( this, offset, count ); } - - private Locale _locale; - - CharNode _next; - CharNode _prev; - - private Object _src; - - int _off; - int _cch; - } - - static class TextNode extends CharNode implements Text - { - TextNode ( Locale l ) - { - super( l ); - } - - public int nodeType ( ) { return DomImpl.TEXT; } - - public String name ( ) { return "#text"; } - - public Text splitText ( int offset ) { return DomImpl._text_splitText ( this, offset ); } - public String getWholeText ( ) { return DomImpl._text_getWholeText( this ); } - public boolean isElementContentWhitespace ( ) { return DomImpl._text_isElementContentWhitespace( this ); } - public Text replaceWholeText ( String content ) { return DomImpl._text_replaceWholeText( this, content ); } - } - - static class CdataNode extends TextNode implements CDATASection - { - CdataNode ( Locale l ) - { - super( l ); - } - - public int nodeType ( ) { return DomImpl.CDATA; } - - public String name ( ) { return "#cdata-section"; } - } - - static class SaajTextNode extends TextNode implements org.apache.xmlbeans.impl.soap.Text - { - SaajTextNode ( Locale l ) - { - super( l ); - } - - public boolean isComment ( ) { return DomImpl._soapText_isComment( this ); } - - public void detachNode ( ) { DomImpl._soapNode_detachNode( this ); } - public void recycleNode ( ) { DomImpl._soapNode_recycleNode( this ); } - public String getValue ( ) { return DomImpl._soapNode_getValue( this ); } - public void setValue ( String value ) { DomImpl._soapNode_setValue( this, value ); } - public SOAPElement getParentElement ( ) { return DomImpl._soapNode_getParentElement( this ); } - public void setParentElement ( SOAPElement p ) { DomImpl._soapNode_setParentElement( this, p ); } - } - - static class SaajCdataNode extends CdataNode implements org.apache.xmlbeans.impl.soap.Text - { - public SaajCdataNode ( Locale l ) - { - super( l ); - } - - public boolean isComment ( ) { return DomImpl._soapText_isComment( this ); } - - public void detachNode ( ) { DomImpl._soapNode_detachNode( this ); } - public void recycleNode ( ) { DomImpl._soapNode_recycleNode( this ); } - public String getValue ( ) { return DomImpl._soapNode_getValue( this ); } - public void setValue ( String value ) { DomImpl._soapNode_setValue( this, value ); } - public SOAPElement getParentElement ( ) { return DomImpl._soapNode_getParentElement( this ); } - public void setParentElement ( SOAPElement p ) { DomImpl._soapNode_setParentElement( this, p ); } - } // // Soap Text Node @@ -3976,11 +3629,11 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapText_isComment( text ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapText_isComment( text ); } finally { l.exit(); } } } - + // // Soap Node // - + public static void _soapNode_detachNode ( Dom n ) { Locale l = n.locale(); @@ -3990,7 +3643,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { l._saaj.soapNode_detachNode( node ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { l._saaj.soapNode_detachNode( node ); } finally { l.exit(); } } } - + public static void _soapNode_recycleNode ( Dom n ) { Locale l = n.locale(); @@ -4000,7 +3653,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { l._saaj.soapNode_recycleNode( node ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { l._saaj.soapNode_recycleNode( node ); } finally { l.exit(); } } } - + public static String _soapNode_getValue ( Dom n ) { Locale l = n.locale(); @@ -4054,7 +3707,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { l._saaj.soapElement_removeContents( se ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { l._saaj.soapElement_removeContents( se ); } finally { l.exit(); } } } - + public static String _soapElement_getEncodingStyle ( Dom d ) { Locale l = d.locale(); @@ -4064,7 +3717,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_getEncodingStyle( se ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_getEncodingStyle( se ); } finally { l.exit(); } } } - + public static void _soapElement_setEncodingStyle ( Dom d, String encodingStyle ) { Locale l = d.locale(); @@ -4074,7 +3727,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { l._saaj.soapElement_setEncodingStyle( se, encodingStyle ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { l._saaj.soapElement_setEncodingStyle( se, encodingStyle ); } finally { l.exit(); } } } - + public static boolean _soapElement_removeNamespaceDeclaration ( Dom d, String prefix ) { Locale l = d.locale(); @@ -4084,7 +3737,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_removeNamespaceDeclaration( se, prefix ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_removeNamespaceDeclaration( se, prefix ); } finally { l.exit(); } } } - + public static Iterator _soapElement_getAllAttributes ( Dom d ) { Locale l = d.locale(); @@ -4094,7 +3747,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_getAllAttributes( se ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_getAllAttributes( se ); } finally { l.exit(); } } } - + public static Iterator _soapElement_getChildElements ( Dom d ) { Locale l = d.locale(); @@ -4104,7 +3757,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_getChildElements( se ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_getChildElements( se ); } finally { l.exit(); } } } - + public static Iterator _soapElement_getNamespacePrefixes ( Dom d ) { Locale l = d.locale(); @@ -4114,7 +3767,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_getNamespacePrefixes( se ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_getNamespacePrefixes( se ); } finally { l.exit(); } } } - + public static SOAPElement _soapElement_addAttribute ( Dom d, Name name, String value ) throws SOAPException { Locale l = d.locale(); @@ -4124,7 +3777,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_addAttribute( se, name, value ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_addAttribute( se, name, value ); } finally { l.exit(); } } } - + public static SOAPElement _soapElement_addChildElement ( Dom d, SOAPElement oldChild ) throws SOAPException { Locale l = d.locale(); @@ -4134,7 +3787,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_addChildElement( se, oldChild ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_addChildElement( se, oldChild ); } finally { l.exit(); } } } - + public static SOAPElement _soapElement_addChildElement ( Dom d, Name name ) throws SOAPException { Locale l = d.locale(); @@ -4144,7 +3797,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_addChildElement( se, name ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_addChildElement( se, name ); } finally { l.exit(); } } } - + public static SOAPElement _soapElement_addChildElement ( Dom d, String localName ) throws SOAPException { Locale l = d.locale(); @@ -4154,7 +3807,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_addChildElement( se, localName ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_addChildElement( se, localName ); } finally { l.exit(); } } } - + public static SOAPElement _soapElement_addChildElement ( Dom d, String localName, String prefix ) throws SOAPException { Locale l = d.locale(); @@ -4164,7 +3817,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_addChildElement( se, localName, prefix ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_addChildElement( se, localName, prefix ); } finally { l.exit(); } } } - + public static SOAPElement _soapElement_addChildElement ( Dom d, String localName, String prefix, String uri ) throws SOAPException { Locale l = d.locale(); @@ -4174,7 +3827,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_addChildElement( se, localName, prefix, uri ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_addChildElement( se, localName, prefix, uri ); } finally { l.exit(); } } } - + public static SOAPElement _soapElement_addNamespaceDeclaration ( Dom d, String prefix, String uri ) { Locale l = d.locale(); @@ -4184,7 +3837,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_addNamespaceDeclaration( se, prefix, uri ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_addNamespaceDeclaration( se, prefix, uri ); } finally { l.exit(); } } } - + public static SOAPElement _soapElement_addTextNode ( Dom d, String data ) { Locale l = d.locale(); @@ -4194,7 +3847,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_addTextNode( se, data ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_addTextNode( se, data ); } finally { l.exit(); } } } - + public static String _soapElement_getAttributeValue ( Dom d, Name name ) { Locale l = d.locale(); @@ -4204,7 +3857,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_getAttributeValue( se, name ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_getAttributeValue( se, name ); } finally { l.exit(); } } } - + public static Iterator _soapElement_getChildElements ( Dom d, Name name ) { Locale l = d.locale(); @@ -4214,7 +3867,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_getChildElements( se, name ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_getChildElements( se, name ); } finally { l.exit(); } } } - + public static Name _soapElement_getElementName ( Dom d ) { Locale l = d.locale(); @@ -4224,7 +3877,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_getElementName( se ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_getElementName( se ); } finally { l.exit(); } } } - + public static String _soapElement_getNamespaceURI ( Dom d, String prefix ) { Locale l = d.locale(); @@ -4234,7 +3887,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_getNamespaceURI( se, prefix ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_getNamespaceURI( se, prefix ); } finally { l.exit(); } } } - + public static Iterator _soapElement_getVisibleNamespacePrefixes ( Dom d ) { Locale l = d.locale(); @@ -4244,7 +3897,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapElement_getVisibleNamespacePrefixes( se ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapElement_getVisibleNamespacePrefixes( se ); } finally { l.exit(); } } } - + public static boolean _soapElement_removeAttribute ( Dom d, Name name ) { Locale l = d.locale(); @@ -4268,7 +3921,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapEnvelope_addBody( se ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapEnvelope_addBody( se ); } finally { l.exit(); } } } - + public static SOAPBody _soapEnvelope_getBody ( Dom d ) throws SOAPException { Locale l = d.locale(); @@ -4278,7 +3931,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapEnvelope_getBody( se ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapEnvelope_getBody( se ); } finally { l.exit(); } } } - + public static SOAPHeader _soapEnvelope_getHeader ( Dom d ) throws SOAPException { Locale l = d.locale(); @@ -4288,7 +3941,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapEnvelope_getHeader( se ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapEnvelope_getHeader( se ); } finally { l.exit(); } } } - + public static SOAPHeader _soapEnvelope_addHeader ( Dom d ) throws SOAPException { Locale l = d.locale(); @@ -4298,7 +3951,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapEnvelope_addHeader( se ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapEnvelope_addHeader( se ); } finally { l.exit(); } } } - + public static Name _soapEnvelope_createName ( Dom d, String localName ) { Locale l = d.locale(); @@ -4308,7 +3961,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapEnvelope_createName( se, localName ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapEnvelope_createName( se, localName ); } finally { l.exit(); } } } - + public static Name _soapEnvelope_createName ( Dom d, String localName, String prefix, String namespaceURI ) { Locale l = d.locale(); @@ -4382,7 +4035,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapHeader_addHeaderElement( sh, name ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapHeader_addHeaderElement( sh, name ); } finally { l.exit(); } } } - + // // Soap Body // @@ -4396,7 +4049,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapBody_hasFault( sb ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapBody_hasFault( sb ); } finally { l.exit(); } } } - + public static SOAPFault soapBody_addFault ( Dom d ) throws SOAPException { Locale l = d.locale(); @@ -4406,7 +4059,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapBody_addFault( sb ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapBody_addFault( sb ); } finally { l.exit(); } } } - + public static SOAPFault soapBody_getFault ( Dom d ) { Locale l = d.locale(); @@ -4416,7 +4069,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapBody_getFault( sb ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapBody_getFault( sb ); } finally { l.exit(); } } } - + public static SOAPBodyElement soapBody_addBodyElement ( Dom d, Name name ) { Locale l = d.locale(); @@ -4426,7 +4079,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapBody_addBodyElement( sb, name ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapBody_addBodyElement( sb, name ); } finally { l.exit(); } } } - + public static SOAPBodyElement soapBody_addDocument ( Dom d, Document document ) { Locale l = d.locale(); @@ -4436,7 +4089,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapBody_addDocument( sb, document ); } finally { l.exit(); } } else synchronized ( l ) { l.enter(); try { return l._saaj.soapBody_addDocument( sb, document ); } finally { l.exit(); } } } - + public static SOAPFault soapBody_addFault ( Dom d, Name name, String s ) throws SOAPException { Locale l = d.locale(); @@ -4446,7 +4099,7 @@ final class DomImpl if (l.noSync()) { l.enter(); try { return l._saaj.soapBody_addFault( sb, name, s ); } finally { l.exit(); } }
[... 383 lines stripped ...] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
