HTML to XML Conversion ?
Developed a content presentation java servlet implmenting xmlparser2.jar classes, works well. We're storing content (in XML) format as blob, then using parser we are able to do the transformation of the xml file to HTML for presentation.
stream = null;
String result = null;
URL URLStream = new URL(xmlIn);
ByteArrayOutputStream xbaos = new ByteArrayOutputStream();
if(mStylesheet.startsWith("http"))
stream = getURLInputStream(mStylesheet);
else
stream = new FileInputStream(mStylesheet);
XSLProcessor processor = new XSLProcessor();
DOMParser parser = new DOMParser();
parser.setValidationMode(false);
parser.setPreserveWhitespace(true);
parser.parse(in);
xdoc = parser.getDocument();
XSLStylesheet xss = new XSLStylesheet(stream, URLStream);
processor.processXSL(xss, xdoc, xbaos);
result = xbaos.toString();
parser.reset();
return result; -- HTML conversion
We are evaluating using xslt to convert the XML to a form based medium for content maintenance. Wondering if once a XML document is parsed to HTML (DOM) can it be parsed back to XML for subsequent update to stored value in blob column. Specifically interested in conversion (parser) from HTML to XML
Simply can HTML (in DOM format validated against a xsd) be transformed back to XML ?