You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by di...@apache.org on 2001/08/13 19:18:11 UTC

cvs commit: jakarta-slide/src/share/org/apache/slide/util/conf Populate.java

dirkv       01/08/13 10:18:11

  Modified:    src/share/org/apache/slide/util/conf Populate.java
  Log:
  replace deprecated interface with new one
  
  Revision  Changes    Path
  1.2       +22 -13    jakarta-slide/src/share/org/apache/slide/util/conf/Populate.java
  
  Index: Populate.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/util/conf/Populate.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Populate.java	2000/07/14 16:44:52	1.1
  +++ Populate.java	2001/08/13 17:18:11	1.2
  @@ -16,15 +16,15 @@
    * @author <a href="mailto:scoobie@betaverion.org">Federico Barbieri</a>
    * @author <a href="mailto:arkin@exoffice.com>">Assaf Arkin</a>
    */
  -public class Populate implements DocumentHandler, ErrorHandler {
  +public class Populate implements ContentHandler, ErrorHandler {
       
       private Element    _root;
       private Element    _current;
       private Locator     _locator;
   
  -    public Element load(InputSource is, Parser parser)
  +    public Element load(InputSource is, XMLReader parser)
       throws SAXException, IOException, ConfigurationException {
  -        parser.setDocumentHandler(this);
  +        parser.setContentHandler(this);
           parser.parse(is);
           return _root;
       }
  @@ -57,25 +57,26 @@
       }
       
       
  -    public void startElement( String name, AttributeList attr ) {
  +    public void startElement(String namespaceURI,String localName,
  +                             String rawName, Attributes attr ) {
           int     i;
           Element parent;
           
           // If this is the root element, create the first element, else
           // create a child for the current element and process it.
           if ( _current == null ) {
  -            _current = new Element( name, null );
  +            _current = new Element( localName, null );
               _root = _current;
           } else {
               parent = _current;
  -            _current = new Element( name, parent );
  +            _current = new Element( localName, parent );
               parent.addChild( _current );
           }
           // Set the element's name and the attributes one by one, so the
           // object tree will be a reflection of the XML document.
  -        _current.setName( name );
  +        _current.setName( localName );
           for ( i = 0 ; i < attr.getLength() ; ++i )
  -            _current.setAttribute( attr.getName( i ), attr.getValue( i ) );
  +            _current.setAttribute( attr.getLocalName( i ), attr.getValue( i ) );
       }
       
       
  @@ -83,17 +84,17 @@
        * Closing the element. This is the place to check special conditions about the
        * element content. If not, just make the parent element the current element.
        */
  -    public void endElement( String name )
  +    public void endElement(String namespaceURI,String localName,String rawName)
       throws SAXParseException {
           // Attempt to close an element when the root element has already been
           // closed. Should never happen.
           if ( _current == null )
  -            throw new SAXParseException( "Attempt to close the element " + name +
  +            throw new SAXParseException( "Attempt to close the element " + localName +
                   " when root element is already closed.", _locator );
           // Attempt to close one element when a different element is open and
           // waiting to be closed. Should never happen.
  -        if ( ! _current.getName().equals( name ) )
  -            throw new SAXParseException( "Attempt to close the element " + name +
  +        if ( ! _current.getName().equals( localName ) )
  +            throw new SAXParseException( "Attempt to close the element " + localName +
                   " when the element " + _current.getName() + " should be closed.", _locator );
           // All we have to do is go back to the parent.
           _current = _current.getParent();
  @@ -140,7 +141,15 @@
       public void processingInstruction( String target, String pi ) {
       }
       
  -    
  +    public void startPrefixMapping(java.lang.String prefix, java.lang.String uri) throws SAXException {
  +    }
  +	
  +	public void endPrefixMapping(java.lang.String prefix) throws SAXException {
  +	}
  +	
  +	public void skippedEntity(String name) throws SAXException {
  +	}
  +	
       /**
        * We can store the locate just to know where an error occurs.
        */