java.lang.Object | +----xmllink2
It then expands any links in the document that have ACTUATE="auto" and SHOW="embed". After that, it prints the result on stdout. Note that it expands recursively: if the expanded element itself contains links, they are expanded as well. Adding that capability is easy, but making sure that the program doesn't go into a loop is harder, so I omitted that check for now...
The replaced part is enclosed in a sub-doc (!doctype), so that the result is still valid. The subdoc cannot be validated, and therefore it has no URL to point to a DTD.
For example, a source anchor like this:
<anchor xml-link="simple" show="embed" actuate="auto" href="..."/>
is expanded to:
<!doctype expanded-anchor> <expanded-anchor> ... </expanded-anchor>
public static void main(String argv) throws IOException, UnknownEncoding, IllegalXptrException