XDocument for XML functions

I am attempting to write a journal using VB which incorporates XDocument to export an XML file. When I write the journal in Visual Studio, the XDocument is valid. I have tried: Imports System.xml, System.xml.linq, and System.xml.linq.xdocument. But when I run the journal, I get a syntax error: Type 'XDocument' is not defined.

How can I define an XDocument? Is it possible with NXOpen?

This will only be possible if you have an author license and compile your code to a .dll. There are severe restrictions on which external libraries you can use with a journal, System.XML isn't one of them. If you have an author license, you can reference any functions in the .net framework and any 3rd party libraries that you have legal access to.