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


Java EndElement.getName方法代码示例

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


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

示例1: handleEndElement

import javax.xml.stream.events.EndElement; //导入方法依赖的package包/类
private void handleEndElement(EndElement event) throws SAXException {
    if(!seenText && predictor.expectText()) {
        visitor.text("");
    }

    // fire endElement
    QName qName = event.getName();
    tagName.uri = fixNull(qName.getNamespaceURI());
    tagName.local = qName.getLocalPart();
    visitor.endElement(tagName);

    // end namespace bindings
    for( Iterator<Namespace> i = event.getNamespaces(); i.hasNext();) {
        String prefix = fixNull(i.next().getPrefix());  // be defensive
        visitor.endPrefixMapping(prefix);
    }

    seenText = false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:StAXEventConnector.java

示例2: handleEndElement

import javax.xml.stream.events.EndElement; //导入方法依赖的package包/类
private void handleEndElement(EndElement endElement) throws SAXException {
	if (getContentHandler() != null) {
		QName qName = endElement.getName();
		if (hasNamespacesFeature()) {
			getContentHandler().endElement(qName.getNamespaceURI(), qName.getLocalPart(), toQualifiedName(qName));
			for (Iterator i = endElement.getNamespaces(); i.hasNext();) {
				Namespace namespace = (Namespace) i.next();
				endPrefixMapping(namespace.getPrefix());
			}
		}
		else {
			getContentHandler().endElement("", "", toQualifiedName(qName));
		}

	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:17,代码来源:StaxEventXMLReader.java

示例3: checkEndTagName

import javax.xml.stream.events.EndElement; //导入方法依赖的package包/类
private void checkEndTagName(final QName expectedName, final EndElement element) throws PolicyException {
    final QName actualName = element.getName();
    if (!expectedName.equals(actualName)) {
        throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0091_END_ELEMENT_NO_MATCH(expectedName, element, element.getLocation())));
    }

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

示例4: handleEndElement

import javax.xml.stream.events.EndElement; //导入方法依赖的package包/类
private void handleEndElement(EndElement event) throws XMLStreamException {
    QName qName = event.getName();

    //construct prefix:localName from qName
    String qname = "";
    if (qName.getPrefix() != null && qName.getPrefix().trim().length() != 0){
        qname = qName.getPrefix() + ":";
    }
    qname += qName.getLocalPart();

    try {
        // fire endElement
        _sax.endElement(
            qName.getNamespaceURI(),
            qName.getLocalPart(),
            qname);

        // end namespace bindings
        for( Iterator i = event.getNamespaces(); i.hasNext();) {
            String prefix = (String)i.next();
            if( prefix == null ) { // true for default namespace
                prefix = "";
            }
            _sax.endPrefixMapping(prefix);
        }
    } catch (SAXException e) {
        throw new XMLStreamException(e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:StAXEvent2SAX.java

示例5: set

import javax.xml.stream.events.EndElement; //导入方法依赖的package包/类
public void set ( final String expression, final int targetElement, final String value ) throws IOException, XMLStreamException
{
    int pos = 0;

    final Stack<String> ele = new Stack<> ();

    final Pattern pattern = Pattern.compile ( expression );

    final XMLEventReader reader;

    Modification mod = null;

    final XMLInputFactory xmlinf = XMLInputFactory.newInstance ();
    try (final FileInputStream is = new FileInputStream ( this.inputFile ))
    {
        reader = xmlinf.createXMLEventReader ( is );
        try
        {
            while ( reader.hasNext () )
            {
                final XMLEvent event = (XMLEvent)reader.next ();
                if ( event instanceof StartElement )
                {
                    final StartElement startEvent = event.asStartElement ();
                    ele.push ( startEvent.getName ().getLocalPart () );
                }
                else if ( event instanceof EndElement )
                {
                    final EndElement endEvent = event.asEndElement ();
                    final String en = ele.pop ();
                    if ( !endEvent.getName ().getLocalPart ().equals ( en ) )
                    {
                        throw new IllegalStateException ( "Element error: " + en + " / " + endEvent.getName () );
                    }
                }

                boolean inMatch = mod != null;
                final boolean match = isMatch ( ele, pattern );
                if ( inMatch && !match )
                {
                    // end
                    if ( pos == targetElement )
                    {
                        this.mods.add ( mod );
                    }
                    pos++;
                    mod = null;
                }
                else if ( !inMatch && match )
                {
                    // starting
                    mod = new Modification ();
                    mod.start = event.getLocation ().getCharacterOffset ();
                    mod.data = value;
                }
                else if ( inMatch && match )
                {
                    mod.end = event.getLocation ().getCharacterOffset () - 2;
                }
                inMatch = match;
            }
        }
        finally
        {
            reader.close ();
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:69,代码来源:XmlModifier.java

示例6: checkEndTagName

import javax.xml.stream.events.EndElement; //导入方法依赖的package包/类
/**
 * Method checks whether the actual name of the end tag is equal to the expected name - the name of currently unmarshalled
 * XML policy model element. Throws exception, if the two FQNs are not equal as expected.
 *
 * @param expected The expected element name.
 * @param element The actual element.
 * @throws PolicyException If the actual element name did not match the expected element.
 */
private void checkEndTagName(final QName expected, final EndElement element) throws PolicyException {
    final QName actual = element.getName();
    if (!expected.equals(actual)) {
        throw LOGGER.logSevereException(new PolicyException(LocalizationMessages.WSP_0003_UNMARSHALLING_FAILED_END_TAG_DOES_NOT_MATCH(expected, actual)));
    }

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


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