RE: copy, namespace prefix and namepool

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

RE: copy, namespace prefix and namepool

Michael Kay
The next Saxon release will allow 1023 prefixes for each URI in the Name
Pool. It's also a bit more efficient in handling the lookups when there are
many prefixes for the same URI, though it still involves a sequential search
as this is considered an unusual situation.
 
Michael Kay
http://www.saxonica.com/


  _____  

From: Michael Kay [mailto:[hidden email]]
Sent: 21 December 2005 09:57
To: '[hidden email]'
Subject: RE: [saxon] copy, namespace prefix and namepool


Thanks for the extra info.
 
The NamePool has a built-in limit of 256 prefixes for each namespace URI,
though it wouldn't surprise me at all if it breaks after 128 as the limits
certainly haven't been tested.
 
I think that Saxon 8.x probably has better error checking to test when the
NamePool limits are exceeded, but the limits haven't been raised. The whole
point of the NamePool is to allow names to be compared using simple integer
comparison rather than long strings, and that means imposing a limit. The
limits were chosen to be well beyond those used by 99.99% of applications,
but there will always be some pathological cases that can't be handled.
 
There's no obligation to use the same NamePool for all transformations. It's
a bit more complicated to organize your application to use multiple
NamePools, but for extreme cases like this the option is there. Of course
there might be environments such as Stylus that handle the NamePool
management themselves and don't expose this option to the user; I'm afraid
there's not much I can do about that.
 
I would be interested to know why you're mapping so many prefixes to the
same URI. Are they generated randomly, or something? Perhaps you could solve
the problem by changing the way you decide what prefixes to use.
 
Michael Kay
http://www.saxonica.com/


  _____  

From: [hidden email]
[mailto:[hidden email]] On Behalf Of Aarts, Marco
Sent: 21 December 2005 07:01
To: [hidden email]
Subject: RE: [saxon] copy, namespace prefix and namepool


Michael,
 
We're using 6.5.2.
 
The problem occurs after I have run the transformation on a large document
which contains 100+ different prefixes for the same namespace-uri. This
transformation runs OK for the first 130 or so prefixes, but elements with a
higher prefix are not transformed well (outputted as plain text, but that's
probably a side effect). Then when I run the same transformation as below
(using only two prefixes), anything involving the prefixes above 130
generates the error. Restarting stylus and running the second transformation
works OK, and this also seems to be the case for our Sonic ESB (in which
restarting is not really an option :).
 
So I guess the problem has to do with caching of prefixes / namespace URI's
over several transformations.
 
Plus, we think the original problem (the document with 100+ prefixes) might
have to do with the limitations of the namepool size. Is there any way to
increase this?
 
kind regards,
Marco Aarts
 

  _____  

Van: [hidden email] namens Michael Kay
Verzonden: wo 21-12-2005 0:55
Aan: [hidden email]
Onderwerp: RE: [saxon] copy, namespace prefix and namepool


I can't reproduce this using any recent version of Saxon 6.x, and the line
numbers in GeneralOutputter are about 20 lines adrift from the current
version (6.5.5). Which version are you using?
 
Can you reproduce it when running from the command line?
 
Michael Kay
http://www.saxonica.com/


  _____  

From: [hidden email]
[mailto:[hidden email]] On Behalf Of Aarts, Marco
Sent: 20 December 2005 10:45
To: [hidden email]
Subject: [saxon] copy, namespace prefix and namepool


Dear all,
 
I am trying to do a simple copy of an xml document, using xslt 1. Other
processors do the job just fine, but with Saxon I get NamePool exceptions
when I change the values of namespace uri's or their prefixes in the
original document.
 
The source document contains a default namespace, plus several namespaces
defined on sub-elements.
 
My guess is that namespace prefixes are somehow cached over several
transformations.
 
Stylesheet, sample and error message are included. I'm using Sonic Stylus
Studio, but have also seen the error occur in our Sonic ESB server.
 
Can someone explain what's going on?
 
kind regards,
Marco Aarts
 
(example: source document that works)
<?xml version="1.0" encoding="UTF-8" ?>
<Antwoord xmlns="http://www.test.nl/antwoord/1.0">
<Verwijzingen>
<Verwijzing>
 <ns123:CodeSysteem xmlns:ns123="testhttp://www.test.nl/verwijzing/1.0"
<http://www.test.nl/verwijzing/1.0> >test</ns123:CodeSysteem>
 </Verwijzing>
<Verwijzing>
<ns130:CodeSysteem xmlns:ns130="testhttp://www.test.nl/verwijzing/1.0"
<http://www.test.nl/verwijzing/1.0> >test</ns130:CodeSysteem>
 </Verwijzing>
 </Verwijzingen>
 </Antwoord>
 
(example: source document that does not work - changed the namespace URI)
<?xml version="1.0" encoding="UTF-8" ?>
<Antwoord xmlns="http://www.test.nl/antwoord/1.0">
<Verwijzingen>
<Verwijzing>
 <ns123:CodeSysteem xmlns:ns123="testhttp://www.test2.nl/verwijzing/1.0"
<http://www.test2.nl/verwijzing/1.0> >test</ns123:CodeSysteem>
 </Verwijzing>
<Verwijzing>
<ns130:CodeSysteem xmlns:ns130="testhttp://www.test2.nl/verwijzing/1.0"
<http://www.test2.nl/verwijzing/1.0> >test</ns130:CodeSysteem>
 </Verwijzing>
 </Verwijzingen>
 </Antwoord>
 
(the stylesheet)
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <xsl:output method="xml" indent="yes"/>
 <xsl:template match="@*|node()" mode="copy">
  <xsl:copy>
   <xsl:copy-of select="@*"/>
   <xsl:apply-templates mode="copy"/>
  </xsl:copy>
 </xsl:template>
 <xsl:template match="/">
  <xsl:apply-templates select="*" mode="copy"/>
 </xsl:template>
