/** * @inheritDoc */ public String getPrefix() { return dom.getPrefix(); }
public String getPrefix() { return this.doc.getPrefix(); }
@Override public String getPrefix() { return original_.getPrefix(); }
public String getPrefix() { return document.getPrefix(); }
public String getPrefix() { return document.getPrefix(); }
@Override public String getPrefix() { return original_.getPrefix(); }
@Override public String getPrefix() { return document.getPrefix(); }
public String getPrefix() { return document.getPrefix(); }
/** * The namespace prefix of this node, or <code>null</code> if it is unspecified. <br>Note that * setting this attribute, when permitted, changes the <code>nodeName</code> attribute, which * holds the qualified name, as well as the <code>tagName</code> and <code>name</code> * attributes of the <code>Element</code> and <code>Attr</code> interfaces, when applicable. * <br>Note also that changing the prefix of an attribute that is known to have a default value, * does not make a new attribute with the default value and the original prefix appear, since * the <code>namespaceURI</code> and <code>localName</code> do not change. <br>For nodes of any * type other than <code>ELEMENT_NODE</code> and <code>ATTRIBUTE_NODE</code> and nodes created * with a DOM Level 1 method, such as <code>createElement</code> from the <code>Document</code> * interface, this is always <code>null</code>. * * @throws DOMException INVALID_CHARACTER_ERR: Raised if the specified prefix contains an * illegal character, per the XML 1.0 specification . * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. * <br>NAMESPACE_ERR: Raised if the specified <code>prefix</code> is * malformed per the Namespaces in XML specification, if the * <code>namespaceURI</code> of this node is <code>null</code>, if the * specified prefix is "xml" and the <code>namespaceURI</code> of this node * is different from "http://www.w3.org/XML/1998/namespace", if this node * is an attribute and the specified prefix is "xmlns" and the * <code>namespaceURI</code> of this node is different from " * http://www.w3.org/2000/xmlns/", or if this node is an attribute and the * <code>qualifiedName</code> of this node is "xmlns" . * @since DOM Level 2 */ public String getPrefix() { return document.getPrefix(); }
/** * The namespace prefix of this node, or <code>null</code> if it is unspecified. <br>Note that * setting this attribute, when permitted, changes the <code>nodeName</code> attribute, which * holds the qualified name, as well as the <code>tagName</code> and <code>name</code> * attributes of the <code>Element</code> and <code>Attr</code> interfaces, when applicable. * <br>Note also that changing the prefix of an attribute that is known to have a default value, * does not make a new attribute with the default value and the original prefix appear, since * the <code>namespaceURI</code> and <code>localName</code> do not change. <br>For nodes of any * type other than <code>ELEMENT_NODE</code> and <code>ATTRIBUTE_NODE</code> and nodes created * with a DOM Level 1 method, such as <code>createElement</code> from the <code>Document</code> * interface, this is always <code>null</code>. * * @throws DOMException INVALID_CHARACTER_ERR: Raised if the specified prefix contains an * illegal character, per the XML 1.0 specification . * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. * <br>NAMESPACE_ERR: Raised if the specified <code>prefix</code> is * malformed per the Namespaces in XML specification, if the * <code>namespaceURI</code> of this node is <code>null</code>, if the * specified prefix is "xml" and the <code>namespaceURI</code> of this node * is different from "http://www.w3.org/XML/1998/namespace", if this node * is an attribute and the specified prefix is "xmlns" and the * <code>namespaceURI</code> of this node is different from " * http://www.w3.org/2000/xmlns/", or if this node is an attribute and the * <code>qualifiedName</code> of this node is "xmlns" . * @since DOM Level 2 */ public String getPrefix() { return document.getPrefix(); }
/** * Gets the XML document. * * @param is the input stream * @param request the request * @return the XML document * @throws Exception the exception */ protected Document getXmlDocument(InputStream is, Request request) throws Exception { is = preProcessHtml(request, is); is = applyXsltTransformation(request, is); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setIgnoringComments(true); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); StringWriter writer = new StringWriter(); IOUtils.copy(is, writer, StandardCharsets.UTF_8); String contents = writer.toString(); Document doc = builder.parse(IOUtils.toInputStream(contents, StandardCharsets.UTF_8)); // Ugly hack to deal with DOM & XPath 1.0's battle royale // over handling namespaces without a prefix. if(doc.getNamespaceURI() != null && doc.getPrefix() == null){ factory.setNamespaceAware(false); builder = factory.newDocumentBuilder(); doc = builder.parse(IOUtils.toInputStream(contents, StandardCharsets.UTF_8)); } return doc; }
/** * Gets the XML document. * * @param is the input stream * @param request the request * @return the XML document * @throws Exception the exception */ protected Document getXmlDocument(InputStream is, Request request) throws Exception { is = preProcessHtml(request, is); is = applyXsltTransformation(request, is); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setIgnoringComments(true); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); StringWriter writer = new StringWriter(); IOUtils.copy(is, writer, StandardCharsets.UTF_8); String contents = writer.toString(); Document doc = builder.parse(IOUtils.toInputStream(contents, StandardCharsets.UTF_8)); // Ugly hack to deal with DOM & XPath 1.0's battle royale // over handling namespaces without a prefix. if(doc.getNamespaceURI() != null && doc.getPrefix() == null){ factory.setNamespaceAware(false); builder = factory.newDocumentBuilder(); doc = builder.parse(IOUtils.toInputStream(contents, StandardCharsets.UTF_8)); } return doc; }