XML Transformer exclude param xml:base

juron

New Member
I am using xml transformer to transform a document object as xml file . If a xml document contains entity variable it includes extra attribute xml:base in all elements attached . Sample XML File :\[code\] <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE security [<!ENTITY attachparam SYSTEM "attach-value.xml"><!ENTITY udf SYSTEM "udfasset.xml">]><property> &attachparam;</property> \[/code\]attach-value.xml\[code\]<value regex=".+">localhost</value><value regex="^[A-Z]+">allow</value>\[/code\]Output:\[code\]<?xml version="1.0" encoding="UTF-8" standalone="no"><property> <value regex=".+" xml:base="file:///home/bharathi/attach-value.xml">localhost</value> <value regex="^[A-Z]+" xml:base="file:///home/bharathi/attach-value.xml">allow</value> </property>\[/code\]Java Code:\[code\] TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(document); String tempFile = "/home/bharathi/out.xml"; LOGGER.log(Level.INFO, "tempFile is :: " + tempFile); StreamResult result = new StreamResult(new File(tempFile)); transformer.transform(source, result);\[/code\]How can i exclude xml:base attribute when transform?
 
Back
Top