xml-xmlbeans-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eric...@apache.org
Subject cvs commit: xml-xmlbeans/v2/test/src/erictest EricTest.java
Date Tue, 16 Mar 2004 21:57:42 GMT
ericvas     2004/03/16 13:57:42

  Modified:    v2/src/newstore2/org/apache/xmlbeans/impl/newstore2 Cur.java
                        Cursor.java DomImpl.java
               v2/src/typeimpl/org/apache/xmlbeans/impl/values
                        XmlObjectBase.java
               v2/src/xmlpublic/org/apache/xmlbeans XmlTokenSource.java
               v2/src/xmlstore/org/apache/xmlbeans/impl/store Cursor.java
               v2/test/src/erictest EricTest.java
  Log:
  getDomNode implemented on XmlTokenSource
  
  Revision  Changes    Path
  1.23      +16 -14    xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Cur.java
  
  Index: Cur.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Cur.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- Cur.java	16 Mar 2004 19:35:42 -0000	1.22
  +++ Cur.java	16 Mar 2004 21:57:42 -0000	1.23
  @@ -122,10 +122,10 @@
           return isRoot() && _xobj instanceof DocumentFragXobj;
       }
   
  -    boolean isNonDomRoot ( )
  -    {
  -        return isRoot() && _xobj instanceof RootXobj;
  -    }
  +//    boolean isNonDomRoot ( )
  +//    {
  +//        return isRoot() && _xobj instanceof RootXobj;
  +//    }
   
       private int cchRight ( )
       {
  @@ -147,7 +147,8 @@
       
       void createRoot ( )
       {
  -        set( new RootXobj( _locale ), 0 );
  +        createDomDocFragRoot();
  +//        set( new RootXobj( _locale ), 0 );
       }
       
       void createDomDocFragRoot ( )
  @@ -1740,7 +1741,8 @@
           final Xobj ensureParent ( )
           {
               assert _parent != null || (!isRoot() && cchAfter() == 0);
  -            return _parent == null ? new RootXobj( _locale ).appendXobj( this ) : _parent;
  +            return _parent == null ? new DocumentFragXobj( _locale ).appendXobj( this )
: _parent;
  +//            return _parent == null ? new RootXobj( _locale ).appendXobj( this ) : _parent;
           }
   
           final int cchRight ( int p )
  @@ -1923,14 +1925,14 @@
           CharNode _charNodesAfter;
       }
   
  -    private static class RootXobj extends Xobj
  -    {
  -        RootXobj ( Locale l ) { super( l, ROOT, 0 ); }
  -        
  -        Dom getDom ( ) { throw new IllegalStateException(); }
  -        
  -        Xobj newNode ( ) { return new RootXobj( _locale ); }
  -    }
  +//    private static class RootXobj extends Xobj
  +//    {
  +//        RootXobj ( Locale l ) { super( l, ROOT, 0 ); }
  +//        
  +//        Dom getDom ( ) { throw new IllegalStateException(); }
  +//        
  +//        Xobj newNode ( ) { return new RootXobj( _locale ); }
  +//    }
   
       private abstract static class NodeXobj extends Xobj implements Dom, Node, NodeList
       {
  
  
  
  1.11      +6 -0      xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Cursor.java
  
  Index: Cursor.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/Cursor.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Cursor.java	16 Mar 2004 19:35:42 -0000	1.10
  +++ Cursor.java	16 Mar 2004 21:57:42 -0000	1.11
  @@ -483,6 +483,11 @@
           throw new RuntimeException( "Not implemented" );
       }
       
  +    public Node _getDomNode ( )
  +    {
  +        return (Node) _cur.getDom();
  +    }
  +    
       public void _save ( ContentHandler ch, LexicalHandler lh, XmlOptions options ) throws
