Copying DTD-typed attributes

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Copying DTD-typed attributes

Norman Walsh
Hello,

If I parse a document like this one:

<?xml version="1.0"?>
<!DOCTYPE x [
<!ATTLIST family fnumber ID #REQUIRED>
]>
<x>
  <family fnumber="f1">Lopez</family>
</x>

I can query the resulting tree using the id() function to locate
the element with the id “f1”. Great.

Except that I need to copy this tree into another context and I need
to preserve the “ID”-ness of the fnumber attribute.

Looking at the Saxon 9.6 APIs, clearly getSchemaType() doesn’t work.
The JavaDoc comment for getTypeAnnotation() suggests that it should be
possible to tell (sortof), but the IS_DTD_TYPE bit isn’t set (or
wasn’t in my quick test).

In principle, should it be possible to do what I’m trying to do? In
Saxon 9.6? Or Saxon 9.7? (Upgrading to Saxon 9.7 is on my list…)

Assuming you think it should be possible, I’ll build a small test case
to demonstrate what isn’t working for me.

                                        Be seeing you,
                                          norm

--
Norman Walsh <[hidden email]> | Where it is permissible both to die and
http://nwalsh.com/            | not to die, it is an abuse of valour to
                              | die.--Mencius

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 

signature.asc (178 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Copying DTD-typed attributes

Michael Kay
The rules for how operations such as xsl:copy handle the is-id property were clarified/changed as a consequence of

https://www.w3.org/Bugs/Public/show_bug.cgi?id=28565

and this may well mean that there are differences between Saxon 9.6 and 9.7.

However, I suspect that we may not be doing this entirely correctly in respect of DTD-defined IDs. I suspect that (at least for the TinyTree) we are adding an attribute to the ID index during tree construction if the SAX parser notifies it as being a DTD-defined ID, so that the id() function will find it, but I suspect we aren't doing anything that would result in NodeInfo.isId() returning true.

Michael Kay
Saxonica

> On 17 Apr 2016, at 20:36, Norman Walsh <[hidden email]> wrote:
>
> Hello,
>
> If I parse a document like this one:
>
> <?xml version="1.0"?>
> <!DOCTYPE x [
> <!ATTLIST family fnumber ID #REQUIRED>
> ]>
> <x>
>  <family fnumber="f1">Lopez</family>
> </x>
>
> I can query the resulting tree using the id() function to locate
> the element with the id “f1”. Great.
>
> Except that I need to copy this tree into another context and I need
> to preserve the “ID”-ness of the fnumber attribute.
>
> Looking at the Saxon 9.6 APIs, clearly getSchemaType() doesn’t work.
> The JavaDoc comment for getTypeAnnotation() suggests that it should be
> possible to tell (sortof), but the IS_DTD_TYPE bit isn’t set (or
> wasn’t in my quick test).
>
> In principle, should it be possible to do what I’m trying to do? In
> Saxon 9.6? Or Saxon 9.7? (Upgrading to Saxon 9.7 is on my list…)
>
> Assuming you think it should be possible, I’ll build a small test case
> to demonstrate what isn’t working for me.
>
>                                        Be seeing you,
>                                          norm
>
> --
> Norman Walsh <[hidden email]> | Where it is permissible both to die and
> http://nwalsh.com/            | not to die, it is an abuse of valour to
>                              | die.--Mencius
> ------------------------------------------------------------------------------
> Find and fix application performance issues faster with Applications Manager
> Applications Manager provides deep performance insights into multiple tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z_______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help



------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Loading...