You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{DOMImplementation,XMLSerializer}from"@xmldom/xmldom";import{ZenmlParser}from"@zenml/zenml";constparser=newZenmlParser(newDOMImplementation(),{// create a parserspecialElementNames: {brace: "brace",// name for brace elementsbracket: "bracket",// name for bracketr elementsslash: "slash"// name for slash elements}});constzenmlString="\\element<text>"// some ZenML stringconstdocument=parser.parse(zenmlString);// parse it to get the XML document object// use the usual XML serializer if you need the XML stringconstserializer=newXMLSerializer();constxmlString=serializer.serializeToString(document);
Serialising an XML document in ZenML format
import{DOMImplementation,DOMParser}from"@xmldom/xmldom";import{ZenmlSerializer}from"@zenml/zenml";constserializer=newZenmlSerializer();// create a serialiser// use the usual XML parser to get an XML document objectconstxmlString="<element>text</element>";// some XML stringconstparser=newDOMParser();constdocument=parser.parseFromString(xmlString,"text/xml");constzenmlString=serializer.serialize(document);// serialise the document in ZenML format