xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] Order of children of the document node
- From: Michael Kay <mike AT saxonica.com>
- To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
- Subject: Re: [XOM-interest] Order of children of the document node
- Date: Thu, 25 Sep 2014 08:40:15 +0100
My current workaround is that when I reach the real element root, I do a
setRootElement(), and then if there is more than one child, I remove all the
existing children and re-insert them at the front.
I guess the other way would be, when adding a comment or PI at level 1 in the
tree, to test whether the root element has the magic fake name, and if so,
insert the new node at position N-1 where N is the number of existing
children. All seems very clumsy.
Saxonica
mike AT saxonica.com
+44 (0) 118 946 5893
On 25 Sep 2014, at 00:06, Michael Kay <mike AT saxonica.com> wrote:
> I've found that my XOM builder class is creating children of the document
> node in the wrong order.
>
> The arrival order is (PI, Comment, Element). On the tree they appear as
> (Element, PI, Comment). The reason is that when the document node is
> created, a fake element child is created, and when the real outermost
> element is encountered, this replaces the fake element and thus appears
> before the PI and Comment.
>
> Any suggestions as to workaround? I can think of possible approaches, but
> none is simple, and all make adding the children of a document node very
> different from adding the children of an element node, which I would prefer
> to avoid.
>
>
> Michael Kay
> Saxonica
> mike AT saxonica.com
> +44 (0) 118 946 5893
>
>
>
>
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
-
[XOM-interest] Order of children of the document node,
Michael Kay, 09/24/2014
- Re: [XOM-interest] Order of children of the document node, Michael Kay, 09/25/2014
- Re: [XOM-interest] Order of children of the document node, Elliotte Rusty Harold, 09/25/2014
Archive powered by MHonArc 2.6.24.