Удалить заголовок XML из XML в Java

StringWriter  writer = new StringWriter();
XmlSerializer serializer = new KXmlSerializer();
serializer.setOutput(writer);
serializer.startDocument(null, null);
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
// Creating XML

serializer.endDocument();
String xmlString = writer.toString();

In the above environment, whether there are any standard API's available to remove the XML header or do you suggest to go via string manipulation:

if (s.startsWith("<?xml ")) {
    s = s.substring(s.indexOf("?>") + 2);
}

Wanted the output in the xmlString without XML header info .

27
задан mauris 11 April 2011 в 03:20
поделиться