From: Wolfgang M. M. <wol...@us...> - 2004-08-04 19:00:21
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/dom In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18983/src/org/exist/dom Modified Files: QName.java Log Message: Default element namespace has been (wrongly) applied to variable names. Index: QName.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/dom/QName.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** QName.java 8 Jun 2004 08:16:07 -0000 1.14 --- QName.java 4 Aug 2004 19:00:08 -0000 1.15 *************** *** 204,211 **** * @param context * @param qname ! * @return * @exception IllegalArgumentException if no namespace URI is mapped to the prefix */ ! public static QName parse(XQueryContext context, String qname) throws XPathException { String prefix = extractPrefix(qname); --- 204,211 ---- * @param context * @param qname ! * @return defaultNS the default namespace to use if no namespace prefix is present. * @exception IllegalArgumentException if no namespace URI is mapped to the prefix */ ! public static QName parse(XQueryContext context, String qname, String defaultNS) throws XPathException { String prefix = extractPrefix(qname); *************** *** 216,254 **** throw new XPathException("No namespace defined for prefix " + prefix); } else ! namespaceURI = context.getURIForPrefix(""); ! if (namespaceURI == null) ! namespaceURI = ""; ! return new QName(extractLocalName(qname), namespaceURI, prefix); ! } ! ! public static QName parseAttribute(XQueryContext context, String qname) ! throws XPathException { ! String prefix = extractPrefix(qname); ! String namespaceURI = null; ! if (prefix != null) { ! namespaceURI = context.getURIForPrefix(prefix); ! if (namespaceURI == null) ! throw new XPathException("No namespace defined for prefix " + prefix); ! } if (namespaceURI == null) namespaceURI = ""; return new QName(extractLocalName(qname), namespaceURI, prefix); } ! ! public static QName parseFunction(XQueryContext context, String qname) throws XPathException { ! String prefix = extractPrefix(qname); ! String namespaceURI; ! if (prefix != null) { ! namespaceURI = context.getURIForPrefix(prefix); ! if (namespaceURI == null) ! throw new XPathException("No namespace defined for prefix " + prefix); ! } else ! namespaceURI = context.getDefaultFunctionNamespace(); ! if (namespaceURI == null) ! namespaceURI = ""; ! return new QName(extractLocalName(qname), namespaceURI, prefix); } ! public final static boolean isQName(String name) { int colon = name.indexOf(':'); --- 216,241 ---- throw new XPathException("No namespace defined for prefix " + prefix); } else ! namespaceURI = defaultNS; if (namespaceURI == null) namespaceURI = ""; return new QName(extractLocalName(qname), namespaceURI, prefix); } ! ! /** ! * Parses the given string into a QName. The method uses context to look up ! * a namespace URI for an existing prefix. ! * ! * This method uses the default element namespace for qnames without prefix. ! * ! * @param context ! * @param qname ! * @return ! * @exception IllegalArgumentException if no namespace URI is mapped to the prefix ! */ ! public static QName parse(XQueryContext context, String qname) throws XPathException { ! return parse(context, qname, context.getURIForPrefix("")); } ! public final static boolean isQName(String name) { int colon = name.indexOf(':'); |