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


Java XMLSymbols类代码示例

本文整理汇总了Java中com.sun.org.apache.xerces.internal.util.XMLSymbols的典型用法代码示例。如果您正苦于以下问题:Java XMLSymbols类的具体用法?Java XMLSymbols怎么用?Java XMLSymbols使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XMLSymbols类属于com.sun.org.apache.xerces.internal.util包,在下文中一共展示了XMLSymbols类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addNamespaceDecl

import com.sun.org.apache.xerces.internal.util.XMLSymbols; //导入依赖的package包/类
/**
 * Adds a namespace attribute or replaces the value of existing namespace
 * attribute with the given prefix and value for URI.
 * In case prefix is empty will add/update default namespace declaration.
 *
 * @param prefix
 * @param uri
 * @exception IOException
 */

protected final void addNamespaceDecl(String prefix, String uri, ElementImpl element){
    if (DEBUG) {
        System.out.println("[ns-fixup] addNamespaceDecl ["+prefix+"]");
    }
    if (prefix == XMLSymbols.EMPTY_STRING) {
        if (DEBUG) {
            System.out.println("=>add xmlns=\""+uri+"\" declaration");
        }
        element.setAttributeNS(NamespaceContext.XMLNS_URI, XMLSymbols.PREFIX_XMLNS, uri);
    } else {
        if (DEBUG) {
            System.out.println("=>add xmlns:"+prefix+"=\""+uri+"\" declaration");
        }
        element.setAttributeNS(NamespaceContext.XMLNS_URI, "xmlns:"+prefix, uri);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:DOMNormalizer.java

示例2: fillQName

import com.sun.org.apache.xerces.internal.util.XMLSymbols; //导入依赖的package包/类
private void fillQName(QName toFill, Node node) {
    final String prefix = node.getPrefix();
    final String localName = node.getLocalName();
    final String rawName = node.getNodeName();
    final String namespace = node.getNamespaceURI();

    toFill.uri = (namespace != null && namespace.length() > 0) ? fSymbolTable.addSymbol(namespace) : null;
    toFill.rawname = (rawName != null) ? fSymbolTable.addSymbol(rawName) : XMLSymbols.EMPTY_STRING;

    // Is this a DOM level1 document?
    if (localName == null) {
        int k = rawName.indexOf(':');
        if (k > 0) {
            toFill.prefix = fSymbolTable.addSymbol(rawName.substring(0, k));
            toFill.localpart = fSymbolTable.addSymbol(rawName.substring(k + 1));
        }
        else {
            toFill.prefix = XMLSymbols.EMPTY_STRING;
            toFill.localpart = toFill.rawname;
        }
    }
    else {
        toFill.prefix = (prefix != null) ? fSymbolTable.addSymbol(prefix) : XMLSymbols.EMPTY_STRING;
        toFill.localpart = (localName != null) ? fSymbolTable.addSymbol(localName) : XMLSymbols.EMPTY_STRING;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:DOMValidatorHelper.java

示例3: startElement

import com.sun.org.apache.xerces.internal.util.XMLSymbols; //导入依赖的package包/类
public void startElement(QName element, XMLAttributes attributes,
        Augmentations augs) throws XNIException {
    if (fContentHandler != null) {
        try {
            fTypeInfoProvider.beginStartElement(augs, attributes);
            fContentHandler.startElement((element.uri != null) ? element.uri : XMLSymbols.EMPTY_STRING,
                    element.localpart, element.rawname, fAttrAdapter);
        }
        catch (SAXException e) {
            throw new XNIException(e);
        }
        finally {
            fTypeInfoProvider.finishStartElement();
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:ValidatorHandlerImpl.java

示例4: endElement

import com.sun.org.apache.xerces.internal.util.XMLSymbols; //导入依赖的package包/类
public void endElement(QName element, Augmentations augs)
        throws XNIException {
    if (fContentHandler != null) {
        try {
            fTypeInfoProvider.beginEndElement(augs);
            fContentHandler.endElement((element.uri != null) ? element.uri : XMLSymbols.EMPTY_STRING,
                    element.localpart, element.rawname);
        }
        catch (SAXException e) {
            throw new XNIException(e);
        }
        finally {
            fTypeInfoProvider.finishEndElement();
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:ValidatorHandlerImpl.java

示例5: startPrefixMapping

import com.sun.org.apache.xerces.internal.util.XMLSymbols; //导入依赖的package包/类
public void startPrefixMapping(String prefix, String uri)
        throws SAXException {
    String prefixSymbol;
    String uriSymbol;
    if (!fStringsInternalized) {
        prefixSymbol = (prefix != null) ? fSymbolTable.addSymbol(prefix) : XMLSymbols.EMPTY_STRING;
        uriSymbol = (uri != null && uri.length() > 0) ? fSymbolTable.addSymbol(uri) : null;
    }
    else {
        prefixSymbol = (prefix != null) ? prefix : XMLSymbols.EMPTY_STRING;
        uriSymbol = (uri != null && uri.length() > 0) ? uri : null;
    }
    if (fNeedPushNSContext) {
        fNeedPushNSContext = false;
        fNamespaceContext.pushContext();
    }
    fNamespaceContext.declarePrefix(prefixSymbol, uriSymbol);
    if (fContentHandler != null) {
        fContentHandler.startPrefixMapping(prefix, uri);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:ValidatorHandlerImpl.java

示例6: fillQName

import com.sun.org.apache.xerces.internal.util.XMLSymbols; //导入依赖的package包/类
/** Fills in a QName object. */
private void fillQName(QName toFill, String uri, String localpart, String raw) {
    if (!fStringsInternalized) {
        uri = (uri != null && uri.length() > 0) ? fSymbolTable.addSymbol(uri) : null;
        localpart = (localpart != null) ? fSymbolTable.addSymbol(localpart) : XMLSymbols.EMPTY_STRING;
        raw = (raw != null) ? fSymbolTable.addSymbol(raw) : XMLSymbols.EMPTY_STRING;
    }
    else {
        if (uri != null && uri.length() == 0) {
            uri = null;
        }
        if (localpart == null) {
            localpart = XMLSymbols.EMPTY_STRING;
        }
        if (raw == null) {
            raw = XMLSymbols.EMPTY_STRING;
        }
    }
    String prefix = XMLSymbols.EMPTY_STRING;
    int prefixIdx = raw.indexOf(':');
    if (prefixIdx != -1) {
        prefix = fSymbolTable.addSymbol(raw.substring(0, prefixIdx));
    }
    toFill.setValues(prefix, localpart, raw, uri);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:ValidatorHandlerImpl.java

示例7: endNamespaceScope

import com.sun.org.apache.xerces.internal.util.XMLSymbols; //导入依赖的package包/类
/** Handles end element. */
protected void endNamespaceScope(QName element, Augmentations augs, boolean isEmpty)
    throws XNIException {

    // bind element
    String eprefix = element.prefix != null ? element.prefix : XMLSymbols.EMPTY_STRING;
    element.uri = fNamespaceContext.getURI(eprefix);
    if (element.uri != null) {
        element.prefix = eprefix;
    }

    // call handlers
    if (fDocumentHandler != null) {
        if (!isEmpty) {
            fDocumentHandler.endElement(element, augs);
        }
    }

    // pop context
    fNamespaceContext.popContext();

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:XML11NSDTDValidator.java

示例8: init

import com.sun.org.apache.xerces.internal.util.XMLSymbols; //导入依赖的package包/类
/** initialization */
protected void init() {

    // datatype validators
    if (fValidation || fDynamicValidation) {
        try {
            //REVISIT: datatypeRegistry + initialization of datatype
            //         why do we cast to ListDatatypeValidator?
            fValID       = fDatatypeValidatorFactory.getBuiltInDV(XMLSymbols.fIDSymbol);
            fValIDRef    = fDatatypeValidatorFactory.getBuiltInDV(XMLSymbols.fIDREFSymbol);
            fValIDRefs   = fDatatypeValidatorFactory.getBuiltInDV(XMLSymbols.fIDREFSSymbol);
            fValENTITY   = fDatatypeValidatorFactory.getBuiltInDV(XMLSymbols.fENTITYSymbol);
            fValENTITIES = fDatatypeValidatorFactory.getBuiltInDV(XMLSymbols.fENTITIESSymbol);
            fValNMTOKEN  = fDatatypeValidatorFactory.getBuiltInDV(XMLSymbols.fNMTOKENSymbol);
            fValNMTOKENS = fDatatypeValidatorFactory.getBuiltInDV(XMLSymbols.fNMTOKENSSymbol);
            fValNOTATION = fDatatypeValidatorFactory.getBuiltInDV(XMLSymbols.fNOTATIONSymbol);

        }
        catch (Exception e) {
            // should never happen
            e.printStackTrace(System.err);
        }

    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:XMLDTDValidator.java

示例9: handleEndElement

import com.sun.org.apache.xerces.internal.util.XMLSymbols; //导入依赖的package包/类
/** Handles end element. */
protected void handleEndElement(QName element, Augmentations augs, boolean isEmpty)
    throws XNIException {

    // bind element
    String eprefix = element.prefix != null ? element.prefix : XMLSymbols.EMPTY_STRING;
    element.uri = fNamespaceContext.getURI(eprefix);
    if (element.uri != null) {
        element.prefix = eprefix;
    }

    // call handlers
    if (fDocumentHandler != null && !fOnlyPassPrefixMappingEvents) {
        if (!isEmpty) {
            fDocumentHandler.endElement(element, augs);
        }
    }

    // pop context
    fNamespaceContext.popContext();

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:XMLNamespaceBinder.java

示例10: resolveNamespace

import com.sun.org.apache.xerces.internal.util.XMLSymbols; //导入依赖的package包/类
public void resolveNamespace(Element element, Attr[] attrs,
                             SchemaNamespaceSupport nsSupport) {
    // push the namespace context
    nsSupport.pushContext();

    // search for new namespace bindings
    int length = attrs.length;
    Attr sattr = null;
    String rawname, prefix, uri;
    for (int i = 0; i < length; i++) {
        sattr = attrs[i];
        rawname = DOMUtil.getName(sattr);
        prefix = null;
        if (rawname.equals(XMLSymbols.PREFIX_XMLNS))
            prefix = XMLSymbols.EMPTY_STRING;
        else if (rawname.startsWith("xmlns:"))
            prefix = fSymbolTable.addSymbol(DOMUtil.getLocalName(sattr));
        if (prefix != null) {
            uri = fSymbolTable.addSymbol(DOMUtil.getValue(sattr));
            nsSupport.declarePrefix(prefix, uri.length()!=0 ? uri : null);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:XSAttributeChecker.java

示例11: startPrefixMapping

import com.sun.org.apache.xerces.internal.util.XMLSymbols; //导入依赖的package包/类
public void startPrefixMapping(String prefix, String uri) throws SAXException {
    if (fNeedPushNSContext) {
        fNeedPushNSContext = false;
        fNamespaceContext.pushContext();
    }
    if (!fStringsInternalized) {
        prefix = (prefix != null) ? fSymbolTable.addSymbol(prefix) : XMLSymbols.EMPTY_STRING;
        uri = (uri != null && uri.length() > 0) ? fSymbolTable.addSymbol(uri) : null;
    }
    else {
        if (prefix == null) {
            prefix = XMLSymbols.EMPTY_STRING;
        }
        if (uri != null && uri.length() == 0) {
            uri = null;
        }
    }
    fNamespaceContext.declarePrefix(prefix, uri);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:SchemaContentHandler.java

示例12: addNamespaceDeclarations

import com.sun.org.apache.xerces.internal.util.XMLSymbols; //导入依赖的package包/类
private void addNamespaceDeclarations(final int prefixCount) {
    String prefix = null;
    String localpart = null;
    String rawname = null;
    String nsPrefix = null;
    String nsURI = null;
    for (int i = 0; i < prefixCount; ++i) {
        nsPrefix = fNamespaceContext.getDeclaredPrefixAt(i);
        nsURI = fNamespaceContext.getURI(nsPrefix);
        if (nsPrefix.length() > 0) {
            prefix = XMLSymbols.PREFIX_XMLNS;
            localpart = nsPrefix;
            rawname = fSymbolTable.addSymbol(prefix + ":" + localpart);
        }
        else {
            prefix = XMLSymbols.EMPTY_STRING;
            localpart = XMLSymbols.PREFIX_XMLNS;
            rawname = XMLSymbols.PREFIX_XMLNS;
        }
        fAttributeQName.setValues(prefix, localpart, rawname, NamespaceContext.XMLNS_URI);
        fAttributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, nsURI);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:SchemaContentHandler.java

示例13: storeLocations

import com.sun.org.apache.xerces.internal.util.XMLSymbols; //导入依赖的package包/类
void storeLocations(String sLocation, String nsLocation) {
    if (sLocation != null) {
        if (!XMLSchemaLoader.tokenizeSchemaLocationStr(sLocation, fLocationPairs)) {
            // error!
            fXSIErrorReporter.reportError(
                XSMessageFormatter.SCHEMA_DOMAIN,
                "SchemaLocation",
                new Object[] { sLocation },
                XMLErrorReporter.SEVERITY_WARNING);
        }
    }
    if (nsLocation != null) {
        XMLSchemaLoader.LocationArray la =
            ((XMLSchemaLoader.LocationArray) fLocationPairs.get(XMLSymbols.EMPTY_STRING));
        if (la == null) {
            la = new XMLSchemaLoader.LocationArray();
            fLocationPairs.put(XMLSymbols.EMPTY_STRING, la);
        }
        la.addLocation(nsLocation);
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:XMLSchemaValidator.java

示例14: getPrefix

import com.sun.org.apache.xerces.internal.util.XMLSymbols; //导入依赖的package包/类
public String getPrefix(String uri, int start, int end) {
    // this saves us from having a copy of each of these in fNamespace for each scope
    if (uri == NamespaceContext.XML_URI) {
        return XMLSymbols.PREFIX_XML;
    }
    if (uri == NamespaceContext.XMLNS_URI) {
        return XMLSymbols.PREFIX_XMLNS;
    }

    // find uri in current context
    for (int i = start; i > end; i -= 2) {
        if (fNamespace[i - 1] == uri) {
            if (getURI(fNamespace[i - 2]) == uri)
                return fNamespace[i - 2];
        }
    }

    // uri not found
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:MultipleScopeNamespaceSupport.java

示例15: getURI

import com.sun.org.apache.xerces.internal.util.XMLSymbols; //导入依赖的package包/类
public String getURI(String prefix, int start, int end) {
    // this saves us from having a copy of each of these in fNamespace for each scope
    if (prefix == XMLSymbols.PREFIX_XML) {
        return NamespaceContext.XML_URI;
    }
    if (prefix == XMLSymbols.PREFIX_XMLNS) {
        return NamespaceContext.XMLNS_URI;
    }

    // find prefix in current context
    for (int i = start; i > end; i -= 2) {
        if (fNamespace[i - 2] == prefix) {
            return fNamespace[i - 1];
        }
    }

    // prefix not found
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:MultipleScopeNamespaceSupport.java


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