</xsl:stylesheet>
 
(the exception)
java.lang.RuntimeException
java.lang.NullPointerException
 at com.icl.saxon.om.NamePool.allocateCodeForPrefix(NamePool.java:336)
 at com.icl.saxon.om.NamePool.allocateNamespaceCode(NamePool.java:492)
 at
com.icl.saxon.output.NamespaceEmitter.startElement(NamespaceEmitter.java:68)
 at
com.icl.saxon.output.GeneralOutputter.flushStartTag(GeneralOutputter.java:72
7)
 at
com.icl.saxon.output.GeneralOutputter.writeContent(GeneralOutputter.java:442
)
 at
com.icl.saxon.output.GeneralOutputter.writeContent(GeneralOutputter.java:425
)
 at com.icl.saxon.style.XSLCopy.process(XSLCopy.java:89)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:225)
 at com.icl.saxon.style.XSLTemplate.traceExpand(XSLTemplate.java:212)
 at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:196)
 at com.icl.saxon.Controller.applyTemplates(Controller.java:252)
 at
com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:135)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLCopy.process(XSLCopy.java:76)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:225)
 at com.icl.saxon.style.XSLTemplate.traceExpand(XSLTemplate.java:212)
 at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:196)
 at com.icl.saxon.Controller.applyTemplates(Controller.java:252)
 at
com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:135)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLCopy.process(XSLCopy.java:76)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:225)
 at com.icl.saxon.style.XSLTemplate.traceExpand(XSLTemplate.java:212)
 at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:196)
 at com.icl.saxon.Controller.applyTemplates(Controller.java:252)
 at
com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:135)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLCopy.process(XSLCopy.java:76)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:225)
 at com.icl.saxon.style.XSLTemplate.traceExpand(XSLTemplate.java:212)
 at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:196)
 at com.icl.saxon.Controller.applyTemplates(Controller.java:252)
 at
com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:135)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLCopy.process(XSLCopy.java:76)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:225)
 
 at com.icl.saxon.style.XSLTemplate.traceExpand(XSLTemplate.java:212)
 at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:196)
 at com.icl.saxon.Controller.applyTemplates(Controller.java:252)
 at
com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:135)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLCopy.process(XSLCopy.java:76)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:225)
 at com.icl.saxon.style.XSLTemplate.traceExpand(XSLTemplate.java:212)
 at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:196)
 at com.icl.saxon.Controller.applyTemplates(Controller.java:252)
 at
com.icl.saxon.style.XSLApplyTemplates.process(XSLApplyTemplates.java:135)
 at com.icl.saxon.style.StyleElement.processChildren(StyleElement.java:610)
 at com.icl.saxon.style.XSLTemplate.expand(XSLTemplate.java:225)
 at com.icl.saxon.style.XSLTemplate.traceExpand(XSLTemplate.java:212)
 at com.icl.saxon.style.XSLTemplate.start(XSLTemplate.java:196)
 at com.icl.saxon.Controller.applyTemplates(Controller.java:252)
 at com.icl.saxon.Controller.run(Controller.java:178)
 at com.icl.saxon.Controller.transformDocument(Controller.java:1079)
 at com.icl.saxon.Controller.transform(Controller.java:946)
 at com.exln.stylus.CSaxonDriver.doProcessing(CSaxonDriver.java:143)
 at com.exln.stylus.CProcessorDriver.process(CProcessorDriver.java:55)
 
Disclaimer

Dit bericht met eventuele bijlagen is vertrouwelijk en uitsluitend bestemd
voor de geadresseerde. Indien u niet de bedoelde ontvanger bent, wordt u
verzocht de afzender te waarschuwen en dit bericht met eventuele bijlagen
direct te verwijderen en/of te vernietigen. Het is niet toegestaan dit
bericht en eventuele bijlagen te vermenigvuldigen, door te sturen, openbaar
te maken, op te slaan of op andere wijze te gebruiken. Ordina N.V. en/of
haar groepsmaatschappijen accepteren geen verantwoordelijkheid of
aansprakelijkheid voor schade die voortvloeit uit de inhoud en/of de
verzending van dit bericht.

This e-mail and any attachments are confidential and is solely intended for
the addressee only. If you are not the intended recipient, please notify the
sender and delete and/or destroy this message and any attachments
immediately. It is prohibited to copy, to distribute, to disclose or to use
this e-mail and any attachments in any other way. Ordina N.V. and/or its
group companies do not accept any responsibility nor liability for any
damage resulting from the content of and/or the transmission of this
message.

Disclaimer

Dit bericht met eventuele bijlagen is vertrouwelijk en uitsluitend bestemd
voor de geadresseerde. Indien u niet de bedoelde ontvanger bent, wordt u
verzocht de afzender te waarschuwen en dit bericht met eventuele bijlagen
direct te verwijderen en/of te vernietigen. Het is niet toegestaan dit
bericht en eventuele bijlagen te vermenigvuldigen, door te sturen, openbaar
te maken, op te slaan of op andere wijze te gebruiken. Ordina N.V. en/of
haar groepsmaatschappijen accepteren geen verantwoordelijkheid of
aansprakelijkheid voor schade die voortvloeit uit de inhoud en/of de
verzending van dit bericht.

This e-mail and any attachments are confidential and is solely intended for
the addressee only. If you are not the intended recipient, please notify the
sender and delete and/or destroy this message and any attachments
immediately. It is prohibited to copy, to distribute, to disclose or to use
this e-mail and any attachments in any other way. Ordina N.V. and/or its
group companies do not accept any responsibility nor liability for any
damage resulting from the content of and/or the transmission of this
message.



winmail.dat (22K) Download Attachment