[xmlc] Re: Re: Accessing the body in a Document

Franck Routier <[email protected]> Tue, 15 Jun 2010 18:35:49 +0200
Newsgroups gmane.comp.java.enhydra.xmlc
Organization Axège sarl
Message-ID <1276619749.6447.72.camel@franck-laptop>
This is a multi-part message in MIME format...

------------=_1276619752-5928-2116
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi Jake and thanks for your input,

- my jars seem to be ok (I have xerces 2.9.1 and xml-apis 1.3.04),
(although I cannot exclude a classpath problem, but I don't think there
is one).
- using html dom, I can access the body element just fine (but my main
project is using xhtml all over the place)
- using getElementsByTagNale("body") is not any more lucky (length =3D 0)=
.


In the object I get on view.getDocument(), I find an attribute called
fDocument, which is my XHTMLDocumentImpl. The Document contains a
docElement (XHTMLHtmlElementImpl), that contains a first child
(XHTMLHeadElementImpl), that has no sibling...

But the object that view.getDocument() returns also contains attributes
like $element_My_Id (I guess these are generated by xmlc, isn't it ?).
Those elements have a ownerDocument, which is fDocument. And some of
them have a ownerNode that happens to be a XHTMLBodyElementImpl, and
that XHTMLBodyElementImpl has the same ownerDocument...

So the document structure seems fine, there really must be a bug with
getNextSibling or something.I'm not sure out to replicate the problem
outside of my project... if I can do so, I'll post on xerces mailing
list. Else, I'll just suspend my work on the subject ad wait for xerces
2.10.0.

Thanks
Franck



Le lundi 14 juin 2010 =C3=A0 10:52 -0500, Jacob Kjome a =C3=A9crit :
> Hi Franck,
>=20
> That is strange.  Do you experience the same issue when using the HTML =
DOM=20
> rather than the XHTML DOM?  What happens if you use the HTML DOM interf=
ace=20
> method HTMLDocument.getBody()?  How about getElementsByTagName("body") =
(try=20
> with and without providing the XHTML namespace)?
>=20
> Hmm... I just performed the following search...
> http://www.google.com/search?q=3Dchild.getNextSibling%28%29+incorrectly=
+returns+null
>=20
> ...and the following results look a bit suspicious...
>=20
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=3D6333993
> http://code.google.com/p/android/issues/detail?id=3D779
>=20
> When you run your server, try placing xercesImpl-2.9.1.jar in the serve=
r's=20
> classpath and place the xml-apis.jar that ships with Xerces 2.9.1 in an=
=20
> "endorsed" library directory.  Do you get the same results?
>=20
> Besides that, it could be related to a recently fixed bug in Xerces dea=
ling=20
> with transferring deferred nodes when using adopNode() (or cloneNode(),=
 which=20
> might produce similar behavior and which XMLC does whenever it serves u=
p a=20
> copy of the DOM).  You could try building from the latest Xerces source=
 or=20
> just wait until 2.10.0 is released, which should be any time now accord=
ing to=20
> reports on the Xerces user list.
>=20
> https://issues.apache.org/jira/browse/XERCESJ-1450
>=20
>=20
> Jake
>=20
> On Mon, 14 Jun 2010 11:54:29 +0200
>   Franck Routier <[email protected]> wrote:
> > Hi,
> >=20
> > I am playing with components in Barracuda, that I'd like to render in
> > the body tag of the document (these are script components, currently
> > rendered in the head, but yslow and google speed suggest it might be
> > better to render some of them at the end of the document).
> >=20
> > So, in my renderer, I access to the Document using the following code=
 :
> >=20
> > Node node =3D view.getNode();
> > Document doc =3D node.getOwnerDocument();
> > Element elRoot =3D doc.getDocumentElement();
> >=20
> > So here, doc is an ....Impl generated by xmlc, and elRoot corresponds=
 to
> > the htlm tag (in my example I have a XHTMLHtmlElement).
> > Until now I'm fine.
> >=20
> > Node child =3D elRoot.getFirstChild();
> >=20
> > --> child is of type HTMLHeadElement. Ok.
> >=20
> > child =3D child.getNextSibling();
> >=20
> > --> child is null. Argh.
> >=20
> > Is there an explaination why my document does not give me access to t=
he
> > body Node ?
> >=20
> > Thanks in advance,
> >=20
> >Franck
> >=20
> >=20
> >=20
>=20
> pi=C3=A8ce jointe document texte brut (message-footer.txt)
> --
> You receive this message as a subscriber of the [email protected] mailing li=
st.
> To unsubscribe: mailto:[email protected]
> For general help: mailto:[email protected]?subject=3Dhelp
> OW2 mailing lists service home page: http://www.ow2.org/wws





------------=_1276619752-5928-2116
Content-Type: text/plain; charset="UTF-8"; name="message-footer.txt"
Content-Disposition: inline; filename="message-footer.txt"
Content-Transfer-Encoding: quoted-printable


--
You receive this message as a subscriber of the [email protected] mailing list=
.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=3Dhelp
OW2 mailing lists service home page: http://www.ow2.org/wws

------------=_1276619752-5928-2116--