public String getAttribute(String namespace, String name) { if (currentNode == null) { return null; } Element element = (Element) currentNode; if (element.hasAttributeNS(namespace, name)) { return element.getAttributeNS(namespace, name).trim(); } else if (applicationNamespace.equals(namespace) && element.hasAttributeNS(AttributeResource.RES_AUTO_NS_URI, name)) { return element.getAttributeNS(AttributeResource.RES_AUTO_NS_URI, name).trim(); } return null; }
protected void namespace(Element element, String prefix, String uri) { String qname; if ("".equals(prefix) || prefix == null) { qname = "xmlns"; } else { qname = "xmlns:" + prefix; } // older version of Xerces (I confirmed that the bug is gone with Xerces 2.4.0) // have a problem of re-setting the same namespace attribute twice. // work around this bug removing it first. if (element.hasAttributeNS("http://www.w3.org/2000/xmlns/", qname)) { // further workaround for an old Crimson bug where the removeAttribtueNS // method throws NPE when the element doesn't have any attribute. // to be on the safe side, check the existence of attributes before // attempting to remove it. // for details about this bug, see org.apache.crimson.tree.ElementNode2 // line 540 or the following message: // https://jaxb.dev.java.net/servlets/ReadMsg?list=users&msgNo=2767 element.removeAttributeNS("http://www.w3.org/2000/xmlns/", qname); } // workaround until here element.setAttributeNS("http://www.w3.org/2000/xmlns/", qname, uri); }
public void handleElement(Element el) { EventTarget target = this.target.get(); if (el.hasAttribute("Id")) { el.setIdAttribute("Id", true); } setListener(target, this, false); if (OO_DIGSIG_NS.equals(el.getNamespaceURI())) { String parentNS = el.getParentNode().getNamespaceURI(); if (!OO_DIGSIG_NS.equals(parentNS) && !el.hasAttributeNS(XML_NS, "mdssi")) { el.setAttributeNS(XML_NS, "xmlns:mdssi", OO_DIGSIG_NS); } } setPrefix(el); setListener(target, this, true); }
continue; if (childElement.hasAttributeNS(namespaceNs, currentAttr.getLocalName())) { continue;
public boolean hasAttribute(String namespaceUri, String localName) { synchronized(document) { return element.hasAttributeNS(namespaceUri, localName); } }
public static void deleteAttr(Element e, String namespaceURI, String localName) { if (e.hasAttributeNS(namespaceURI, localName)) e.removeAttributeNS(namespaceURI, localName); }
protected String getUnusedGenericNsPrefix() { synchronized(document) { Element documentElement = document.getDocumentElement(); if (documentElement == null) { return GENERIC_NS_PREFIX + "0"; } else { for (int i = 0; i < Integer.MAX_VALUE; i++) { if (!documentElement.hasAttributeNS(XMLNS_ATTRIBUTE_NS_URI, GENERIC_NS_PREFIX + i)) { return GENERIC_NS_PREFIX + i; } } throw new ModelException("Unable to find an unused namespace prefix"); } } }
protected void namespace(Element element, String prefix, String uri) { String qname; if ("".equals(prefix) || prefix == null) { qname = "xmlns"; } else { qname = "xmlns:" + prefix; } // older version of Xerces (I confirmed that the bug is gone with Xerces 2.4.0) // have a problem of re-setting the same namespace attribute twice. // work around this bug removing it first. if (element.hasAttributeNS("http://www.w3.org/2000/xmlns/", qname)) { // further workaround for an old Crimson bug where the removeAttribtueNS // method throws NPE when the element doesn't have any attribute. // to be on the safe side, check the existence of attributes before // attempting to remove it. // for details about this bug, see org.apache.crimson.tree.ElementNode2 // line 540 or the following message: // https://jaxb.dev.java.net/servlets/ReadMsg?list=users&msgNo=2767 element.removeAttributeNS("http://www.w3.org/2000/xmlns/", qname); } // workaround until here element.setAttributeNS("http://www.w3.org/2000/xmlns/", qname, uri); }
private Row readRow(Element row) throws DOMException, FHIRException { Row res = new Row(); int ndx = 1; NodeList cells = row.getElementsByTagNameNS(XLS_NS, "Cell"); for (int i = 0; i < cells.getLength(); i++) { Element cell = (Element) cells.item(i); if (cell.hasAttributeNS(XLS_NS, "Index")) { int index = Integer.parseInt(cell.getAttributeNS(XLS_NS, "Index")); while (ndx < index) { res.add(""); ndx++; } } res.add(readData(cell, ndx, res.size() > 0 ? res.get(0) : "?")); ndx++; } return res; }
private Row readRow(Element row) throws DOMException, FHIRException { Row res = new Row(); int ndx = 1; NodeList cells = row.getElementsByTagNameNS(XLS_NS, "Cell"); for (int i = 0; i < cells.getLength(); i++) { Element cell = (Element) cells.item(i); if (cell.hasAttributeNS(XLS_NS, "Index")) { int index = Integer.parseInt(cell.getAttributeNS(XLS_NS, "Index")); while (ndx < index) { res.add(""); ndx++; } } res.add(readData(cell, ndx, res.size() > 0 ? res.get(0) : "?")); ndx++; } return res; }
private String extractSystemPropertiesAttribute(Element element) { for (String uri : EXT_URIS) { if (element.hasAttributeNS(uri, SYSTEM_PROPERTIES_ATTRIBUTE)) { return element.getAttributeNS(uri, SYSTEM_PROPERTIES_ATTRIBUTE); } } return null; }
/** {@inheritDoc} */ protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.doParse(element, parserContext, builder); builder.addConstructorArgReference(element.getAttributeNS(null, "resolver")); if (element.hasAttributeNS(null, "filter")) { builder.addPropertyReference("filteringEngine", element.getAttributeNS(null, "filter")); } } }
/** {@inheritDoc} */ protected String resolveId(Element configElement, AbstractBeanDefinition beanDefinition, ParserContext parserContext) { if(!configElement.hasAttributeNS(null, "id")){ log.warn("AttributeFilterPolicy elements should include an 'id' attribute. This is not currently required but will be in future versions."); } return getQualifiedId(configElement, configElement.getLocalName(), configElement.getAttributeNS(null, "id")); }
/** {@inheritDoc} */ protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.doParse(element, parserContext, builder); if(element.hasAttributeNS(null, "nameFormat")){ builder.addPropertyValue("nameFormat", element.getAttributeNS(null, "nameFormat")); }else{ builder.addPropertyValue("nameFormat", "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"); } builder.addPropertyValue("nameQualifier", element.getAttributeNS(null, "nameQualifier")); } }
/** {@inheritDoc} */ protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.doParse(element, parserContext, builder); builder.addPropertyValue("name", element.getAttributeNS(null, "attributeName")); if (element.hasAttributeNS(null, "attributeNameFormat")) { builder.addPropertyValue("nameFormat", element.getAttributeNS(null, "attributeNameFormat")); } } }
/** {@inheritDoc} */ protected void doParse(Element config, BeanDefinitionBuilder builder) { log.info("Parsing configuration for JSP error handler."); super.doParse(config, builder); if(config.hasAttributeNS(null, "jspPagePath")){ builder.addConstructorArgValue(config.getAttributeNS(null, "jspPagePath")); }else{ builder.addConstructorArgValue(config.getAttributeNS(null, "/error.jsp")); } }
/** {@inheritDoc} */ @Override protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext, @Nonnull final BeanDefinitionBuilder builder) { super.doParse(config, parserContext, builder); if (config.hasAttributeNS(null, NAME_FORMAT_ATTRIBUTE_NAME)) { final String nameFormat = StringSupport.trimOrNull(config.getAttributeNS(null, NAME_FORMAT_ATTRIBUTE_NAME)); builder.addPropertyValue("nameFormat", nameFormat); } builder.addPropertyValue("friendlyName", config.getAttribute(FRIENDLY_NAME_ATTRIBUTE_NAME)); }
/** {@inheritDoc} */ @Override protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext, @Nonnull final BeanDefinitionBuilder builder) { super.doParse(config, parserContext, builder); if (config.hasAttributeNS(null, NAMESPACE_ATTRIBUTE_NAME)) { final String namespace = StringSupport.trimOrNull(config.getAttributeNS(null, NAMESPACE_ATTRIBUTE_NAME)); builder.addPropertyValue("namespace", namespace); } }
/** {@inheritDoc} */ @Override protected void doNativeParse(@Nonnull final Element element, @Nonnull final ParserContext parserContext, @Nonnull final BeanDefinitionBuilder builder) { super.doParse(element, builder); builder.addPropertyValue("matchString", StringSupport.trimOrNull(element.getAttributeNS(null, "value"))); if (element.hasAttributeNS(null, "ignoreCase")) { builder.addPropertyValue("ignoreCase", StringSupport.trimOrNull(element.getAttributeNS(null, "ignoreCase"))); } } }
/** {@inheritDoc} */ protected void doParse(Element element, BeanDefinitionBuilder builder) { builder.addConstructorArgReference(DatatypeHelper.safeTrimOrNullString(element.getAttributeNS(null, "trustEngineRef"))); if (element.hasAttributeNS(null, "requireSignedMetadata")) { builder.addPropertyValue("requireSignature", XMLHelper.getAttributeValueAsBoolean(element .getAttributeNodeNS(null, "requireSignedMetadata"))); }else{ builder.addPropertyValue("requireSignature", false); } }