KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > org > xml > sax > helpers > NamespaceSupport

org.xml.sax.helpers
Class NamespaceSupport

java.lang.Object
  extended by org.xml.sax.helpers.NamespaceSupport
See Also:
Top Examples, Source Code

public boolean declarePrefix(String prefix,
                             String uri)
See Also:
getPrefix(java.lang.String), getURI(java.lang.String), processName(java.lang.String, java.lang.String[], boolean)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Enumeration getDeclaredPrefixes()
See Also:
getURI(java.lang.String), getPrefixes(), getPrefix(java.lang.String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getPrefix(String uri)
See Also:
getURI(java.lang.String), getPrefixes(java.lang.String), getPrefixes()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Enumeration getPrefixes()
See Also:
getURI(java.lang.String), getDeclaredPrefixes()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Enumeration getPrefixes(String uri)
See Also:
getURI(java.lang.String), getDeclaredPrefixes(), getPrefix(java.lang.String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getURI(String prefix)
See Also:
getPrefixes(), getPrefix(java.lang.String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean isNamespaceDeclUris()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public NamespaceSupport()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static final String NSDECL
See Also:
isNamespaceDeclUris(), setNamespaceDeclUris(boolean)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void popContext()
See Also:
pushContext()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String[] processName(String qName,
                            String[] parts,
                            boolean isAttribute)
See Also:
String.intern(), declarePrefix(java.lang.String, java.lang.String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void pushContext()
See Also:
popContext(), ContentHandler
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void reset()
See Also:
setNamespaceDeclUris(boolean)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setNamespaceDeclUris(boolean value)
See Also:
IllegalStateException, processName(), NSDECL
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public static final String XMLNS
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1596]A simple demonstration of the effects of the namespace features for a SAX application
By Anonymous on 2005/11/04 20:23:08  Rate
import java.io.*; 
 import javax.xml.parsers.*; 
 import org.xml.sax.*; 
 import org.xml.sax.helpers.*; 
  
  
 /** 
 A simple demonstration of the effects of the namespace features for a SAX 
 application. With both features set to  < code > true < /code >  every element name 
 in the source document is echoed to the console as a triplet of the form: 
  
  
  < pre >  { URI } name  ( qName )  
  < /pre >  
  
  
 @author Will Provost 
 @version 1.0 
 */
 
  
  
 public class NamespaceTest 
     extends DefaultHandler 
  {  
     /** 
     Gets a SAX parser factory, and sets the  < b > namespaces < /b >  
     property to true, and parses the 
     file whose name is passed on the command line. 
     */
 
     public static void main  ( String [  ]  args )  
      {  
         try 
          {  
             SAXParserFactory factory = SAXParserFactory.newInstance  (  ) ; 
             try 
              {  
                 factory.setFeature 
                      ( "http://xml.org/sax/features/namespaces", true ) ; 
                 factory.setFeature 
                      ( "http://xml.org/sax/features/namespace-prefixes", true ) ; 
              }  
             catch  ( SAXException ex )  
              {  
                 ex.printStackTrace  (  ) ; 
              }  
              
             SAXParser parser = factory.newSAXParser  (  ) ; 
             if  ( args.length != 0 )  
                 parser.parse  ( new File  ( args [ 0 ]  ) , new NamespaceTest  (  )  ) ; 
          }  
         catch  ( Exception ex )  
          {  
             ex.printStackTrace  (  ) ; 
          }  
      }  
      
     /** 
     Echoes the parameters for URI, name, and qName to the console. 
     */
 
     public void startElement  
              ( String URI, String name, String qName, Attributes attributes )   
         throws SAXException  
      {  
         System.out.println  ( " { " + URI + " } " + name + "  ( " + qName + " ) " ) ; 
      }  
  }  
  
  
 

Popular Tags