You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2002/04/02 08:11:31 UTC

cvs commit: xml-xalan/c/src/XPath XalanQName.cpp XalanQName.hpp

dbertoni    02/04/01 22:11:31

  Modified:    c/src/XPath XalanQName.cpp XalanQName.hpp
  Log:
  New static validation functions.
  
  Revision  Changes    Path
  1.4       +32 -0     xml-xalan/c/src/XPath/XalanQName.cpp
  
  Index: XalanQName.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XalanQName.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XalanQName.cpp	19 Dec 2001 22:02:02 -0000	1.3
  +++ XalanQName.cpp	2 Apr 2002 06:11:31 -0000	1.4
  @@ -277,3 +277,35 @@
   		return true;
   	}
   }
  +
  +
  +
  +bool
  +XalanQName::isValidQName(const XalanDOMString&	theQName)
  +{
  +	return isValidQName(c_wstr(theQName), length(theQName));
  +}
  +
  +
  +
  +bool
  +XalanQName::isValidQName(
  +			const XalanDOMChar*			theQName,
  +			XalanDOMString::size_type	theLength)
  +{
  +	const XalanDOMString::size_type		theIndex =
  +		indexOf(theQName, XalanUnicode::charColon);
  +
  +	if (theIndex == theLength)
  +	{
  +		return isValidNCName(theQName, theLength);
  +	}
  +	else
  +	{
  +		const XalanDOMChar* const	thePrefix = c_wstr(theQName);
  +		const XalanDOMChar*	const	theLocalName = thePrefix + theIndex + 1;
  +
  +		return XalanQName::isValidNCName(thePrefix, theIndex) &&
  +			   XalanQName::isValidNCName(theLocalName, theLength - theIndex - 1);
  +	}
  +}
  
  
  
  1.3       +40 -0     xml-xalan/c/src/XPath/XalanQName.hpp
  
  Index: XalanQName.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XalanQName.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XalanQName.hpp	19 Dec 2001 22:02:02 -0000	1.2
  +++ XalanQName.hpp	2 Apr 2002 06:11:31 -0000	1.3
  @@ -236,12 +236,52 @@
   			const XalanDOMString&		uri,
   			bool						reverse = true);
   
  +	/**
  +	 * Determine if the string supplied satisfies the grammar for
  +	 * an XML NCName.
  +	 *
  +	 * @param theNCName The string to check
  +	 * @return bool true if the string is a valid NCName, false if not.
  +	 */
   	static bool
   	isValidNCName(const XalanDOMString&		theNCName);
   
  +	/**
  +	 * Determine if the string supplied satisfies the grammar for
  +	 * an XML NCName.
  +	 *
  +	 * @param theNCName The string to check
  +	 * @param theLength The length of the string
  +	 * @return bool true if the string is a valid NCName, false if not
  +	 */
   	static bool
   	isValidNCName(
   			const XalanDOMChar*			theNCName,
  +			XalanDOMString::size_type	theLength = XalanDOMString::npos);
  +
  +	/**
  +	 * Determine if the string supplied satisfies the grammar for
  +	 * an XML QName.  Note that this function does not determine
  +	 * if any supplied prefix is bound to a namespace URI
  +	 *
  +	 * @param theQName The string to check
  +	 * @return bool true if the string is a valid QName, false if not
  +	 */
  +	static bool
  +	isValidQName(const XalanDOMString&	theQName);
  +
  +	/**
  +	 * Determine if the string supplied satisfies the grammar for
  +	 * an XML QName.  Note that this function does not determine
  +	 * if any supplied prefix is bound to a namespace URI
  +	 *
  +	 * @param theQName The string to check
  +	 * @param theLength The length of the string
  +	 * @return bool true if the string is a valid QName, false if not
  +	 */
  +	static bool
  +	isValidQName(
  +			const XalanDOMChar*			theQName,
   			XalanDOMString::size_type	theLength = XalanDOMString::npos);
   
   protected:
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org