Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I get the DOCTYPE tag into the XMLDocument after its parsed?

DOCTYPE parsed xmldocument
0
Posted

How do I get the DOCTYPE tag into the XMLDocument after its parsed?

0

You need to do some preprocessing to the file( getDoctype ()), and then put it through the DOMParser again( setDoctype ()), which will produce a valid, well-formed XMLDocument with the DOCTYPE tag contained within. Here is an example: — new parser p := xmlparser.newParser; — parse dtd file xmlparser.parseDTD(p, dir || ‘/’ || dtdfile, root); dt := xmlparser.getDoctype(p); — parse input file xmlparser.setValidationMode(p, true); xmlparser.setDoctype(p, dt); xmlparser.parse(p, dir || ‘/’ || inpfile); — get document doc := xmlparser.getDocument(p); —————————————————— — Set DOCTYPE Tag —————————————————— xmldom.setDoctype(doc,’family’,’/tmp/family.dtd’,”); xmldom.writeToFile(doc, dir || ‘/’ || ‘familyout.txt’); Notes: dtdfile – varchar2 parameter for DTD File. dir – varchar2 parameter directory information inpfile – input xml file.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.