0

I want to make a small tool in Haxe, that inspects the haxedoc comments. I figured the best way to get these comments is to use the "haxe -xml" option, and load in the resulting XML file.

However, when I generate the XML, it seems to include the whole standard library in the output XML. When I pass this XML in to Dox, it generates documentation for my code and the standard library stuff, e.g. Class, Date, String, Enum...

Is this expected behaviour? Is there some way to exclude the standard library entries from the generated XML? Or should I write my tool to filter the XML based on package/filename/etc?

Here is my build script:

/build.hxml

-cp src
-neko main.n
--no-output
-xml bin/xml/neko.xml
--macro "include('doctest')"

Here's the file I want to generate XML for:

/src/doctest/Main.hx

package doctest;

//import neko.Lib;

/**
 * ...
 * @author jjokin
 */
class Main 
{
    static function main() 
    {
    }
}

/**
 * This class does some stuff.
 */
class DemoClass {
}
Laurence Dougal Myers
  • 1,004
  • 1
  • 8
  • 17

1 Answers1

3

Okay, I think I've worked it out. The compiled XML must always include everything - such as Array, Enum, Class, List - since these are needed for compilation to other languages. I've had a look at Dox, and it has the options "-in/--include", and "-ex/--exclude", which lets you filter the elements to produce documentation for. So, my module will need to do something similar.

Laurence Dougal Myers
  • 1,004
  • 1
  • 8
  • 17
  • 1
    You could possibly also play with calling `Compiler.exclude("String")` etc, to exclude them from being generated. I haven't tested if this works on Xml documentation, but it's maybe worth a shot. Filtering the complete list is what most libraries seem to do though. See http://api.haxe.org/haxe/macro/Compiler.html#exclude – Jason O'Neil Jul 14 '14 at 07:25
  • 2
    For anyone returning here in the future, using `haxelib run dox -in "^your\.package\.regex" …` works properly – only includes your classes, not the stdlib. `-ex` is not needed. – Aurel Bílý Mar 24 '17 at 15:47