mediarss

XML fix namespace declaration

让人想犯罪 __ 提交于 2019-12-23 03:48:08
问题 I am trying to detetct/work around this bug in RSS elements. That means I have to find a wrong namespace-declaration and change its value to the correct namespace. E.g: xmlns:media="http://search.yahoo.com/mrss" must be: xmlns:media="http://search.yahoo.com/mrss/" How can I achive that given a org.w3c.Document? I meanwile found out how to get all elements of a certain namespace: XPathFactory xpf = XPathFactory.newInstance(); XPath xpath = xpf.newXPath(); XPathExpression expr = xpath.compile("

XML fix namespace declaration

假如想象 提交于 2019-12-08 09:52:30
I am trying to detetct/work around this bug in RSS elements. That means I have to find a wrong namespace-declaration and change its value to the correct namespace. E.g: xmlns:media="http://search.yahoo.com/mrss" must be: xmlns:media="http://search.yahoo.com/mrss/" How can I achive that given a org.w3c.Document? I meanwile found out how to get all elements of a certain namespace: XPathFactory xpf = XPathFactory.newInstance(); XPath xpath = xpf.newXPath(); XPathExpression expr = xpath.compile("//*[namespace-uri()='http://search.yahoo.com/mrss']"); Object result = expr.evaluate(d, XPathConstants