You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Todd M Greanier <ac...@rochester.rr.com> on 2000/10/17 21:02:39 UTC
Dom Level 2 createElementNS
Hello all,
I am a little confused on using the createElementNS method. I was under the
impression that by using this, any output from my DOM would include the
xmlns... attribute associated with my document. However, this does not
happen.
Briefly, I have code like this:
Element root = document.createElement("http://foo.com/JU", "JU:LunchMenu");
...
I write this document out and it is well-formed XML, no problem. But there
is no xmlns declaration anywhere. I "solved" this problem by manually
assoicated an attribute (using setAttribute) with the root element, but I am
not convinced this is the way it should be.
Does anyone know how to get the namespace declaration to be included in the
output without setting the attribute manually?
Thanks,
---------------------------------------------
Todd M Greanier
Director of Technology
ComTech Training, Inc
Email: tgreanier@comtechtraining.com
Phone: (716)544-3548
--------------------------------------------
Re: Dom Level 2 createElementNS
Posted by Arnaud Le Hors <le...@us.ibm.com>.
Todd M Greanier wrote:
>
> I am using the org.apache.crimson.tree.XmlDocument from JAXP 1.1ea.
> Specifically, the write method.
Well, then my statement maybe irrelevant, I was talking about the Xerces
serializer. This is not it. This said, what you're seeing would be what
you'd get from any namespace unaware serializer.
> Thanks for the sanity, though. I was banging my head on the desk overthis
> one.
I hope it didn't hurt too much, did it? ;-)
--
Arnaud Le Hors - IBM Cupertino, XML Technology Group
Re: Dom Level 2 createElementNS
Posted by Edwin Goei <Ed...@eng.sun.com>.
Todd M Greanier wrote:
>
> I am using the org.apache.crimson.tree.XmlDocument from JAXP 1.1ea.
> Specifically, the write method.
Sounds like a bug in the crimson parser. Most people on this list use
the Xerces parser.
-Edwin
RE: Dom Level 2 createElementNS
Posted by Todd M Greanier <ac...@rochester.rr.com>.
I am using the org.apache.crimson.tree.XmlDocument from JAXP 1.1ea.
Specifically, the write method.
Thanks for the sanity, though. I was banging my head on the desk overthis
one.
Todd
-----Original Message-----
From: Arnaud Le Hors [mailto:lehors@us.ibm.com]
Sent: Tuesday, October 17, 2000 4:23 PM
To: xerces-j-dev@xml.apache.org
Subject: Re: Dom Level 2 createElementNS
Todd M Greanier wrote:
>
> I write this document out and it is well-formed XML, no problem. But there
> is no xmlns declaration anywhere. I "solved" this problem by manually
> assoicated an attribute (using setAttribute) with the root element, but I
am
> not convinced this is the way it should be.
>
I assume you're using the serializer to "write this document out",
right?
As I've said this morning in another message: the serializer is broken.
It fails to add the necessary namespace declaration attributes. If
anyone could fix it and send me the patch I'd be more than happy to
commit the changes!
> Does anyone know how to get the namespace declaration to be included in
the
> output without setting the attribute manually?
That's the right thing to do until the serializer is fixed.
--
Arnaud Le Hors - IBM Cupertino, XML Technology Group
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org
AW: Dom Level 2 createElementNS
Posted by Julian Reschke <ju...@gmx.de>.
> Von: Arnaud Le Hors [mailto:lehors@us.ibm.com]
> Gesendet: Dienstag, 17. Oktober 2000 22:23
> An: xerces-j-dev@xml.apache.org
> Betreff: Re: Dom Level 2 createElementNS
>
>
> Todd M Greanier wrote:
> >
> > I write this document out and it is well-formed XML, no
> problem. But there
> > is no xmlns declaration anywhere. I "solved" this problem by manually
> > assoicated an attribute (using setAttribute) with the root
> element, but I am
> > not convinced this is the way it should be.
> >
>
> I assume you're using the serializer to "write this document out",
> right?
> As I've said this morning in another message: the serializer is broken.
> It fails to add the necessary namespace declaration attributes. If
> anyone could fix it and send me the patch I'd be more than happy to
> commit the changes!
In the meantime I have downloaded the source and found that indeed the
XHTMLSerializer seems to try to output namespace declarations, but I haven't
been able to get that working.
Anyway (sorry if this is an FAQ): what's the best way to get a good overview
about how the different serializers interact, which are supported and so on?
Julian
Re: Dom Level 2 createElementNS
Posted by Arnaud Le Hors <le...@us.ibm.com>.
Todd M Greanier wrote:
>
> I write this document out and it is well-formed XML, no problem. But there
> is no xmlns declaration anywhere. I "solved" this problem by manually
> assoicated an attribute (using setAttribute) with the root element, but I am
> not convinced this is the way it should be.
>
I assume you're using the serializer to "write this document out",
right?
As I've said this morning in another message: the serializer is broken.
It fails to add the necessary namespace declaration attributes. If
anyone could fix it and send me the patch I'd be more than happy to
commit the changes!
> Does anyone know how to get the namespace declaration to be included in the
> output without setting the attribute manually?
That's the right thing to do until the serializer is fixed.
--
Arnaud Le Hors - IBM Cupertino, XML Technology Group