当前位置: 首页>>代码示例>>Java>>正文


Java XMLString.toString方法代码示例

本文整理汇总了Java中org.apache.xerces.xni.XMLString.toString方法的典型用法代码示例。如果您正苦于以下问题:Java XMLString.toString方法的具体用法?Java XMLString.toString怎么用?Java XMLString.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.xerces.xni.XMLString的用法示例。


在下文中一共展示了XMLString.toString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: attributeDecl

import org.apache.xerces.xni.XMLString; //导入方法依赖的package包/类
/**
 * An attribute declaration.
 *
 * @param elementName   The name of the element that this attribute
 *                      is associated with.
 * @param attributeName The name of the attribute.
 * @param type          The attribute type. This value will be one of
 *                      the following: "CDATA", "ENTITY", "ENTITIES",
 *                      "ENUMERATION", "ID", "IDREF", "IDREFS",
 *                      "NMTOKEN", "NMTOKENS", or "NOTATION".
 * @param enumeration   If the type has the value "ENUMERATION" or
 *                      "NOTATION", this array holds the allowed attribute
 *                      values; otherwise, this array is null.
 * @param defaultType   The attribute default type. This value will be
 *                      one of the following: "#FIXED", "#IMPLIED",
 *                      "#REQUIRED", or null.
 * @param defaultValue  The attribute default value, or null if no
 *                      default value is specified.
 *
 * @param nonNormalizedDefaultValue  The attribute default value with no normalization 
 *                      performed, or null if no default value is specified.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void attributeDecl(String elementName, String attributeName,
                          String type, String[] enumeration,
                          String defaultType, XMLString defaultValue,
                          XMLString nonNormalizedDefaultValue, Augmentations augs) throws XNIException {

    try {
        // SAX2 extension
        if (fDeclHandler != null) {
            // used as a key to detect duplicate attribute definitions.
            String elemAttr = new StringBuffer(elementName).append("<").append(attributeName).toString();
            if(fDeclaredAttrs.get(elemAttr) != null) {
                // we aren't permitted to return duplicate attribute definitions
                return;
            }
            fDeclaredAttrs.put(elemAttr, Boolean.TRUE);
            if (type.equals("NOTATION") || 
                type.equals("ENUMERATION")) {

                StringBuffer str = new StringBuffer();
                if (type.equals("NOTATION")) {
                  str.append(type);
                  str.append(" (");
                }
                else {
                  str.append("(");
                }
                for (int i = 0; i < enumeration.length; i++) {
                    str.append(enumeration[i]);
                    if (i < enumeration.length - 1) {
                        str.append('|');
                    }
                }
                str.append(')');
                type = str.toString();
            }
            String value = (defaultValue==null) ? null : defaultValue.toString();
            fDeclHandler.attributeDecl(elementName, attributeName,
                                       type, defaultType, value);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
开发者ID:BowlerHatLLC,项目名称:feathers-sdk,代码行数:72,代码来源:AbstractSAXParserMMImpl.java

示例2: attributeDecl

import org.apache.xerces.xni.XMLString; //导入方法依赖的package包/类
/**
 * An attribute declaration.
 *
 * @param elementName   The name of the element that this attribute
 *                      is associated with.
 * @param attributeName The name of the attribute.
 * @param type          The attribute type. This value will be one of
 *                      the following: "CDATA", "ENTITY", "ENTITIES",
 *                      "ENUMERATION", "ID", "IDREF", "IDREFS",
 *                      "NMTOKEN", "NMTOKENS", or "NOTATION".
 * @param enumeration   If the type has the value "ENUMERATION" or
 *                      "NOTATION", this array holds the allowed attribute
 *                      values; otherwise, this array is null.
 * @param defaultType   The attribute default type. This value will be
 *                      one of the following: "#FIXED", "#IMPLIED",
 *                      "#REQUIRED", or null.
 * @param defaultValue  The attribute default value, or null if no
 *                      default value is specified.
 *
 * @param nonNormalizedDefaultValue  The attribute default value with no normalization 
 *                      performed, or null if no default value is specified.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void attributeDecl(String elementName, String attributeName,
                          String type, String[] enumeration,
                          String defaultType, XMLString defaultValue,
                          XMLString nonNormalizedDefaultValue, Augmentations augs) throws XNIException {

    try {
        // SAX2 extension
        if (fDeclHandler != null) {
            // used as a key to detect duplicate attribute definitions.
            String elemAttr = new StringBuffer(elementName).append('<').append(attributeName).toString();
            if(fDeclaredAttrs.get(elemAttr) != null) {
                // we aren't permitted to return duplicate attribute definitions
                return;
            }
            fDeclaredAttrs.put(elemAttr, Boolean.TRUE);
            if (type.equals("NOTATION") || 
                type.equals("ENUMERATION")) {

                StringBuffer str = new StringBuffer();
                if (type.equals("NOTATION")) {
                  str.append(type);
                  str.append(" (");
                }
                else {
                  str.append('(');
                }
                for (int i = 0; i < enumeration.length; i++) {
                    str.append(enumeration[i]);
                    if (i < enumeration.length - 1) {
                        str.append('|');
                    }
                }
                str.append(')');
                type = str.toString();
            }
            String value = (defaultValue==null) ? null : defaultValue.toString();
            fDeclHandler.attributeDecl(elementName, attributeName,
                                       type, defaultType, value);
        }
    }
    catch (SAXException e) {
        throw new XNIException(e);
    }

}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:72,代码来源:AbstractSAXParser.java

示例3: scanExternalID

import org.apache.xerces.xni.XMLString; //导入方法依赖的package包/类
/**
 * Scans External ID and return the public and system IDs.
 *
 * @param identifiers An array of size 2 to return the system id,
 *                    and public id (in that order).
 * @param optionalSystemId Specifies whether the system id is optional.
 *
 * <strong>Note:</strong> This method uses fString and fStringBuffer,
 * anything in them at the time of calling is lost.
 */
