deal with namespace attributes. fixes #2495
This commit is contained in:
		
							parent
							
								
									3ece613a5d
								
							
						
					
					
						commit
						e973117aed
					
				|  | @ -65,11 +65,17 @@ public class XmlReader { | ||||||
| 				wakeLock.acquire(); | 				wakeLock.acquire(); | ||||||
| 				if (parser.getEventType() == XmlPullParser.START_TAG) { | 				if (parser.getEventType() == XmlPullParser.START_TAG) { | ||||||
| 					Tag tag = Tag.start(parser.getName()); | 					Tag tag = Tag.start(parser.getName()); | ||||||
|  | 					final String xmlns = parser.getNamespace(); | ||||||
| 					for (int i = 0; i < parser.getAttributeCount(); ++i) { | 					for (int i = 0; i < parser.getAttributeCount(); ++i) { | ||||||
| 						tag.setAttribute(parser.getAttributeName(i), | 						final String prefix = parser.getAttributePrefix(i); | ||||||
| 								parser.getAttributeValue(i)); | 						String name; | ||||||
|  | 						if (prefix != null && !prefix.isEmpty() && !prefix.equals(xmlns)) { | ||||||
|  | 							name = prefix+":"+parser.getAttributeName(i); | ||||||
|  | 						} else { | ||||||
|  | 							name = parser.getAttributeName(i); | ||||||
|  | 						} | ||||||
|  | 						tag.setAttribute(name,parser.getAttributeValue(i)); | ||||||
| 					} | 					} | ||||||
| 					String xmlns = parser.getNamespace(); |  | ||||||
| 					if (xmlns != null) { | 					if (xmlns != null) { | ||||||
| 						tag.setAttribute("xmlns", xmlns); | 						tag.setAttribute("xmlns", xmlns); | ||||||
| 					} | 					} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Daniel Gultsch
						Daniel Gultsch