Remove xml declaration using v2 Xml Api

gatsby0121gatsby0121 Member Posts: 13
Does anyone know how to remove the xml declaration from an XmlDocument class in v2 extensions (not dotnet)?

Answers

  • ftorneroftornero Member Posts: 524
    You can use this:
    XmlDoc.GetRoot(Element);   
    Element.WriteTo(varText);
    

    Where:
    XmlDoc: XmlDocument;
    Element: XmlElement;
    varText: Text;
    
  • DuikmeesterDuikmeester Member Posts: 304
    Try:
    XmlDoc.GetDeclaration(XmlDecl);
    XmlDecl.Remove;
    

    Where:
    XmlDecl: XmlDeclaration
    
  • gatsby0121gatsby0121 Member Posts: 13
    I had tried
    XmlDoc.GetDeclaration(XmlDecl);
    XmlDecl.Remove;
    

    before, and I get the error XmlNode not set, even though if I write the XmlDoc to a text and display it with Message(text), I can see the xml.
Sign In or Register to comment.