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


Java Element.getPrefix方法代码示例

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


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

示例1: getQName

import org.w3c.dom.Element; //导入方法依赖的package包/类
public static QName getQName(Element el, WSDLComponentBase context) {
    String namespace = el.getNamespaceURI();
    String prefix = el.getPrefix();
    if (namespace == null && context != null) {
        namespace = context.lookupNamespaceURI(prefix);
    }
    String localName = el.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,代码来源:Util.java

示例2: 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

示例3: getQName

import org.w3c.dom.Element; //导入方法依赖的package包/类
private static QName getQName(Element element, SettingsComponentImpl 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,代码来源:SettingsComponentFactoryImpl.java

示例4: addParameters

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * Adds the specified parameters to the xsl template as variables within the alfresco namespace.
 * 
 * @param xsltModel
 *            the variables to place within the xsl template
 * @param xslTemplate
 *            the xsl template
 */
protected void addParameters(final XSLTemplateModel xsltModel, final Document xslTemplate)
{
    final Element docEl = xslTemplate.getDocumentElement();
    final String XSL_NS = docEl.getNamespaceURI();
    final String XSL_NS_PREFIX = docEl.getPrefix();

    for (Map.Entry<QName, Object> e : xsltModel.entrySet())
    {
        if (ROOT_NAMESPACE.equals(e.getKey()))
        {
            continue;
        }
        final Element el = xslTemplate.createElementNS(XSL_NS, XSL_NS_PREFIX + ":variable");
        el.setAttribute("name", e.getKey().toPrefixString());
        final Object o = e.getValue();
        if (o instanceof String || o instanceof Number || o instanceof Boolean)
        {
            el.appendChild(xslTemplate.createTextNode(o.toString()));
            // ALF-15413. Add the variables at the end of the list of children
            docEl.insertBefore(el, null);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:32,代码来源:XSLTProcessor.java

示例5: addAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
private void addAttributes(Element e, NamedNodeMap attrs) {
    if(attrs == null)
        return;
    String elPrefix = e.getPrefix();
    for(int i=0; i < attrs.getLength();i++) {
        Attr a = (Attr)attrs.item(i);
        //check if attr is ns declaration
        if("xmlns".equals(a.getPrefix()) || "xmlns".equals(a.getLocalName())) {
            if(elPrefix == null && a.getLocalName().equals("xmlns")) {
                // the target element has already default ns declaration, dont' override it
                continue;
            } else if(elPrefix != null && "xmlns".equals(a.getPrefix()) && elPrefix.equals(a.getLocalName())) {
                //dont bind the prefix to ns again, its already in the target element.
                continue;
            }
            e.setAttributeNS(a.getNamespaceURI(),a.getName(),a.getValue());
            continue;
        }
        e.setAttributeNS(a.getNamespaceURI(),a.getName(),a.getValue());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:SAAJMessage.java

示例6: toQName

import org.w3c.dom.Element; //导入方法依赖的package包/类
public static QName toQName(Element element) {
    String namespace = element.getNamespaceURI();
    if (namespace == null) {
        return new QName(SardineUtil.DEFAULT_NAMESPACE_URI,
                element.getLocalName(),
                SardineUtil.DEFAULT_NAMESPACE_PREFIX);
    } else if (element.getPrefix() == null) {
        return new QName(element.getNamespaceURI(),
                element.getLocalName());
    } else {
        return new QName(element.getNamespaceURI(),
                element.getLocalName(),
                element.getPrefix());
    }

}
 
开发者ID:thegrizzlylabs,项目名称:sardine-android,代码行数:17,代码来源:SardineUtil.java

示例7: getPayloadQName

import org.w3c.dom.Element; //导入方法依赖的package包/类
QName getPayloadQName() {
    if (staxBridge != null) {
            return staxBridge.getPayloadQName();
    } else {
        //not lazy - Just get first child element and return its name
        Element elem = getFirstChildElement();
        if (elem != null) {
            String ns = elem.getNamespaceURI();
            String pref = elem.getPrefix();
            String local = elem.getLocalName();
            if (pref != null) return new QName(ns, local, pref);
            if (ns != null) return new QName(ns, local);
            return new QName(local);
        }
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:BodyImpl.java

示例8: ensurePrefixDeclaredFor

import org.w3c.dom.Element; //导入方法依赖的package包/类
private void ensurePrefixDeclaredFor(Element newComponentElement, String newComponentNS) {
    String existingPrefix = lookupPrefix(newComponentNS);
    String prefix = newComponentElement.getPrefix();
    if (existingPrefix == null) {
        if (prefix == null) {
            prefix = "ns"; //NOI18N
        }
        prefix = ensureUnique(prefix, newComponentNS);
        ((AbstractDocumentComponent)getModel().getRootComponent()).
                addPrefix(prefix, newComponentNS);
        newComponentElement.setPrefix(prefix);
    } else {
        newComponentElement.setPrefix(existingPrefix);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:AbstractDocumentComponent.java

示例9: 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

示例10: unmarshall

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
public Signature unmarshall(Element signatureElement) throws UnmarshallingException {
    log.debug("Starting to unmarshall Apache XML-Security-based SignatureImpl element");

    SignatureImpl signature = new SignatureImpl(signatureElement.getNamespaceURI(),
            signatureElement.getLocalName(), signatureElement.getPrefix());

    try {
        log.debug("Constructing Apache XMLSignature object");

        XMLSignature xmlSignature = new XMLSignature(signatureElement, "");

        SignedInfo signedInfo = xmlSignature.getSignedInfo();

        log.debug("Adding canonicalization and signing algorithms, and HMAC output length to Signature");
        signature.setCanonicalizationAlgorithm(signedInfo.getCanonicalizationMethodURI());
        signature.setSignatureAlgorithm(signedInfo.getSignatureMethodURI());
        signature.setHMACOutputLength(getHMACOutputLengthValue(signedInfo.getSignatureMethodElement()));

        org.apache.xml.security.keys.KeyInfo xmlSecKeyInfo = xmlSignature.getKeyInfo();
        if (xmlSecKeyInfo != null) {
            log.debug("Adding KeyInfo to Signature");
            Unmarshaller unmarshaller = Configuration.getUnmarshallerFactory().getUnmarshaller(
                    xmlSecKeyInfo.getElement());
            KeyInfo keyInfo = (KeyInfo) unmarshaller.unmarshall(xmlSecKeyInfo.getElement());
            signature.setKeyInfo(keyInfo);
        }
        signature.setXMLSignature(xmlSignature);
        signature.setDOM(signatureElement);
        return signature;
    } catch (XMLSecurityException e) {
        log.error("Error constructing Apache XMLSignature instance from Signature element: {}", e.getMessage());
        throw new UnmarshallingException("Unable to unmarshall Signature with Apache XMLSignature", e);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:SignatureUnmarshaller.java

示例11: isValidDataFile

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** Indica si los datos son una factura electr&oacute;nica.
    * Importante: El que los datos sean una factura electr&oacute;nica no implica que puedan ser firmados, si esta
    * ya est&aacute; firmada el a&ntilde;adido de una firma adicional invalidar&iacute;a la factura
    * @param is Datos a comprobar
    * @return <code>true</code> si los datos son una <a href="http://www.facturae.es/">factura electr&oacute;nica</a>,
    *         <code>false</code> en caso contrario */
   @Override
public boolean isValidDataFile(final byte[] is) {
       if (is == null || is.length == 0) {
           return false;
       }
       final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
       dbf.setNamespaceAware(true);

       try {
           final Document doc = dbf.newDocumentBuilder().parse(new ByteArrayInputStream(is));
           final Element rootNode = doc.getDocumentElement();
           final String rootNodePrefix = rootNode.getPrefix();

           if (!((rootNodePrefix != null ? rootNodePrefix + ":" : "") + "Facturae").equals(rootNode.getNodeName())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
               return false;
           }

           final Set<String> childs = new HashSet<String>(3);
           childs.add("FileHeader"); //$NON-NLS-1$
           childs.add("Parties"); //$NON-NLS-1$
           childs.add("Invoices"); //$NON-NLS-1$

           final NodeList nl = rootNode.getChildNodes();
           for (int i=0;i<nl.getLength();i++) {
               final String nodeName = nl.item(i).getNodeName();
               if (childs.contains(nodeName)) {
                   childs.remove(nodeName);
               }
           }
           if (childs.size() > 0) {
               return false;
           }

       }
       catch (final Exception e) {
           return false;
       }
       return true;
   }
 
开发者ID:MiFirma,项目名称:mi-firma-android,代码行数:46,代码来源:AOFacturaETriPhaseSigner.java

示例12: createElement

import org.w3c.dom.Element; //导入方法依赖的package包/类
public static Element createElement(final Document document, final String qName, final Optional<String> namespaceURI) {
    if(namespaceURI.isPresent()) {
        final Element element = document.createElementNS(namespaceURI.get(), qName);
        String name = XMLNS_ATTRIBUTE_KEY;
        if(element.getPrefix() != null) {
            name += ":" + element.getPrefix();
        }
        element.setAttributeNS(XMLNS_URI, name, namespaceURI.get());
        return element;
    }
    return document.createElement(qName);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:XmlUtil.java

示例13: copyElementName

import org.w3c.dom.Element; //导入方法依赖的package包/类
public static Name copyElementName(Element element) {
    String localName = element.getLocalName();
    String prefix = element.getPrefix();
    String uri = element.getNamespaceURI();
    return create(localName, prefix, uri);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:7,代码来源:NameImpl.java

示例14: createElement

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * Create element wrapper for existing DOM element.
 *
 * @param ownerDocument SOAP document wrapper not null
 * @param element DOM element not null
 * @return SOAP wrapper for DOM element
 */
public static SOAPElement createElement(SOAPDocumentImpl ownerDocument, Element element) {
    Objects.requireNonNull(ownerDocument);
    Objects.requireNonNull(element);

    String localName = element.getLocalName();
    String namespaceUri = element.getNamespaceURI();
    String prefix = element.getPrefix();

    if ("Envelope".equalsIgnoreCase(localName)) {
        if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
            return new Envelope1_1Impl(ownerDocument, element);
        } else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
            return new Envelope1_2Impl(ownerDocument, element);
        }
    }
    if ("Body".equalsIgnoreCase(localName)) {
        if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
            return new Body1_1Impl(ownerDocument, element);
        } else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
            return new Body1_2Impl(ownerDocument, element);
        }
    }
    if ("Header".equalsIgnoreCase(localName)) {
        if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
            return new Header1_1Impl(ownerDocument, element);
        } else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
            return new Header1_2Impl(ownerDocument, element);
        }
    }
    if ("Fault".equalsIgnoreCase(localName)) {
        if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
            return new Fault1_1Impl(ownerDocument, element);
        } else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
            return new Fault1_2Impl(ownerDocument, element);
        }

    }
    if ("Detail".equalsIgnoreCase(localName)) {
        if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
            return new Detail1_1Impl(ownerDocument, element);
        } else if (NameImpl.SOAP12_NAMESPACE.equals(namespaceUri)) {
            return new Detail1_2Impl(ownerDocument, element);
        }
    }
    if ("faultcode".equalsIgnoreCase(localName)
            || "faultstring".equalsIgnoreCase(localName)
            || "faultactor".equalsIgnoreCase(localName)) {
        // SOAP 1.2 does not have fault(code/string/actor)
        // So there is no else case required
        if (NameImpl.SOAP11_NAMESPACE.equals(namespaceUri)) {
            return new FaultElement1_1Impl(ownerDocument,
                    localName,
                    prefix);
        }
    }

    return new ElementImpl(ownerDocument, element);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:66,代码来源:ElementFactory.java


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