I am using XML
I am trying to set the prefix to NS1 throught the whole document, so i used :
XmlSerializer serializer = Xml.newSerializer();
StringWriter writer = new StringWriter();
try {
serializer.setOutput(writer);
serializer.startDocument("UTF-8", true);
serializer.setPrefix("ns1", "http://ift.tt/1dosXhP");
serializer.setPrefix("xsi","http://ift.tt/ra1lAU");
serializer.startTag("ns1" , "HBA");
serializer.startTag("ns1", "TITLE");
serializer.text(cd.title);
serializer.endTag("ns1", "TITLE");
// and till the end
but when i check the XML file i see this :
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><n0:HBA xmlns:ns1="http://ift.tt/1dosXhP" xmlns:xsi="http://ift.tt/ra1lAU" xmlns:n0="ns1"><n0:TITLE></n0:TITLE>
so here as you can see the prefix is set to N0 not NS1 as i require. also the XML is writen side ways, but i would like to have every tag on a separate line :
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<ns1:HBA xmlns:ns1="http://ift.tt/1dosXhP" xmlns:xsi="http://ift.tt/ra1lAU">
<ns1:TITLE>TEXT</ns1:TITLE>
<ns1:NAME>TEXT</ns1:NAME>
No comments:
Post a Comment