本文整理汇总了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");
}
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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.");
}
}
示例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);
}
}
示例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());
}
}
示例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()));
}
}
示例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;
}
示例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;
}
示例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);
}
示例14: getFirstDetailEntryName
import org.w3c.dom.Element; //导入方法依赖的package包/类
private static @NotNull QName getFirstDetailEntryName(@NotNull Element entry) {
return new QName(entry.getNamespaceURI(), entry.getLocalName());
}
示例15: parseComparator
import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
* Parse <comparator> 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());
}
}