1999-08-28 08:19:56 +00:00
|
|
|
/*
|
1999-11-15 07:13:17 +00:00
|
|
|
* The contents of this file are subject to the Mozilla Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* The Original Code is TransforMiiX XSLT processor.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is The MITRE Corporation.
|
|
|
|
* Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation.
|
1999-08-28 08:19:56 +00:00
|
|
|
*
|
1999-11-15 07:13:17 +00:00
|
|
|
* Portions created by Keith Visco as a Non MITRE employee,
|
|
|
|
* (C) 1999 Keith Visco. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Keith Visco, kvisco@ziplink.net
|
|
|
|
* -- original author.
|
1999-08-28 08:19:56 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An XML Utility class
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef MITRE_XMLUTILS_H
|
|
|
|
#define MITRE_XMLUTILS_H
|
|
|
|
|
2005-11-02 07:36:06 +00:00
|
|
|
#include "TxString.h"
|
|
|
|
#include "baseutils.h"
|
|
|
|
|
1999-08-28 08:19:56 +00:00
|
|
|
class XMLUtils {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
static const String XMLNS;
|
|
|
|
|
|
|
|
static void getNameSpace(const String& src, String& dest);
|
|
|
|
static void getLocalPart(const String& src, String& dest);
|
|
|
|
|
1999-11-15 07:13:17 +00:00
|
|
|
|
1999-08-28 08:19:56 +00:00
|
|
|
/**
|
|
|
|
* Returns true if the given String is a valid XML QName
|
|
|
|
**/
|
|
|
|
static MBool isValidQName(String& name);
|
|
|
|
|
1999-11-15 07:13:17 +00:00
|
|
|
/**
|
|
|
|
* Returns true if the given string has only whitespace characters
|
|
|
|
**/
|
|
|
|
static MBool isWhitespace(const String& text);
|
|
|
|
|
1999-08-28 08:19:56 +00:00
|
|
|
/**
|
|
|
|
* Normalizes the value of an XML attribute
|
|
|
|
**/
|
|
|
|
static void normalizeAttributeValue(String& attValue);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Normalizes the value of a XML processingInstruction
|
|
|
|
**/
|
|
|
|
static void normalizePIValue(String& attValue);
|
|
|
|
|
|
|
|
/**
|
2005-11-02 07:34:52 +00:00
|
|
|
* Is this a whitespace string to be stripped?
|
|
|
|
* Newlines (#xD), tabs (#x9), spaces (#x20), CRs (#xA) only?
|
|
|
|
* @param data the String to test for whitespace
|
1999-08-28 08:19:56 +00:00
|
|
|
**/
|
2005-11-02 07:34:52 +00:00
|
|
|
static MBool shouldStripTextnode (const String& data);
|
1999-08-28 08:19:56 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the given character represents an Alpha letter
|
|
|
|
**/
|
2005-11-02 07:36:32 +00:00
|
|
|
static MBool isAlphaChar(PRInt32 ch);
|
1999-08-28 08:19:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the given character represents a numeric letter (digit)
|
|
|
|
**/
|
2005-11-02 07:36:32 +00:00
|
|
|
static MBool isDigit(PRInt32 ch);
|
1999-08-28 08:19:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the given character is an allowable QName character
|
|
|
|
**/
|
2005-11-02 07:36:32 +00:00
|
|
|
static MBool isQNameChar(PRInt32 ch);
|
1999-08-28 08:19:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the given character is an allowable NCName character
|
|
|
|
**/
|
2005-11-02 07:36:32 +00:00
|
|
|
static MBool isNCNameChar(PRInt32 ch);
|
1999-08-28 08:19:56 +00:00
|
|
|
|
|
|
|
}; //-- XMLUtils
|
|
|
|
#endif
|
1999-11-15 07:13:17 +00:00
|
|
|
|