protected void scanExternalID(String[] identifiers,
                              boolean optionalSystemId)
    throws IOException, XNIException {

    String systemId = null;
    String publicId = null;
    if (fEntityScanner.skipString("PUBLIC")) {
        if (!fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterPUBLIC", null);
        }
        scanPubidLiteral(fString);
        publicId = fString.toString();

        if (!fEntityScanner.skipSpaces() && !optionalSystemId) {
            reportFatalError("SpaceRequiredBetweenPublicAndSystem", null);
        }
    }

    if (publicId != null || fEntityScanner.skipString("SYSTEM")) {
        if (publicId == null && !fEntityScanner.skipSpaces()) {
            reportFatalError("SpaceRequiredAfterSYSTEM", null);
        }
        int quote = fEntityScanner.peekChar();
        if (quote != '\'' && quote != '"') {
            if (publicId != null && optionalSystemId) {
                // looks like we don't have any system id
                // simply return the public id
                identifiers[0] = null;
                identifiers[1] = publicId;
                return;
            }
            reportFatalError("QuoteRequiredInSystemID", null);
        }
        fEntityScanner.scanChar();
        XMLString ident = fString;
        if (fEntityScanner.scanLiteral(quote, ident) != quote) {
            fStringBuffer.clear();
            do {
                fStringBuffer.append(ident);
                int c = fEntityScanner.peekChar();
                if (XMLChar.isMarkup(c) || c == ']') {
                    fStringBuffer.append((char)fEntityScanner.scanChar());
                }
                else if (XMLChar.isHighSurrogate(c)) {
                    scanSurrogates(fStringBuffer);
                }
                else if (isInvalidLiteral(c)) {
                    reportFatalError("InvalidCharInSystemID",
                            new Object[] { Integer.toHexString(c) }); 
                    fEntityScanner.scanChar();
                }
            } while (fEntityScanner.scanLiteral(quote, ident) != quote);
            fStringBuffer.append(ident);
            ident = fStringBuffer;
        }
        systemId = ident.toString();
        if (!fEntityScanner.skipChar(quote)) {
            reportFatalError("SystemIDUnterminated", null);
        }
    }

    // store result in array
    identifiers[0] = systemId;
    identifiers[1] = publicId;
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:76,代码来源:XMLScanner.java

示例4: scanExternalID

import org.apache.xerces.xni.XMLString; //导入方法依赖的package包/类
protected void scanExternalID(String[] identifiers, boolean optionalSystemId) throws IOException,
		TmxEndEntityException, RepairableException {

	String systemId = null;
	String publicId = null;
	if (entityScanner.skipString("PUBLIC")) {
		if (!entityScanner.skipSpaces()) {
			newRepairableException("SpaceRequiredAfterPUBLIC");
		}
		scanPubidLiteral(fString);
		publicId = fString.toString();

		if (!entityScanner.skipSpaces() && !optionalSystemId) {
			newRepairableException("SpaceRequiredBetweenPublicAndSystem");
		}
	}

	if (publicId != null || entityScanner.skipString("SYSTEM")) {
		if (publicId == null && !entityScanner.skipSpaces()) {
			newRepairableException("SpaceRequiredAfterSYSTEM");
		}
		int quote = entityScanner.peekChar();
		if (quote != '\'' && quote != '"') {
			if (publicId != null && optionalSystemId) {
				// looks like we don't have any system id
				// simply return the public id
				identifiers[0] = null;
				identifiers[1] = publicId;
				return;
			}
			newRepairableException("QuoteRequiredInSystemID");
		}
		entityScanner.scanChar();
		XMLString ident = fString;
		if (entityScanner.scanLiteral(quote, ident) != quote) {
			fStringBuffer.clear();
			do {
				fStringBuffer.append(ident);
				int c = entityScanner.peekChar();
				if (XMLChar.isMarkup(c) || c == ']') {
					fStringBuffer.append((char) entityScanner.scanChar());
				} else if (XMLChar.isHighSurrogate(c)) {
					scanSurrogates(fStringBuffer);
				} else if (XMLChar.isInvalid(c)) {
					newRepairableException("InvalidCharInSystemID");
					entityScanner.scanChar();
				}
			} while (entityScanner.scanLiteral(quote, ident) != quote);
			fStringBuffer.append(ident);
			ident = fStringBuffer;
		}
		systemId = ident.toString();
		if (!entityScanner.skipChar((char) quote)) {
			newRepairableException("SystemIDUnterminated");
		}
	}

	// store result in array
	identifiers[0] = systemId;
	identifiers[1] = publicId;
}
 
开发者ID:heartsome,项目名称:tmxeditor8,代码行数:62,代码来源:TmxScanner2.java


注:本文中的org.apache.xerces.xni.XMLString.toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。