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


Java Element.getLocalName方法代码示例

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


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

示例1: validateReference

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * Validate the Element referred to by the KeyInfoReference.
 *
 * @param referentElement
 *
 * @throws XMLSecurityException
 */
private void validateReference(Element referentElement) throws XMLSecurityException {
    if (!XMLUtils.elementIsInSignatureSpace(referentElement, Constants._TAG_KEYINFO)) {
        Object exArgs[] = { new QName(referentElement.getNamespaceURI(), referentElement.getLocalName()) };
        throw new XMLSecurityException("KeyInfoReferenceResolver.InvalidReferentElement.WrongType", exArgs);
    }

    KeyInfo referent = new KeyInfo(referentElement, "");
    if (referent.containsKeyInfoReference()) {
        if (secureValidation) {
            throw new XMLSecurityException("KeyInfoReferenceResolver.InvalidReferentElement.ReferenceWithSecure");
        } else {
            // Don't support chains of references at this time. If do support in the future, this is where the code
            // would go to validate that don't have a cycle, resulting in an infinite loop. This may be unrealistic
            // to implement, and/or very expensive given remote URI references.
            throw new XMLSecurityException("KeyInfoReferenceResolver.InvalidReferentElement.ReferenceWithoutSecure");
        }
    }

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:KeyInfoReferenceResolver.java

示例2: getElementStringRep

import org.w3c.dom.Element; //导入方法依赖的package包/类
private static String getElementStringRep(Element el) {
    String result = el.getLocalName();
    if (el.getNamespaceURI() != null) {
        result = el.getNamespaceURI() + ":" + result;
    }
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:DOMCompare.java

示例3: getQName

import org.w3c.dom.Element; //导入方法依赖的package包/类
private static QName getQName(Element element, POMComponentImpl context) {
    String namespace = element.getNamespaceURI();
    String prefix = element.getPrefix();
    if (namespace == null && context != null) {
        namespace = context.lookupNamespaceURI(prefix);
    }
    String localName = element.getLocalName();
    assert(localName != null);
    if (namespace == null && prefix == null) {
        return new QName(localName);
    } else if (namespace != null && prefix == null) {
        return new QName(namespace, localName);
    } else {
        return new QName(namespace, localName, prefix);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:POMComponentFactoryImpl.java

示例4: guaranteeThatElementInCorrectSpace

import org.w3c.dom.Element; //导入方法依赖的package包/类
public void guaranteeThatElementInCorrectSpace(
    ElementProxy expected, Element actual
) throws XMLSecurityException {

    String expectedLocalname = expected.getBaseLocalName();
    String expectedNamespace = expected.getBaseNamespace();

    String localnameIS = actual.getLocalName();
    String namespaceIS = actual.getNamespaceURI();
    if ((expectedNamespace != namespaceIS) ||
        !expectedLocalname.equals(localnameIS)) {
        Object exArgs[] = { namespaceIS + ":" + localnameIS,
                            expectedNamespace + ":" + expectedLocalname};
        throw new XMLSecurityException("xml.WrongElement", exArgs);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:ElementCheckerImpl.java

示例5: parseServiceProperties

import org.w3c.dom.Element; //导入方法依赖的package包/类
public static boolean parseServiceProperties(Element parent, Element element, ParserContext parserContext,
		BeanDefinitionBuilder builder) {
	String name = element.getLocalName();

	if (PROPS_ID.equals(name)) {
		if (DomUtils.getChildElementsByTagName(element, BeanDefinitionParserDelegate.ENTRY_ELEMENT).size() > 0) {
			Object props = parserContext.getDelegate().parseMapElement(element, builder.getRawBeanDefinition());
			builder.addPropertyValue(Conventions.attributeNameToPropertyName(PROPS_ID), props);
		}
		else {
			parserContext.getReaderContext().error("Invalid service property type", element);
		}
		return true;
	}
	return false;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:17,代码来源:ServiceParsingUtils.java

示例6: getProperties

import org.w3c.dom.Element; //导入方法依赖的package包/类
@Override
public Map<String, String> getProperties() {
    Map<String, String> toRet = new HashMap<String, String>();
    List<SettingsComponent> chlds = getChildren();
    for (SettingsComponent pc : chlds) {
        Element el = pc.getPeer();
        String key = el.getLocalName();
        String val = getChildElementText(SettingsQName.createQName(key, getModel().getSettingsQNames().getNamespaceVersion()));
        toRet.put(key, val);
    }
    return toRet;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:PropertiesImpl.java

示例7: decode

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * Decodeer de XML structuur.
 * @param context context
 * @param document DOM XML document
 * @return de gelezen waarde
 * @throws ConfigurationException configuratie problemen (bij annotaties in kinderen)
 * @throws DecodeException decodeer problemen
 */
public T decode(final Context context, final Document document) throws XmlException {
    final Element documentElement = document.getDocumentElement();
    if (name.equals(documentElement.getLocalName())) {
        return element.decode(context, documentElement);
    } else {
        throw new DecodeException(
                context.getElementStack(),
                "Root node met naam '" + name + "' verwacht, maar '" + documentElement.getLocalName() + "' gevonden.");
    }
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:19,代码来源:Root.java

示例8: guaranteeThatElementInCorrectSpace

import org.w3c.dom.Element; //导入方法依赖的package包/类
public void guaranteeThatElementInCorrectSpace(
    ElementProxy expected, Element actual
) throws XMLSecurityException {
    String expectedLocalname = expected.getBaseLocalName();
    String expectedNamespace = expected.getBaseNamespace();

    String localnameIS = actual.getLocalName();
    String namespaceIS = actual.getNamespaceURI();
    if ((!expectedNamespace.equals(namespaceIS)) ||
        !expectedLocalname.equals(localnameIS) ) {
        Object exArgs[] = { namespaceIS + ":" + localnameIS,
                            expectedNamespace + ":" + expectedLocalname};
        throw new XMLSecurityException("xml.WrongElement", exArgs);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:ElementCheckerImpl.java

示例9: matchesTagNS

import org.w3c.dom.Element; //导入方法依赖的package包/类
public static boolean matchesTagNS(Element e, String tag, String nsURI) {
    try {
        return e.getLocalName().equals(tag)
            && e.getNamespaceURI().equals(nsURI);
    } catch (NullPointerException npe) {

        // localname not null since parsing would fail before here
        throw new WSDLParseException(
            "null.namespace.found",
            e.getLocalName());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:XmlUtil.java

示例10: identifyRootWsdls

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * Identifies WSDL documents from the {@link DOMForest}. Also identifies the root wsdl document.
 */
private void identifyRootWsdls(){
    for(String location: rootDocuments){
        Document doc = get(location);
        if(doc!=null){
            Element definition = doc.getDocumentElement();
            if(definition == null || definition.getLocalName() == null || definition.getNamespaceURI() == null)
                continue;
            if(definition.getNamespaceURI().equals(WSDLConstants.NS_WSDL) && definition.getLocalName().equals("definitions")){
                rootWsdls.add(location);
                //set the root wsdl at this point. Root wsdl is one which has wsdl:service in it
                NodeList nl = definition.getElementsByTagNameNS(WSDLConstants.NS_WSDL, "service");

                //TODO:what if there are more than one wsdl with wsdl:service element. Probably such cases
                //are rare and we will take any one of them, this logic should still work
                if(nl.getLength() > 0)
                    rootWSDL = location;
            }
        }
    }
    //no wsdl with wsdl:service found, throw error
    if(rootWSDL == null){
        StringBuilder strbuf = new StringBuilder();
        for(String str : rootWsdls){
            strbuf.append(str);
            strbuf.append('\n');
        }
        errorReceiver.error(null, WsdlMessages.FAILED_NOSERVICE(strbuf.toString()));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:MetadataFinder.java

示例11: createElementStep

import org.w3c.dom.Element; //导入方法依赖的package包/类
private static Step createElementStep(Sequence mainSequence, Object parent, Element element) throws EngineException {
	Step step = null;
	if (element != null) {
		if (parent != null) {
			String occurs = element.getAttribute("maxOccurs");//element.getAttribute(xsd.getXmlGenerationDescription().getOccursAttribute());
			if (!occurs.equals("")) {
				if (occurs.equals("unbounded"))
					occurs = "10";
				if (Long.parseLong(occurs, 10) > 1) {
					parent = createIteratorStep(mainSequence, parent, element);
				}
			}
		}
		
		String tagName = element.getTagName();
		String localName = element.getLocalName();
		String elementNodeName = (localName == null) ? tagName:localName;
		Node firstChild = element.getFirstChild();
		boolean isComplex = ((firstChild != null) && (firstChild.getNodeType() != Node.TEXT_NODE));
		
		if (isComplex){
			step = new XMLComplexStep();
			((XMLComplexStep)step).setNodeName(elementNodeName);
		}
		else {
			step = new XMLElementStep();
			((XMLElementStep)step).setNodeName(elementNodeName);
		}
		step.bNew = true;
		addStepToParent(mainSequence, parent, step);
	}
	return step;
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:34,代码来源:StepUtils.java

示例12: buildObject

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
public XMLObjectType buildObject(Element element) {
    XMLObjectType xmlObject;

    String localName = element.getLocalName();
    String nsURI = element.getNamespaceURI();
    String nsPrefix = element.getPrefix();
    QName schemaType = XMLHelper.getXSIType(element);

    xmlObject = buildObject(nsURI, localName, nsPrefix, schemaType);

    return xmlObject;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:AbstractXMLObjectBuilder.java

示例13: DOMKeyInfo

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * Creates a <code>DOMKeyInfo</code> from XML.
 *
 * @param kiElem KeyInfo element
 */
public DOMKeyInfo(Element kiElem, XMLCryptoContext context,
                  Provider provider)
    throws MarshalException
{
    // get Id attribute, if specified
    Attr attr = kiElem.getAttributeNodeNS(null, "Id");
    if (attr != null) {
        id = attr.getValue();
        kiElem.setIdAttributeNode(attr, true);
    } else {
        id = null;
    }

    // get all children nodes
    NodeList nl = kiElem.getChildNodes();
    int length = nl.getLength();
    if (length < 1) {
        throw new MarshalException
            ("KeyInfo must contain at least one type");
    }
    List<XMLStructure> content = new ArrayList<XMLStructure>(length);
    for (int i = 0; i < length; i++) {
        Node child = nl.item(i);
        // ignore all non-Element nodes
        if (child.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }
        Element childElem = (Element)child;
        String localName = childElem.getLocalName();
        if (localName.equals("X509Data")) {
            content.add(new DOMX509Data(childElem));
        } else if (localName.equals("KeyName")) {
            content.add(new DOMKeyName(childElem));
        } else if (localName.equals("KeyValue")) {
            content.add(DOMKeyValue.unmarshal(childElem));
        } else if (localName.equals("RetrievalMethod")) {
            content.add(new DOMRetrievalMethod(childElem,
                                               context, provider));
        } else if (localName.equals("PGPData")) {
            content.add(new DOMPGPData(childElem));
        } else { //may be MgmtData, SPKIData or element from other namespace
            content.add(new javax.xml.crypto.dom.DOMStructure((childElem)));
        }
    }
    keyInfoTypes = Collections.unmodifiableList(content);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:52,代码来源:DOMKeyInfo.java

示例14: getFirstDetailEntryName

import org.w3c.dom.Element; //导入方法依赖的package包/类
private static @NotNull QName getFirstDetailEntryName(@NotNull Element entry) {
    return new QName(entry.getNamespaceURI(), entry.getLocalName());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:SOAPFaultBuilder.java

示例15: parseComparator

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * Parse &lt;comparator&gt; element.
 * 
 * @param element
 * @param context
 * @param builder
 */
protected void parseComparator(Element element, ParserContext context, BeanDefinitionBuilder builder) {
	boolean hasComparatorRef = element.hasAttribute(INLINE_COMPARATOR_REF);

	// check nested comparator
	Element comparatorElement = DomUtils.getChildElementByTagName(element, NESTED_COMPARATOR);

	Object nestedComparator = null;

	// comparator definition present
	if (comparatorElement != null) {
		// check duplicate nested and inline bean definition
		if (hasComparatorRef)
			context.getReaderContext().error(
					"nested comparator declaration is not allowed if " + INLINE_COMPARATOR_REF
							+ " attribute has been specified", comparatorElement);

		NodeList nl = comparatorElement.getChildNodes();

		// take only elements
		for (int i = 0; i < nl.getLength(); i++) {
			Node nd = nl.item(i);
			if (nd instanceof Element) {
				Element beanDef = (Element) nd;
				String name = beanDef.getLocalName();
				// check if we have a 'natural' tag (known comparator
				// definitions)
				if (NATURAL.equals(name))
					nestedComparator = parseNaturalComparator(beanDef);
				else
					// we have a nested definition
					nestedComparator = parsePropertySubElement(context, beanDef, builder.getBeanDefinition());
			}
		}

		// set the reference to the nested comparator reference
		if (nestedComparator != null)
			builder.addPropertyValue(COMPARATOR_PROPERTY, nestedComparator);
	}

	// set collection type
	// based on the existence of the comparator
	// we treat the case where the comparator is natural which means the
	// comparator
	// instance is null however, we have to force a sorted collection to be
	// used
	// so that the object natural ordering is used.

	if (comparatorElement != null || hasComparatorRef) {
		if (CollectionType.LIST.equals(collectionType())) {
			builder.addPropertyValue(COLLECTION_TYPE_PROP, CollectionType.SORTED_LIST);
		}

		if (CollectionType.SET.equals(collectionType())) {
			builder.addPropertyValue(COLLECTION_TYPE_PROP, CollectionType.SORTED_SET);
		}
	} else {
		builder.addPropertyValue(COLLECTION_TYPE_PROP, collectionType());
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:67,代码来源:CollectionBeanDefinitionParser.java


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