[jdom-interest] Problem with mixed content
Brett McLaughlin
brett.mclaughlin at lutris.com
Tue Sep 12 08:28:50 PDT 2000
Vyacheslav Pedak wrote:
>
> Hi,
>
> I dowloaded JDom sources from 09.08.2000.
> I have simple xml like this:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <test>
> <element>
> text
> </element>
> </test>
>
> and when I do
>
> Document doc = builder.build(new File(filename));
> Element root = doc.getRootElement();
> System.out.println("hasMixedContent="+root.hasMixedContent());
>
> I receive true, but there no mixed content in this xml.
Yes it does. The root element has both character data (white space) and
elements. It would only have no mixed content if a DTD was present, and
specified that the element "test" could only have nested elements. JDOM
is doing exactly the right thing.
>
> I think the problem is in white space, because when I made xml like this:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <test><element>text</element></test>
>
> all works fine.
As it should - there is no character data here.
This isn't a bug, this is adherence to the XML spec.
-Brett
>
> Regards,
> Vyacheslav Pedak.
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
--
Brett McLaughlin, Enhydra Strategist
Lutris Technologies, Inc.
1200 Pacific Avenue, Suite 300
Santa Cruz, CA 95060 USA
http://www.lutris.com
http://www.enhydra.org
More information about the jdom-interest
mailing list