SAXException
       {
           throw new RuntimeException( "Not implemented" );
  @@ -1045,6 +1050,7 @@
       public InputStream newInputStream ( ) { if (_locale.noSync()) { _locale.enter(); try
{ return _newInputStream(); } finally { _locale.exit(); } } else synchronized ( _locale )
{ _locale.enter(); try { return _newInputStream(); } finally { _locale.exit(); } } }
       public Reader newReader ( ) { if (_locale.noSync()) { _locale.enter(); try { return
_newReader(); } finally { _locale.exit(); } } else synchronized ( _locale ) { _locale.enter();
try { return _newReader(); } finally { _locale.exit(); } } }
       public Node newDomNode ( ) { if (_locale.noSync()) { _locale.enter(); try { return
_newDomNode(); } finally { _locale.exit(); } } else synchronized ( _locale ) { _locale.enter();
try { return _newDomNode(); } finally { _locale.exit(); } } }
  +    public Node getDomNode ( ) { if (_locale.noSync()) { _locale.enter(); try { return
_getDomNode(); } finally { _locale.exit(); } } else synchronized ( _locale ) { _locale.enter();
try { return _newDomNode(); } finally { _locale.exit(); } } }
       public void save ( ContentHandler ch, LexicalHandler lh ) throws SAXException { if
(_locale.noSync()) { _locale.enter(); try { _save( ch, lh ); } finally { _locale.exit(); }
} else synchronized ( _locale ) { _locale.enter(); try { _save( ch, lh ); } finally { _locale.exit();
} } }
       public void save ( File file ) throws IOException { if (_locale.noSync()) { _locale.enter();
try { _save( file ); } finally { _locale.exit(); } } else synchronized ( _locale ) { _locale.enter();
try { _save( file ); } finally { _locale.exit(); } } }
       public void save ( OutputStream os ) throws IOException { if (_locale.noSync()) { _locale.enter();
try { _save( os ); } finally { _locale.exit(); } } else synchronized ( _locale ) { _locale.enter();
try { _save( os ); } finally { _locale.exit(); } } }
  
  
  
  1.24      +44 -44    xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/DomImpl.java
  
  Index: DomImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/newstore2/org/apache/xmlbeans/impl/newstore2/DomImpl.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- DomImpl.java	16 Mar 2004 19:35:42 -0000	1.23
  +++ DomImpl.java	16 Mar 2004 21:57:42 -0000	1.24
  @@ -1184,50 +1184,50 @@
           // into a DOM fragment.
           //
   
  -        if (c != null && c.isNonDomRoot())
  -        {
  -            c.next();
  -            
  -            assert c.kind() > 0;
  -
  -            if (c.isText())
  -                c.next();
  -            else
  -            {
  -                c.toEnd();
  -                c.next();
  -            }
  -            
  -            if (c.isFinish())
  -            {
  -                c.release();
  -                c = null;
  -            }
  -            else
  -            {
  -                Cur frag = n.locale().tempCur();
  -                
  -                frag.createDomDocFragRoot();
  -
  -                frag.next();
  -
  -                c.toParent();
  -                c.next();
  -
  -                while ( !c.isFinish() )
  -                {
  -                    if (c.isText())
  -                        c.moveChars( frag, -1 );
  -                    else
  -                        c.moveNode( frag );
  -                }
  -
  -                c.moveToCur( frag );
  -                c.toParent();
  -
  -                frag.release();
  -            }
  -        }
  +//        if (c != null && c.isNonDomRoot())
  +//        {
  +//            c.next();
  +//            
  +//            assert c.kind() > 0;
  +//
  +//            if (c.isText())
  +//                c.next();
  +//            else
  +//            {
  +//                c.toEnd();
  +//                c.next();
  +//            }
  +//            
  +//            if (c.isFinish())
  +//            {
  +//                c.release();
  +//                c = null;
  +//            }
  +//            else
  +//            {
  +//                Cur frag = n.locale().tempCur();
  +//                
  +//                frag.createDomDocFragRoot();
  +//
  +//                frag.next();
  +//
  +//                c.toParent();
  +//                c.next();
  +//
  +//                while ( !c.isFinish() )
  +//                {
  +//                    if (c.isText())
  +//                        c.moveChars( frag, -1 );
  +//                    else
  +//                        c.moveNode( frag );
  +//                }
  +//
  +//                c.moveToCur( frag );
  +//                c.toParent();
  +//
  +//                frag.release();
  +//            }
  +//        }
   
           if (c == null)
               return null;
  
  
  
  1.7       +3 -0      xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java
  
  Index: XmlObjectBase.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/typeimpl/org/apache/xmlbeans/impl/values/XmlObjectBase.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XmlObjectBase.java	12 Feb 2004 20:06:22 -0000	1.6
  +++ XmlObjectBase.java	16 Mar 2004 21:57:42 -0000	1.7
  @@ -155,6 +155,9 @@
       public Reader newReader(XmlOptions options)
           { XmlCursor cur = newCursorForce(); try { return cur.newReader(makeInnerOptions(options));
} finally { cur.dispose(); } }
   
  +    public Node getDomNode()
  +        { XmlCursor cur = newCursorForce(); try { return cur.getDomNode(); } finally {
cur.dispose(); } }
  +
       public Node newDomNode()
           { return newDomNode(null); }
   
  
  
  
  1.7       +8 -8      xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/XmlTokenSource.java
  
  Index: XmlTokenSource.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/xmlpublic/org/apache/xmlbeans/XmlTokenSource.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XmlTokenSource.java	25 Feb 2004 18:56:50 -0000	1.6
  +++ XmlTokenSource.java	16 Mar 2004 21:57:42 -0000	1.7
  @@ -160,14 +160,14 @@
        */
       Node newDomNode();
   
  -//    /**
  -//     * Returns a W3C DOM Node containing the XML represented by this source.
  -//     * This is a live DOM node, not a copy.  Any changes made through this node
  -//     * are immediately reflected in the document associated with this token
  -//     * source.  Depending on the kind of token this XmlTokenSource represents,
  -//     * an appropriate node will be returned.
  -//     */
  -//    Node getDomNode();
  +    /**
  +     * Returns a W3C DOM Node containing the XML represented by this source.
  +     * This is a live DOM node, not a copy.  Any changes made through this node
  +     * are immediately reflected in the document associated with this token
  +     * source.  Depending on the kind of token this XmlTokenSource represents,
  +     * an appropriate node will be returned.
  +     */
  +    Node getDomNode();
   
       /**
        * Writes the XML represented by this source to the given SAX content and
  
  
  
  1.11      +5 -0      xml-xmlbeans/v2/src/xmlstore/org/apache/xmlbeans/impl/store/Cursor.java
  
  Index: Cursor.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/src/xmlstore/org/apache/xmlbeans/impl/store/Cursor.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Cursor.java	3 Mar 2004 22:56:39 -0000	1.10
  +++ Cursor.java	16 Mar 2004 21:57:42 -0000	1.11
  @@ -3013,6 +3013,11 @@
           return newDomNode( null );
       }
   
  +    public Node getDomNode ( )
  +    {
  +        throw new IllegalStateException( "Live DOM nodes not supported in XmlBeans V1"
);
  +    }
  +
       public Node newDomNode ( XmlOptions options )
       {
           try
  
  
  
  1.38      +2 -0      xml-xmlbeans/v2/test/src/erictest/EricTest.java
  
  Index: EricTest.java
  ===================================================================
  RCS file: /home/cvs/xml-xmlbeans/v2/test/src/erictest/EricTest.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- EricTest.java	16 Mar 2004 19:35:43 -0000	1.37
  +++ EricTest.java	16 Mar 2004 21:57:42 -0000	1.38
  @@ -118,6 +118,8 @@
   
           c.toStartDoc();
   
  +        System.out.println( Public2.save( c.getDomNode() ) );
  +
           System.out.println( "\"" + Public2.save( c, pp ) + "\"" );
       }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xmlbeans-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-cvs-help@xml.apache.org


Mime
View raw message