Skip to main content
1-Visitor
May 16, 2014
Question

ACL code not working

  • May 16, 2014
  • 2 replies
  • 1669 views

Using acl scripting in Arbortext Editor 6, How can an sgml file be opened and then save it as xml?

The doc_open method below returns a document identifier.

Providing this document identifier to the doc_save function saves an empty xml file.

Sample ACL Code:

#Open a sgml file

#0x200 - Open the document without loading a stylesheet.

$sgml_doc = doc_open("file.sgml", 0x200)

#save as xml

#0x0020 - Write the document as an XML document

doc_save($sgml_doc, 0x0020, "file.xml")

What should be done differently?

    2 replies

    1-Visitor
    May 16, 2014

    Did you not see my reply to your earlier thread?

    http://communities.ptc.com/message/243117#243117

    There is a different ACL command that converts SGML to XML.

    epichelp1-VisitorAuthor
    1-Visitor
    May 16, 2014

    We are executing ACL files via Arbortext Editor Command Line (ex: “source acl_file.acl”).

    A document identifier had to be provided to doc_kind() function to allow it to function for the document opened by doc_open().

    The following code sample produces an empty xml file. What are we missing?

    Sample Code:

    cd "c:/folder_to_sgml/"

    $sgml_doc = doc_open("sgmlfile.sgm", 0x200)

    message "sgml document identifier: $sgml_doc"

    $xmlName = "xmlfile.xml"

    if (doc_kind($sgml_doc) == "sgml") {

    message "document type is: sgml"

    save_as -xml "$xmlName"

    }

    # Close SGML File

    close($sgml_doc)

    12-Amethyst
    July 7, 2014

    Why did you switch from using doc_save to using save_as?

    Tim

    12-Amethyst
    August 6, 2014

    Did you get this issue resolved?

    Was one of the posts helpful or did one answer your question?