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


Java XMLSymbols.EMPTY_STRING属性代码示例

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


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

示例1: endNamespaceScope

/** 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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:XML11NSDTDValidator.java

示例2: handleEndElement

/** 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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:XMLNamespaceBinder.java

示例3: fillQName

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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:DOMValidatorHelper.java

示例4: fillQName

/** 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:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:ValidatorHandlerImpl.java

示例5: printNamespaceAttr

/**
 * Serializes a namespace attribute with the given prefix and value for URI.
 * In case prefix is empty will serialize default namespace declaration.
 *
 * @param prefix
 * @param uri
 * @exception IOException
 */

private void printNamespaceAttr(String prefix, String uri) throws IOException{
    _printer.printSpace();
    if (prefix == XMLSymbols.EMPTY_STRING) {
        if (DEBUG) {
            System.out.println("=>add xmlns=\""+uri+"\" declaration");
        }
        _printer.printText( XMLSymbols.PREFIX_XMLNS );
    } else {
        if (DEBUG) {
            System.out.println("=>add xmlns:"+prefix+"=\""+uri+"\" declaration");
        }
        _printer.printText( "xmlns:"+prefix );
    }
    _printer.printText( "=\"" );
    printEscaped( uri );
    _printer.printText( '"' );
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:XMLSerializer.java

示例6: startPrefixMapping

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:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:19,代码来源:SchemaContentHandler.java

示例7: startPrefixMapping

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:campolake,项目名称:openjdk9,代码行数:21,代码来源:ValidatorHandlerImpl.java

示例8: resolveNamespace

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:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:23,代码来源:XSAttributeChecker.java

示例9: addNamespaceDecl

/**
 * 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:infobip,项目名称:infobip-open-jdk-8,代码行数:26,代码来源:DOMNormalizer.java

示例10: addNamespaceDeclarations

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:infobip,项目名称:infobip-open-jdk-8,代码行数:23,代码来源:SchemaContentHandler.java

示例11: fillNamespaceContext

private void fillNamespaceContext() {
    if (fRoot != null) {
        Node currentNode = fRoot.getParentNode();
        while (currentNode != null) {
            if (Node.ELEMENT_NODE == currentNode.getNodeType()) {
                NamedNodeMap attributes = currentNode.getAttributes();
                final int attrCount = attributes.getLength();
                for (int i = 0; i < attrCount; ++i) {
                    Attr attr = (Attr) attributes.item(i);
                    String value = attr.getValue();
                    if (value == null) {
                        value = XMLSymbols.EMPTY_STRING;
                    }
                    fillQName(fAttributeQName, attr);
                    // REVISIT: Should we be looking at non-namespace attributes
                    // for additional mappings? Should we detect illegal namespace
                    // declarations and exclude them from the context? -- mrglavas
                    if (fAttributeQName.uri == NamespaceContext.XMLNS_URI) {
                        // process namespace attribute
                        if (fAttributeQName.prefix == XMLSymbols.PREFIX_XMLNS) {
                            declarePrefix0(fAttributeQName.localpart, value.length() != 0 ? fSymbolTable.addSymbol(value) : null);
                        }
                        else {
                            declarePrefix0(XMLSymbols.EMPTY_STRING, value.length() != 0 ? fSymbolTable.addSymbol(value) : null);
                        }
                    }
                }

            }
            currentNode = currentNode.getParentNode();
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:DOMValidatorHelper.java

示例12: fillQName

/** Fills in a QName object. */
final void fillQName(QName toFill, String uri, String localpart, String prefix) {
    uri = (uri != null && uri.length() > 0) ? fSymbolTable.addSymbol(uri) : null;
    localpart = (localpart != null) ? fSymbolTable.addSymbol(localpart) : XMLSymbols.EMPTY_STRING;
    prefix = (prefix != null && prefix.length() > 0) ? fSymbolTable.addSymbol(prefix) : XMLSymbols.EMPTY_STRING;
    String raw = localpart;
    if (prefix != XMLSymbols.EMPTY_STRING) {
        fStringBuffer.clear();
        fStringBuffer.append(prefix);
        fStringBuffer.append(':');
        fStringBuffer.append(localpart);
        raw = fSymbolTable.addSymbol(fStringBuffer.ch, fStringBuffer.offset, fStringBuffer.length);
    }
    toFill.setValues(prefix, localpart, raw, uri);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:StAXSchemaParser.java

示例13: resolveDocument

/** This method tries to resolve location of the given schema.
 * The loader stores the namespace/location pairs in a hashtable (use "" as the
 * namespace of absent namespace). When resolving an entity, loader first tries
 * to find in the hashtable whether there is a value for that namespace,
 * if so, pass that location value to the user-defined entity resolver.
 *
 * @param desc
 * @param locationPairs
 * @param entityResolver
 * @return
 * @throws IOException
 */
public static XMLInputSource resolveDocument(XSDDescription desc, Map locationPairs,
        XMLEntityResolver entityResolver) throws IOException {
    String loc = null;
    // we consider the schema location properties for import
    if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT ||
            desc.fromInstance()) {
        // use empty string as the key for absent namespace
        String namespace = desc.getTargetNamespace();
        String ns = namespace == null ? XMLSymbols.EMPTY_STRING : namespace;
        // get the location hint for that namespace
        LocationArray tempLA = (LocationArray)locationPairs.get(ns);
        if(tempLA != null)
            loc = tempLA.getFirstLocation();
    }

    // if it's not import, or if the target namespace is not set
    // in the schema location properties, use location hint
    if (loc == null) {
        String[] hints = desc.getLocationHints();
        if (hints != null && hints.length > 0)
            loc = hints[0];
    }

    String expandedLoc = XMLEntityManager.expandSystemId(loc, desc.getBaseSystemId(), false);
    desc.setLiteralSystemId(loc);
    desc.setExpandedSystemId(expandedLoc);
    return entityResolver.resolveEntity(desc);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:XMLSchemaLoader.java

示例14: resolveDocument

/**
 * This method tries to resolve location of the given schema.
 * The loader stores the namespace/location pairs in a map (use "" as the
 * namespace of absent namespace). When resolving an entity, loader first tries
 * to find in the map whether there is a value for that namespace,
 * if so, pass that location value to the user-defined entity resolver.
 *
 * @param desc
 * @param locationPairs
 * @param entityResolver
 * @return the XMLInputSource
 * @throws IOException
 */
public static XMLInputSource resolveDocument(XSDDescription desc,
        Map<String, LocationArray> locationPairs,
        XMLEntityResolver entityResolver) throws IOException {
    String loc = null;
    // we consider the schema location properties for import
    if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT ||
            desc.fromInstance()) {
        // use empty string as the key for absent namespace
        String namespace = desc.getTargetNamespace();
        String ns = namespace == null ? XMLSymbols.EMPTY_STRING : namespace;
        // get the location hint for that namespace
        LocationArray tempLA = locationPairs.get(ns);
        if(tempLA != null)
            loc = tempLA.getFirstLocation();
    }

    // if it's not import, or if the target namespace is not set
    // in the schema location properties, use location hint
    if (loc == null) {
        String[] hints = desc.getLocationHints();
        if (hints != null && hints.length > 0)
            loc = hints[0];
    }

    String expandedLoc = XMLEntityManager.expandSystemId(loc, desc.getBaseSystemId(), false);
    desc.setLiteralSystemId(loc);
    desc.setExpandedSystemId(expandedLoc);
    return entityResolver.resolveEntity(desc);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:42,代码来源:XMLSchemaLoader.java

示例15: changeRedefineGroup

private int changeRedefineGroup(String originalQName, String elementSought,
        String newName, Element curr, XSDocumentInfo schemaDoc) {
    int result = 0;
    for (Element child = DOMUtil.getFirstChildElement(curr);
    child != null; child = DOMUtil.getNextSiblingElement(child)) {
        String name = DOMUtil.getLocalName(child);
        if (!name.equals(elementSought))
            result += changeRedefineGroup(originalQName, elementSought, newName, child, schemaDoc);
        else {
            String ref = child.getAttribute( SchemaSymbols.ATT_REF );
            if (ref.length() != 0) {
                String processedRef = findQName(ref, schemaDoc);
                if (originalQName.equals(processedRef)) {
                    String prefix = XMLSymbols.EMPTY_STRING;
                    int colonptr = ref.indexOf(":");
                    if (colonptr > 0) {
                        prefix = ref.substring(0,colonptr);
                        child.setAttribute(SchemaSymbols.ATT_REF, prefix + ":" + newName);
                    }
                    else
                        child.setAttribute(SchemaSymbols.ATT_REF, newName);
                    result++;
                    if (elementSought.equals(SchemaSymbols.ELT_GROUP)) {
                        String minOccurs = child.getAttribute( SchemaSymbols.ATT_MINOCCURS );
                        String maxOccurs = child.getAttribute( SchemaSymbols.ATT_MAXOCCURS );
                        if (!((maxOccurs.length() == 0 || maxOccurs.equals("1"))
                                && (minOccurs.length() == 0 || minOccurs.equals("1")))) {
                            reportSchemaError("src-redefine.6.1.2", new Object [] {ref}, child);
                        }
                    }
                }
            } // if ref was null some other stage of processing will flag the error
        }
    }
    return result;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:XSDHandler.java


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