jlibs.xml.sax.helpers
Class MyNamespaceSupport

java.lang.Object
  extended by org.xml.sax.helpers.NamespaceSupport
      extended by jlibs.xml.sax.helpers.MyNamespaceSupport

public class MyNamespaceSupport
extends org.xml.sax.helpers.NamespaceSupport

Author:
Santhosh Kumar T

Field Summary
 
Fields inherited from class org.xml.sax.helpers.NamespaceSupport
NSDECL, XMLNS
 
Constructor Summary
MyNamespaceSupport()
           
MyNamespaceSupport(Properties suggested)
           
 
Method Summary
 String declarePrefix(String uri)
          generated a new prefix and binds it to given uri.
 void endElement()
           
 String findPrefix(String uri)
          Return one of the prefixes mapped to a Namespace URI.
 String findURI(String prefix)
           
 Enumeration<String> getDeclaredPrefixes()
           
 Enumeration<String> getPrefixes()
           
 Enumeration<String> getPrefixes(String uri)
           
 String getSuggestPrefix()
           
 boolean isDeclaredPrefix(String prefix)
           
static void main(String[] args)
           
 void setSuggestPrefix(String suggestPrefix)
           
 void startDocument()
           
 void startElement()
           
 String startPrefixMapping(String uri)
           
 void startPrefixMapping(String prefix, String uri)
           
 void suggestPrefix(String prefix, String uri)
          This method is used to override the prefix generated by declarePrefix(String), to your own choice.
 QName toQName(String qname)
           
 String toQName(String uri, String localName)
           
 
Methods inherited from class org.xml.sax.helpers.NamespaceSupport
declarePrefix, getPrefix, getURI, isNamespaceDeclUris, popContext, processName, pushContext, reset, setNamespaceDeclUris
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MyNamespaceSupport

public MyNamespaceSupport()

MyNamespaceSupport

public MyNamespaceSupport(Properties suggested)
Method Detail

suggestPrefix

public void suggestPrefix(String prefix,
                          String uri)
This method is used to override the prefix generated by declarePrefix(String), to your own choice.

if the suggested prefix already exists, then it will generate new prefix, from suggested prefix by appending a number


findPrefix

public String findPrefix(String uri)
Return one of the prefixes mapped to a Namespace URI.

If more than one prefix is currently mapped to the same URI, this method will make an arbitrary selection;

Unlike NamespaceSupport.getPrefix(String) this method, this returns empty prefix if the given uri is bound to default prefix.


findURI

public String findURI(String prefix)

getSuggestPrefix

public String getSuggestPrefix()

setSuggestPrefix

public void setSuggestPrefix(String suggestPrefix)

declarePrefix

public String declarePrefix(String uri)
generated a new prefix and binds it to given uri.

you can customize the generated prefix using suggestPrefix(String, String)


getPrefixes

public Enumeration<String> getPrefixes(String uri)
Overrides:
getPrefixes in class org.xml.sax.helpers.NamespaceSupport

getPrefixes

public Enumeration<String> getPrefixes()
Overrides:
getPrefixes in class org.xml.sax.helpers.NamespaceSupport

getDeclaredPrefixes

public Enumeration<String> getDeclaredPrefixes()
Overrides:
getDeclaredPrefixes in class org.xml.sax.helpers.NamespaceSupport

isDeclaredPrefix

public boolean isDeclaredPrefix(String prefix)

toQName

public QName toQName(String qname)

toQName

public String toQName(String uri,
                      String localName)

startDocument

public void startDocument()

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)

startPrefixMapping

public String startPrefixMapping(String uri)

startElement

public void startElement()

endElement

public void endElement()

main

public static void main(String[] args)


Copyright © 2015. All rights reserved.