Hi,
I have the following
program that reads in an xml file, builds a Jdom tree and writes it out using
XMLOutputter:
import
java.util.*;
import java.io.*;
import
org.jdom.*;
import org.jdom.input.DOMBuilder;
import
org.jdom.input.SAXBuilder;
import org.jdom.output.DOMOutputter;
import
org.jdom.output.XMLOutputter;
class
TestXYZ
{
TestXYZ
{
}
public static void main( String[] args
)
{
String
fileName = null;
fileName =
args[0];
try
{
SAXBuilder saxBuilder = new
SAXBuilder();
Document jdomDocument1 = saxBuilder.build( fileName );
XMLOutputter outp = new
XMLOutputter();
outp.setTextTrim(true);
outp.setIndent("
");
outp.setNewlines(true);
outp.output( jdomDocument1, new BufferedOutputStream(new FileOutputStream(
fileName + "FromJdom.xml" )) );
}
catch(JDOMException jde)
{
jde.printStackTrace(System.err);
System.exit(1);
}
catch(IOException ioe)
{
ioe.printStackTrace(System.err);
System.exit(1);
}
} // End method main
} // End
class TestXYZ
My input xml file looks
like:
.
.
.
</rdf:RDF>
</DOC>
</RESPONSE
The input xml file contains
97 "hasRefs" elements like: <hasRefs
rdf:resource="#SMOOSH0000000053r"/>.
The output file also contains
97 "hasRefs" elements, but 50 of them come out without the "rdf:" namespace
alias:
<hasRefs
resource="#SMOOSH0000000053r"/>
Why would that
happen?
Any help would be most
appreciated,
Neil