<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_18) on Sat Dec 04 05:26:33 UTC 2010 --> <TITLE> NamespaceContext </TITLE> <META NAME="date" CONTENT="2010-12-04"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="NamespaceContext"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> PREV CLASS <A HREF="../../../javax/xml/namespace/QName.html" title="class in javax.xml.namespace"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?javax/xml/namespace/NamespaceContext.html" target="_top"><B>FRAMES</B></A> <A HREF="NamespaceContext.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> javax.xml.namespace</FONT> <BR> Interface NamespaceContext</H2> <DL> <DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../org/apache/ws/jaxme/util/NamespaceSupport.html" title="class in org.apache.ws.jaxme.util">NamespaceSupport</A></DD> </DL> <HR> <DL> <DT><PRE>public interface <B>NamespaceContext</B></DL> </PRE> <P> <p>The <code>NamespaceContext</code> interface is a helper tool for XML parsing applications which need to know the mappings between XML namespace prefixes and namespace URI's. As such, it is closely related to the events <CODE>ContentHandler.startPrefixMapping(String,String)</CODE>, and <CODE>ContentHandler.endPrefixMapping(String)</CODE> in <CODE>ContentHandler</CODE>.</p> <p>In what follows, it is important to note, that a single prefix can only be mapped to a single namespace URI at any time. However, the converse is not true: Multiple prefixes can be mapped to the same namespace URI's.</p> <p>For example, in the case of an XML Schema parser, an instance of <code>NamespaceContext</code> might be used to resolve the namespace URI's of referenced data types, and element or attribute names, which are typically given as qualified names, including a prefix and a local name.</p> <P> <P> <DL> <DT><B>Since:</B></DT> <DD>JAXB 1.0</DD> <DT><B>Author:</B></DT> <DD>JSR-31</DD> </DL> <HR> <P> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/namespace/NamespaceContext.html#getNamespaceURI(java.lang.String)">getNamespaceURI</A></B>(java.lang.String pPrefix)</CODE> <BR> Given a prefix, returns the namespace URI associated with the prefix.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/namespace/NamespaceContext.html#getPrefix(java.lang.String)">getPrefix</A></B>(java.lang.String pNamespaceURI)</CODE> <BR> This method returns a prefix, which is currently mapped to the given namespace URI.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> java.util.Iterator</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/namespace/NamespaceContext.html#getPrefixes(java.lang.String)">getPrefixes</A></B>(java.lang.String pNamespaceURI)</CODE> <BR> This method returns a collection of prefixes, which are currently mapped to the given namespace URI.</TD> </TR> </TABLE> <P> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="getNamespaceURI(java.lang.String)"><!-- --></A><H3> getNamespaceURI</H3> <PRE> java.lang.String <B>getNamespaceURI</B>(java.lang.String pPrefix)</PRE> <DL> <DD><p>Given a prefix, returns the namespace URI associated with the prefix. More precisely, the following rules apply: <table border="1"> <tr><th>Prefix (Input)</th><th>Namespace URI (Output)</th></tr> <tr><th><A HREF="../../../javax/xml/XMLConstants.html#DEFAULT_NS_PREFIX"><CODE>XMLConstants.DEFAULT_NS_PREFIX</CODE></A> ("")</th> <td>The current default namespace URI or null, if there is no such default. (In which case the absence of a prefix indicates the absence of a namespace URI.)</td></tr> <tr><th><A HREF="../../../javax/xml/XMLConstants.html#XML_NS_PREFIX"><CODE>XMLConstants.XML_NS_PREFIX</CODE></A> ("xml")</th> <td><A HREF="../../../javax/xml/XMLConstants.html#XML_NS_URI"><CODE>XMLConstants.XML_NS_URI</CODE></A> ("http://www.w3.org/XML/1998/namespace")</td></tr> <tr><th><A HREF="../../../javax/xml/XMLConstants.html#XMLNS_ATTRIBUTE"><CODE>XMLConstants.XMLNS_ATTRIBUTE</CODE></A> ("xmlns")</th> <td><A HREF="../../../javax/xml/XMLConstants.html#XMLNS_ATTRIBUTE_NS_URI"><CODE>XMLConstants.XMLNS_ATTRIBUTE_NS_URI</CODE></A> ("http://www.w3.org/2000/xmlns/")</td> </tr> <tr><th>Any other prefix</th><td>The namespace URI currently mapped to the prefix or null, if no such mapping is established.</td></tr> </table></p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>pPrefix</CODE> - The prefix being looked up in the list of mappings. <DT><B>Returns:</B><DD>The Namespace URI to which the input prefix is currently mapped or null, if there is no such mapping. <DT><B>Throws:</B> <DD><CODE>java.lang.IllegalArgumentException</CODE> - The input prefix is null.</DL> </DD> </DL> <HR> <A NAME="getPrefix(java.lang.String)"><!-- --></A><H3> getPrefix</H3> <PRE> java.lang.String <B>getPrefix</B>(java.lang.String pNamespaceURI)</PRE> <DL> <DD><p>This method returns a prefix, which is currently mapped to the given namespace URI. Note, that multiple prefixes may be mapped to the namespace URI, in which case the returned prefix is undetermined. Do not make any assumptions on the order in such cases. It is a better choice to use <A HREF="../../../javax/xml/namespace/NamespaceContext.html#getPrefixes(java.lang.String)"><CODE>getPrefixes(String)</CODE></A> instead, if you depend on some order <table border="1"> <tr><th>Namespace URI (Input)</th><th>Prefix (Output)</th></tr> <tr><th>Current default namespace URI</th> <td><A HREF="../../../javax/xml/XMLConstants.html#DEFAULT_NS_PREFIX"><CODE>XMLConstants.DEFAULT_NS_PREFIX</CODE></A> ("")</td></tr> <tr><th><A HREF="../../../javax/xml/XMLConstants.html#XML_NS_URI"><CODE>XMLConstants.XML_NS_URI</CODE></A> ("http://www.w3.org/XML/1998/namespace")</th> <td><A HREF="../../../javax/xml/XMLConstants.html#XML_NS_PREFIX"><CODE>XMLConstants.XML_NS_PREFIX</CODE></A> ("xml")</td></tr> <tr><th><A HREF="../../../javax/xml/XMLConstants.html#XMLNS_ATTRIBUTE_NS_URI"><CODE>XMLConstants.XMLNS_ATTRIBUTE_NS_URI</CODE></A> ("http://www.w3.org/2000/xmlns/")</th> <td><A HREF="../../../javax/xml/XMLConstants.html#XMLNS_ATTRIBUTE"><CODE>XMLConstants.XMLNS_ATTRIBUTE</CODE></A></td></tr> </table></p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>pNamespaceURI</CODE> - The namespace URI being looked up in the list of mappings. <DT><B>Returns:</B><DD>A prefix currently mapped to the given namespace URI or null, if there is no such mapping <DT><B>Throws:</B> <DD><CODE>java.lang.IllegalArgumentException</CODE> - The input URI is null</DL> </DD> </DL> <HR> <A NAME="getPrefixes(java.lang.String)"><!-- --></A><H3> getPrefixes</H3> <PRE> java.util.Iterator <B>getPrefixes</B>(java.lang.String pNamespaceURI)</PRE> <DL> <DD><p>This method returns a collection of prefixes, which are currently mapped to the given namespace URI. Note, that the collection may contain more than one prefix, in which case the order is undetermined. If you do not depend on a certain order and any prefix will do, you may choose to use <A HREF="../../../javax/xml/namespace/NamespaceContext.html#getPrefix(java.lang.String)"><CODE>getPrefix(String)</CODE></A> instead. The following table describes the returned values in more details: <table border="1"> <tr><th>Namespace URI (Input)</th><th>Prefix collection (Output)</th></tr> <tr><th><A HREF="../../../javax/xml/XMLConstants.html#XML_NS_URI"><CODE>XMLConstants.XML_NS_URI</CODE></A> ("http://www.w3.org/XML/1998/namespace")</th> <td>Collection with a single element: <A HREF="../../../javax/xml/XMLConstants.html#XML_NS_PREFIX"><CODE>XMLConstants.XML_NS_PREFIX</CODE></A> ("xml")</td></tr> <tr><th><A HREF="../../../javax/xml/XMLConstants.html#XMLNS_ATTRIBUTE_NS_URI"><CODE>XMLConstants.XMLNS_ATTRIBUTE_NS_URI</CODE></A> ("http://www.w3.org/2000/xmlns/")</th> <td>Collection with a single element: <A HREF="../../../javax/xml/XMLConstants.html#XMLNS_ATTRIBUTE"><CODE>XMLConstants.XMLNS_ATTRIBUTE</CODE></A></td></tr> </table></p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>pNamespaceURI</CODE> - The namespace URI being looked up in the list of mappings or null, if there is no such mapping. <DT><B>Returns:</B><DD>An unmodifiable <CODE>Iterator</CODE>: Using it's <CODE>Iterator.remove()</CODE> method throws an <CODE>UnsupportedOperationException</CODE>. <DT><B>Throws:</B> <DD><CODE>java.lang.IllegalStateException</CODE> - The input URI is null</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> PREV CLASS <A HREF="../../../javax/xml/namespace/QName.html" title="class in javax.xml.namespace"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?javax/xml/namespace/NamespaceContext.html" target="_top"><B>FRAMES</B></A> <A HREF="NamespaceContext.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>