cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Validation from Command Line

douglaswade1
1-Newbie

Validation from Command Line

1) I would like to know if the Arbortext editor can quietly (command line,
without the GUI opening) to validate SGML files in a batch mode. I usually
use NSGML, but wanted to do it using Arbortext Editor. I recall seeing
something, like doing this from a CMD shell, but I am brain dead and cannot
seem to find it.

2) I would like to export out sgml to xml quietly, such as save as or
export, again without the GUI. Is this possible?


D
12 REPLIES 12

I am not sure about using Editor without the GUI, but when opening a
document, Editor tends to want to "help" you by "fixing" things that it
thinks are wrong with your document. Sometimes the fixes are not
desired. If all you want is validation, you might be better off
sticking with NSGMLS.


It is important to remember that Editor is trying to be an editing
program not a validator, so as Ed mentions, sometimes it fixes things
that it thinks are wrong especially when it comes to missing markup.
While it tries hard to stop an author from creating invalid markup,
there are also times when the author has to be able to create incomplete
markup and we let the author save and reload without error messages
(which would probably just confuse the author). So I would not try using
Editor as a validator, not it's job.

John Dreystadt
Software Development Director
Arbortext - PTC
734-352-2835
-


Also, from an XML perspective, I've had the ACL command "doc_incomplete"
sometimes report completeness errors that magically go away when the
document is saved or reopened.
I agree with John about not using Epic for validation, but given what I've
said above, "doc_incomplete" seems to create false-positives, but not
false-negatives as far as I can tell.

As far as programatically writing a process to check this without having
Epic open up... it can certainly be done using the Java API, but it's a bit
complex, and probably too much information for this post.

keith

Doesn't save_as -xml work from the command line?


Thank you all for your comments. Of one of the questions, I was trying to
get to a solution, without giving you the requirements. What I am trying to
do is that I "may" have to convert 8,000 DM from S1000D issue 2.0 SGML to
issue 3.0 XML. So, I have some transformations to do. I am trying to get a
process in my head, but have not done the work to know what mappings are
required yet. It is a fact finding task.

d



If you are looking to set up a large batch conversion process, then I'm
not sure that Arbortext is the best tool for the job. In the past we have
used Apache Ant and XSLT or if you are a Java guy, you could try using the
Java XML API (JAXP).



Hi Ryan-



Sure, you can start it in batch mode by running the following command from a
DOS prompt or batch file:



"C:\Program Files\Arbortext\Editor\bin\epic.exe" -b -c "commands here"
file.xml ...



where "commands here" gets replaced with whatever command you want to
execute (inside double quotes). Full details on the command options are in
the online help ("help 5717" on the Arbortext command line).



So, as a quick example, if you had a directory of SGML files and wanted to
convert them to XML, you could do something like this (in a Windows/DOS
batch file):



for %%i in (C:\sgml\*.sgml) do (

"C:\Program Files\Arbortext\Editor\bin\epic.exe" -b -c "save_as -xml
'C:\xml\%%~ni.xml" -log "log.txt" "%%i"

)



HTH



--Clay



Clay Helberg

Senior Consultant

TerraXML


I've used Apache Ant (with antcontrib) to do batch conversion and verification, and it works well. It gives very usable validation errors.

For example, here's a target I use to validate a single file at the end of a conversion pipeline:

<target name="validate" depends="cleanup">
<echo message="Validating" ${out}&quot;="/>
<xmlvalidate failonerror="yes" warn="yes">
<fileset file="${out}"/">
<xmlcatalog>
<dtd location="codebook2.dtd" publicid="-//JMP//DTD" codebook=" v.8=" en&quot;="/>
</xmlcatalog>
</xmlvalidate>
</target>

Here's the manual page for xmlvalidate:

Thanks Clay, that seemed to do the trick. For some reason, I had the -C2
option set instead of -c.



Ryan


Clay:

What does the "%%~ni" do? I understand the "%%i".

d


It means, "for parameter i, extract the name part of the path (i.e. the
filename minus the extension). So, if %i = "C:\sgml\foo.sgml", %~ni = "foo".



There are all sorts of variants of this to grab different parts of the file
path from a parameter in a batch file. %~di gives the drive letter, %~pi
gives the path (not including the drive or the filename), %~xi gives the
extension, etc. You can also combine them, e.g. %~dpi gives the drive letter
and path of the file (without the filename).



To see all the possible options, open a command prompt window in Windows and
type "help for", then scroll down to the end of the help file.



--Clay (whose DOS knowledge reveals his age)



Clay Helberg

Senior Consultant

TerraXML


That is so cool. I did a google search and that did not help.

D



On Dec 3, 2008, at 5:48 PM, "Clay Helberg" <chelberg@terraxml.com
wrote:

> It means, “for parameter i, extract the name part of the path (i.e. 
> the filename minus the extension). So, if %i = “C:\sgml
> \foo.sgml”, %~ni = “foo”.
>
>
>
> There are all sorts of variants of this to grab different parts of 
> the file path from a parameter in a batch file. %~di gives the drive 
> letter, %~pi gives the path (not including the drive or the 
> filename), %~xi gives the extension, etc. You can also combine them, 
> e.g. %~dpi gives the drive letter and path of the file (without the 
> filename).
>
>
>
> To see all the possible options, open a command prompt window in 
> Windows and type “help for”, then scroll down to the end of the 
> help file.
>
>
>
> --Clay (whose DOS knowledge reveals his age)
>
>
>
> Clay Helberg
>
> Senior Consultant
>
> TerraXML
>
>
>
Announcements