Re: XML XInclude support

Eli Zaretskii
2007-02-02T18:53:42Z

> Date: Mon, 29 Jan 2007 16:32:30 -0500
> From: Daniel Jacobowitz <drow@false.org>
> Cc: Eli Zaretskii <eliz@gnu.org>
>
> This patch adds support for a limited subset (I confess, very limited)
> of XInclude to GDB's target description parser. It's a simple textual
> transform. A file that looks like this:
>
> <target>
> <xi:include href="other.xml"/>
> </target>
>
> is expanded to include the contents of other.xml instead of the
> xi:include element, before parsing it as a target description.
> For "set tdesc filename" other.xml should be in the same directory
> as the original description. For qXfer:features, other.xml is
> a new annex to read from the target.

Thanks.

> + /* Simple, portable version of dirname that does not modify its
> + argument. */
> + base = lbasename (filename);
> + while (base > filename && IS_DIR_SEPARATOR (base[-1]))
> + --base;

I'm glad to see portable file-name handling, but this loop needs a
small extra to not fail in the case of "d:foo".

> +@example
> +<xi:include href="@var{name}"/>
> +@end example
> +
> +@noindent
> +When @value{GDBN} encounters an element of this form, it will retrieve
> +the XML document named @var{name}, and replace the inclusion directive
> +with the contents of that annex.

I'd suggest to use @var{document} instead of @var{name}, and reword
the last sentence like this:

When @value{GDBN} encounters an element of this form, it will retrieve
the named XML @var{document} ...

> If the current description was read
> +using @samp{qXfer}, then the new document will be also

This "the new document will be also" is a bit confusing, I think. How
about this instead:

If the current description was read using @samp{qXfer}, then so will
be the included @var{document}; the description's name will be
interpreted as the name of an annex.

> If the current description was read from a
> +file, @value{GDBN} will look for a file named @var{name} in the same
> +directory as the original file.

If the current description was read from a
file, @value{GDBN} will look for @var{document} as a file in the same
directory where it found the original description.