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


Java DOMUtilities.getPrefix方法代码示例

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


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

示例1: AbstractElementNS

import org.apache.batik.dom.util.DOMUtilities; //导入方法依赖的package包/类
/**
 * Creates a new AbstractElementNS object.
 * @param nsURI The element namespace URI.
 * @param qname The element qualified name for validation purposes.
 * @param owner The owner document.
 * @exception DOMException
 *    INVALID_CHARACTER_ERR: Raised if the specified qualified name 
 *   contains an illegal character.
 *   <br> NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is 
 *   malformed, if the <code>qualifiedName</code> has a prefix and the 
 *   <code>namespaceURI</code> is <code>null</code> or an empty string, 
 *   or if the <code>qualifiedName</code> has a prefix that is "xml" and 
 *   the <code>namespaceURI</code> is different from 
 *   "http://www.w3.org/XML/1998/namespace"  .
 */
protected AbstractElementNS(String nsURI, String qname,
                            AbstractDocument owner)
    throws DOMException {
    super(qname, owner);
    if (nsURI != null && nsURI.length() == 0) {
        nsURI = null;
    }
    namespaceURI = nsURI;
    String prefix = DOMUtilities.getPrefix(qname);
    if (prefix != null) {
        if (nsURI == null ||
            ("xml".equals(prefix) &&
             !XMLSupport.XML_NAMESPACE_URI.equals(nsURI))) {
            throw createDOMException
                (DOMException.NAMESPACE_ERR,
                 "namespace.uri",
                 new Object[] { new Integer(getNodeType()),
                                getNodeName(),
                                nsURI });
        }
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:38,代码来源:AbstractElementNS.java

示例2: updateElementAttributes

import org.apache.batik.dom.util.DOMUtilities; //导入方法依赖的package包/类
/**
 * Replaces all of the attributes of the given element with the referent
 * element's attributes.
 *
 * @param elem
 *            The element whose attributes should be replaced
 * @param referentElement
 *            The referentElement to copy the attributes from
 */
private void updateElementAttributes(Element elem, Element referentElement) {
    // Remove all element attributes
    removeAttributes(elem);

    // Copy all attributes from the referent element to the given element
    NamedNodeMap newNodeMap = referentElement.getAttributes();
    for (int i = newNodeMap.getLength() - 1; i >= 0; i--) {
        Node newAttr = newNodeMap.item(i);
        String qualifiedName = newAttr.getNodeName();
        String attributeValue = newAttr.getNodeValue();
        String prefix = DOMUtilities.getPrefix(qualifiedName);
        String namespaceURI = getNamespaceURI(prefix);
        elem.setAttributeNS(namespaceURI, qualifiedName, attributeValue);
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:25,代码来源:NodePickerPanel.java

示例3: actionPerformed

import org.apache.batik.dom.util.DOMUtilities; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
    if (getMode() == VIEW_MODE) {
        enterEditMode();
    }
    // Find the contextElement
    Element contextElement = clonedElement;
    if (getMode() == ADD_NEW_ELEMENT) {
        contextElement = previewElement;
    }
    DefaultTableModel model =
        (DefaultTableModel) attributesTable.getModel();
    int[] selectedRows = attributesTable.getSelectedRows();
    for (int i = 0; i < selectedRows.length; i++) {
        String attrName = (String) model.getValueAt(selectedRows[i], 0);
        if (attrName != null) {
            String prefix = DOMUtilities.getPrefix(attrName);
            String localName = DOMUtilities.getLocalName(attrName);
            String namespaceURI = getNamespaceURI(prefix);
            contextElement.removeAttributeNS(namespaceURI, localName);
        }
    }
    shouldProcessUpdate = false;
    updateAttributesTable(contextElement);
    shouldProcessUpdate = true;
    updateNodeXmlArea(contextElement);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:27,代码来源:NodePickerPanel.java

示例4: addScriptingListenersOn

import org.apache.batik.dom.util.DOMUtilities; //导入方法依赖的package包/类
/**
 * Adds the scripting listeners to the given element.
 */
protected void addScriptingListenersOn(Element elt) {
    String eltNS = elt.getNamespaceURI();
    String eltLN = elt.getLocalName();
    if (SVGConstants.SVG_NAMESPACE_URI.equals(eltNS)
            && SVG12Constants.SVG_HANDLER_TAG.equals(eltLN)) {
        // For this 'handler' element, add a handler for the given
        // event type.
        AbstractElement tgt = (AbstractElement) elt.getParentNode();
        String eventType = elt.getAttributeNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI,
             XMLConstants.XML_EVENTS_EVENT_ATTRIBUTE);
        String eventNamespaceURI = XMLConstants.XML_EVENTS_NAMESPACE_URI;
        if (eventType.indexOf(':') != -1) {
            String prefix = DOMUtilities.getPrefix(eventType);
            eventType = DOMUtilities.getLocalName(eventType);
            eventNamespaceURI
                = ((AbstractElement) elt).lookupNamespaceURI(prefix);
        }

        EventListener listener = new HandlerScriptingEventListener
            (eventNamespaceURI, eventType, (AbstractElement) elt);
        tgt.addEventListenerNS
            (eventNamespaceURI, eventType, listener, false, null);
        if (handlerScriptingListeners == null) {
            handlerScriptingListeners = new TriplyIndexedTable();
        }
        handlerScriptingListeners.put
            (eventNamespaceURI, eventType, elt, listener);
    }

    super.addScriptingListenersOn(elt);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:36,代码来源:SVG12ScriptingEnvironment.java

示例5: removeScriptingListenersOn

import org.apache.batik.dom.util.DOMUtilities; //导入方法依赖的package包/类
/**
 * Removes the scripting listeners from the given element.
 */
protected void removeScriptingListenersOn(Element elt) {
    String eltNS = elt.getNamespaceURI();
    String eltLN = elt.getLocalName();
    if (SVGConstants.SVG_NAMESPACE_URI.equals(eltNS)
            && SVG12Constants.SVG_HANDLER_TAG.equals(eltLN)) {
        // For this 'handler' element, remove the handler for the given
        // event type.
        AbstractElement tgt = (AbstractElement) elt.getParentNode();
        String eventType = elt.getAttributeNS
            (XMLConstants.XML_EVENTS_NAMESPACE_URI,
             XMLConstants.XML_EVENTS_EVENT_ATTRIBUTE);
        String eventNamespaceURI = XMLConstants.XML_EVENTS_NAMESPACE_URI;
        if (eventType.indexOf(':') != -1) {
            String prefix = DOMUtilities.getPrefix(eventType);
            eventType = DOMUtilities.getLocalName(eventType);
            eventNamespaceURI
                = ((AbstractElement) elt).lookupNamespaceURI(prefix);
        }

        EventListener listener =
            (EventListener) handlerScriptingListeners.put
                (eventNamespaceURI, eventType, elt, null);
        tgt.removeEventListenerNS
            (eventNamespaceURI, eventType, listener, false);
    }

    super.removeScriptingListenersOn(elt);
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:32,代码来源:SVG12ScriptingEnvironment.java

示例6: AbstractAttrNS

import org.apache.batik.dom.util.DOMUtilities; //导入方法依赖的package包/类
/**
 * Creates a new Attr object.
 * @param nsURI The element namespace URI.
 * @param qname The attribute qualified name for validation purposes.
 * @param owner The owner document.
 * @exception DOMException
 *    INVALID_CHARACTER_ERR: Raised if the specified qualified name 
 *   contains an illegal character.
 *   <br> NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is 
 *   malformed, if the <code>qualifiedName</code> has a prefix and the 
 *   <code>namespaceURI</code> is <code>null</code> or an empty string, 
 *   if the <code>qualifiedName</code> has a prefix that is "xml" and the 
 *   <code>namespaceURI</code> is different from 
 *   "http://www.w3.org/XML/1998/namespace", if the 
 *   <code>qualifiedName</code> has a prefix that is "xmlns" and the 
 *   <code>namespaceURI</code> is different from 
 *   "http://www.w3.org/2000/xmlns/", or if the <code>qualifiedName</code>
 *    is "xmlns" and the <code>namespaceURI</code> is different from 
 *   "http://www.w3.org/2000/xmlns/".
 */
protected AbstractAttrNS(String nsURI,
                         String qname,
                         AbstractDocument owner)
    throws DOMException {
    super(qname, owner);
    if (nsURI != null && nsURI.length() == 0) {
        nsURI = null;
    }
    namespaceURI = nsURI;
    String prefix = DOMUtilities.getPrefix(qname);
    if (!owner.getStrictErrorChecking()) {
        return;
    }
    if (prefix != null) {
        if (nsURI == null ||
            ("xml".equals(prefix) &&
             !XMLSupport.XML_NAMESPACE_URI.equals(nsURI)) ||
            ("xmlns".equals(prefix) &&
             !XMLSupport.XMLNS_NAMESPACE_URI.equals(nsURI))) {
            throw createDOMException
                (DOMException.NAMESPACE_ERR,
                 "namespace.uri",
                 new Object[] { new Integer(getNodeType()),
                                getNodeName(),
                                nsURI });
        }
    } else if ("xmlns".equals(qname) &&
               !XMLSupport.XMLNS_NAMESPACE_URI.equals(nsURI)) {
        throw createDOMException(DOMException.NAMESPACE_ERR,
                                 "namespace.uri",
                                 new Object[] { new Integer(getNodeType()),
                                                getNodeName(),
                                                nsURI });
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:56,代码来源:AbstractAttrNS.java

示例7: removeAttributes

import org.apache.batik.dom.util.DOMUtilities; //导入方法依赖的package包/类
/**
 * Replaces all of the atributes of a given element with the values from the
 * given table model.
 *
 * @param element
 *            The node whose attributes should update
 * @param tableModel
 *            The tableModel from which to get attributes
 */
private void updateElementAttributes
        (Element element, AttributesTableModel tableModel) {

    // Remove all element attributes
    removeAttributes(element);

    // Copy all the attribute name - value pairs from the table model to
    // the given element
    for (int i = 0; i < tableModel.getRowCount(); i++) {
        String newAttrName = (String) tableModel.getAttrNameAt(i);
        String newAttrValue = (String) tableModel.getAttrValueAt(i);
        if (newAttrName != null && newAttrName.length() > 0) {
            String namespaceURI;
            if (newAttrName.equals(XMLConstants.XMLNS_PREFIX)) {
                namespaceURI = XMLConstants.XMLNS_NAMESPACE_URI;
            } else {
                String prefix = DOMUtilities.getPrefix(newAttrName);
                namespaceURI = getNamespaceURI(prefix);
            }
            if (newAttrValue != null) {
                element.setAttributeNS
                    (namespaceURI, newAttrName, newAttrValue);
            } else {
                element.setAttributeNS(namespaceURI, newAttrName, "");
            }
        }
    }
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:38,代码来源:NodePickerPanel.java

示例8: getElementNamespaceURI

import org.apache.batik.dom.util.DOMUtilities; //导入方法依赖的package包/类
/**
 * Returns the namspace URI of elements this definition will bind.
 */
public String getElementNamespaceURI() {
    String qname = getAttributeNS(null, XBL_ELEMENT_ATTRIBUTE);
    String prefix = DOMUtilities.getPrefix(qname);
    String ns = lookupNamespaceURI(prefix);
    if (ns == null) {
        throw createDOMException
                    (DOMException.NAMESPACE_ERR,
                     "prefix",
                     new Object[] { new Integer(getNodeType()),
                                    getNodeName(),
                                    prefix });
    }
    return ns;
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:18,代码来源:XBLOMDefinitionElement.java

示例9: getPrefix

import org.apache.batik.dom.util.DOMUtilities; //导入方法依赖的package包/类
/**
 * <b>DOM</b>: Implements {@link org.w3c.dom.Node#getPrefix()}.
 */
public String getPrefix() {
    return (getNamespaceURI() == null)
        ? null
        : DOMUtilities.getPrefix(getNodeName());
}
 
开发者ID:git-moss,项目名称:Push2Display,代码行数:9,代码来源:AbstractNode.java


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