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


Java XMLAttributes类代码示例

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


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

示例1: Info

import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
 * Creates an element information object.
 * <p>
 * <strong>Note:</strong>
 * This constructor makes a copy of the element information.
 *
 * @param element The element qualified name.
 * @param attributes The element attributes.
 */
public Info(HTMLElements.Element element,
            QName qname, XMLAttributes attributes) {
    this.element = element;
    this.qname = new QName(qname);
    if (attributes != null) {
        int length = attributes.getLength();
        if (length > 0) {
            QName aqname = new QName();
            XMLAttributes newattrs = new XMLAttributesImpl();
            for (int i = 0; i < length; i++) {
                attributes.getName(i, aqname);
                String type = attributes.getType(i);
                String value = attributes.getValue(i);
                String nonNormalizedValue = attributes.getNonNormalizedValue(i);
                boolean specified = attributes.isSpecified(i);
                newattrs.addAttribute(aqname, type, value);
                newattrs.setNonNormalizedValue(i, nonNormalizedValue);
                newattrs.setSpecified(i, specified);
            }
            this.attributes = newattrs;
        }
    }
}
 
开发者ID:carson0321,项目名称:node-boilerpipe,代码行数:33,代码来源:HTMLTagBalancer.java

示例2: startElement

import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
public void startElement(QName element, XMLAttributes attributes,
        Augmentations augs) throws XNIException {
    try {
        int length = attributes.getLength();
        if (length == 0) {
            /** Avoid creating a new StartElement event object (if possible). */
            XMLEvent start = fStAXValidatorHelper.getCurrentEvent();
            if (start != null) {
                fEventWriter.add(start);
                return;
            }
        }
        fEventWriter.add(fEventFactory.createStartElement(element.prefix, 
                element.uri != null ? element.uri : "", element.localpart, 
                getAttributeIterator(attributes, length), getNamespaceIterator(),
                fNamespaceContext.getNamespaceContext()));
    }
    catch (XMLStreamException e) {
        throw new XNIException(e);
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:22,代码来源:StAXEventResultBuilder.java

示例3: startElement

import org.apache.xerces.xni.XMLAttributes; //导入依赖的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:AaronZhangL,项目名称:SplitCharater,代码行数:17,代码来源:ValidatorHandlerImpl.java

示例4: emptyElement

import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
 * An empty element.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs     Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void emptyElement(QName element, XMLAttributes attributes, Augmentations augs)
    throws XNIException {

    Augmentations modifiedAugs = handleStartElement(element, attributes, augs);

    // in the case where there is a {value constraint}, and the element
    // doesn't have any text content, change emptyElement call to
    // start + characters + end
    fDefaultValue = null;
    // fElementDepth == -2 indicates that the schema validator was removed
    // from the pipeline. then we don't need to call handleEndElement.
    if (fElementDepth != -2)
        modifiedAugs = handleEndElement(element, modifiedAugs);

    // call handlers
    if (fDocumentHandler != null) {
        if (!fSchemaElementDefault || fDefaultValue == null) {
            fDocumentHandler.emptyElement(element, attributes, modifiedAugs);
        } else {
            fDocumentHandler.startElement(element, attributes, modifiedAugs);
            fDocumentHandler.characters(fDefaultValue, null);
            fDocumentHandler.endElement(element, modifiedAugs);
        }
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:35,代码来源:XMLSchemaValidator.java

示例5: startElement

import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
         * The start of an element. If the document specifies the start element
         * by using an empty tag, then the startElement method will immediately
         * be followed by the endElement method, with no intervening methods.
         * 
         * @param element    The name of the element.
         * @param attributes The element attributes. 
         *
         */
        public void startElement(QName element, XMLAttributes attributes) {
            super.startElement(element, attributes);
            fElementDepth++;
            // activate the fields, if selector is matched
            //int matched = isMatched();

            if (isMatched()) {
/*            (fMatchedDepth == -1 && ((matched & MATCHED) == MATCHED)) ||
                    ((matched & MATCHED_DESCENDANT) == MATCHED_DESCENDANT)) { */
                fMatchedDepth = fElementDepth;
                fFieldActivator.startValueScopeFor(fIdentityConstraint, fInitialDepth);
                int count = fIdentityConstraint.getFieldCount();
                for (int i = 0; i < count; i++) {
                    Field field = fIdentityConstraint.getFieldAt(i);
                    XPathMatcher matcher = fFieldActivator.activateField(field, fInitialDepth);
                    matcher.startElement(element, attributes);
                }
            }

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

示例6: startElement

import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
 * The start of an element.
 * 
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs       Additional information that may include infoset augmentations
 *                   
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void startElement(QName element, XMLAttributes attributes,
        Augmentations augs) throws XNIException {
    if (!resolveXPointer(element, attributes, augs,
            XPointerPart.EVENT_ELEMENT_START)) {

        // xml:base and xml:lang processing
    	if (fFixupBase) {
            processXMLBaseAttributes(attributes);
    	}
        if (fFixupLang) {
            processXMLLangAttributes(attributes);
        }

        // set the context invalid if the element till an element from the result infoset is included
        fNamespaceContext.setContextInvalid(); 

        return;
    }
    super.startElement(element, attributes, augs);
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:31,代码来源:XPointerHandler.java

示例7: emptyElement

import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
 * An empty element.
 * 
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs       Additional information that may include infoset augmentations
 *                   
 * @exception XNIException
 *                   Thrown by handler to signal an error.
 */
public void emptyElement(QName element, XMLAttributes attributes,
        Augmentations augs) throws XNIException {
    if (!resolveXPointer(element, attributes, augs,
            XPointerPart.EVENT_ELEMENT_EMPTY)) {
        // xml:base and xml:lang processing
    	if (fFixupBase) {
            processXMLBaseAttributes(attributes);
    	}    
        if (fFixupLang) {
            processXMLLangAttributes(attributes);
        }
        // no need to restore restoreBaseURI() for xml:base and xml:lang processing
        
        // set the context invalid if the element till an element from the result infoset is included
        fNamespaceContext.setContextInvalid(); 
        return;
    }
    super.emptyElement(element, attributes, augs);
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:30,代码来源:XPointerHandler.java

示例8: processXMLBaseAttributes

import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
 * Search for a xml:base attribute, and if one is found, put the new base URI into
 * effect.
 */
protected void processXMLBaseAttributes(XMLAttributes attributes) {
    String baseURIValue =
        attributes.getValue(NamespaceContext.XML_URI, "base");
    if (baseURIValue != null) {
        try {
            String expandedValue =
                XMLEntityManager.expandSystemId(
                    baseURIValue,
                    fCurrentBaseURI.getExpandedSystemId(),
                    false);
            fCurrentBaseURI.setLiteralSystemId(baseURIValue);
            fCurrentBaseURI.setBaseSystemId(
                fCurrentBaseURI.getExpandedSystemId());
            fCurrentBaseURI.setExpandedSystemId(expandedValue);

            // push the new values on the stack
            saveBaseURI();
        }
        catch (MalformedURIException e) {
            // REVISIT: throw error here
        }
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:28,代码来源:XIncludeHandler.java

示例9: startElement

import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
 * Binds the namespaces. This method will handle calling the
 * document handler to start the prefix mappings.
 * <p>
 * <strong>Note:</strong> This method makes use of the
 * fAttributeQName variable. Any contents of the variable will
 * be destroyed. Caller should copy the values out of this
 * temporary variable before calling this method.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs   Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void startElement(
    QName element,
    XMLAttributes attributes,
    Augmentations augs)
    throws XNIException {
    if (fDocumentHandler == null)
        return;

    checkForChildren();

    _elementState.push(new ElementState(true));

    sendIndentedElement("element");
    sendElementEvent("namespaceName", element.uri);
    sendElementEvent("localName", element.localpart);
    sendElementEvent("prefix", element.prefix);
    processAttributes(attributes);
    processInScopeNamespaces();
    sendElementEvent("baseURI", fDocumentLocation.getBaseSystemId());
    if (fPSVInfoset) {
        processPSVIStartElement(augs);
    }
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:39,代码来源:PSVIWriter.java

示例10: emptyElement

import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/**
 * An empty element.
 *
 * @param element    The name of the element.
 * @param attributes The element attributes.
 * @param augs   Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void emptyElement(
    QName element,
    XMLAttributes attributes,
    Augmentations augs)
    throws XNIException {
    if (fDocumentHandler == null)
        return;

    checkForChildren();
    sendIndentedElement("element");
    sendElementEvent("namespaceName", element.uri);
    sendElementEvent("localName", element.localpart);
    sendElementEvent("prefix", element.prefix);
    processAttributes(attributes);
    processInScopeNamespaces();
    sendElementEvent("baseURI", fDocumentLocation.getBaseSystemId());
    if (fPSVInfoset) {
        processPSVIStartElement(augs);
    }
    sendEmptyElementEvent("children");
    if (fPSVInfoset) {
        processPSVIEndElement(augs);
    }
    sendUnIndentedElement("element");
}
 
开发者ID:AaronZhangL,项目名称:SplitCharater,代码行数:35,代码来源:PSVIWriter.java

示例11: startElement

import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/** Start element. */
public void startElement(QName element, XMLAttributes attrs, Augmentations augs)
    throws XNIException {

    fElements++;
    fTagCharacters++; // open angle bracket
    fTagCharacters += element.rawname.length();
    if (attrs != null) {
        int attrCount = attrs.getLength();
        fAttributes += attrCount;
        for (int i = 0; i < attrCount; i++) {
            fTagCharacters++; // space
            fTagCharacters += attrs.getQName(i).length();
            fTagCharacters++; // '='
            fTagCharacters++; // open quote
            fOtherCharacters += attrs.getValue(i).length();
            fTagCharacters++; // close quote
        }
    }
    fTagCharacters++; // close angle bracket

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

示例12: emptyElement

import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/** Empty element. */
public void emptyElement(QName element, XMLAttributes attrs, Augmentations augs)
    throws XNIException {

    fElements++;
    fTagCharacters++; // open angle bracket
    fTagCharacters += element.rawname.length();
    if (attrs != null) {
        int attrCount = attrs.getLength();
        fAttributes += attrCount;
        for (int i = 0; i < attrCount; i++) {
            fTagCharacters++; // space
            fTagCharacters += attrs.getQName(i).length();
            fTagCharacters++; // '='
            fTagCharacters++; // open quote
            fOtherCharacters += attrs.getValue(i).length();
            fTagCharacters++; // close quote
        }
    }
    fTagCharacters++; // forward slash
    fTagCharacters++; // close angle bracket

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

示例13: startElement

import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/** Start element. */
public void startElement(QName element, XMLAttributes attrs, Augmentations augs)
    throws XNIException {

    fSeenRootElement = true;
    fElementDepth++;
    fOut.print('<');
    fOut.print(element.rawname);
    if (attrs != null) {
        /***
        attrs = sortAttributes(attrs);
        /***/
        int len = attrs.getLength();
        for (int i = 0; i < len; i++) {
            fOut.print(' ');
            fOut.print(attrs.getQName(i));
            fOut.print("=\"");
            normalizeAndPrint(attrs.getValue(i));
            fOut.print('"');
        }
    }
    fOut.print('>');
    fOut.flush();

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

示例14: emptyElement

import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/** Empty element. */
public void emptyElement(QName element, XMLAttributes attrs, Augmentations augs)
    throws XNIException {

    fSeenRootElement = true;
    fElementDepth++;
    fOut.print('<');
    fOut.print(element.rawname);
    if (attrs != null) {
        /***
        attrs = sortAttributes(attrs);
        /***/
        int len = attrs.getLength();
        for (int i = 0; i < len; i++) {
            fOut.print(' ');
            fOut.print(attrs.getQName(i));
            fOut.print("=\"");
            normalizeAndPrint(attrs.getValue(i));
            fOut.print('"');
        }
    }
    fOut.print("/>");
    fOut.flush();

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

示例15: startElement

import org.apache.xerces.xni.XMLAttributes; //导入依赖的package包/类
/** Start element. */
public void startElement(QName element, XMLAttributes attributes, Augmentations augs)
    throws XNIException {

    printInScopeNamespaces();

    printIndent();
    fOut.print("startElement(");
    printElement(element, attributes);
    if (augs != null) {
        fOut.print(',');
        printAugmentations(augs);
    }
    fOut.println(')');
    fOut.flush();
    fIndent++;

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


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