Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] xmlns="" Is this Normal Behavior?

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: John Cowan <cowan AT ccil.org>
  • To: Sean Truman <struman AT nuparadigm.com>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] xmlns="" Is this Normal Behavior?
  • Date: Fri, 17 Mar 2006 11:21:46 -0500

Sean Truman scripsit:

> Code:
> Element root = new Element("root","http://www.test.com/root";);
> root.appendChild(new Element("child"));
> Document nd = new Document(root);
> System.out.println("Document:"+nd.toXML());
>
> Output:
> Document:<?xml version="1.0"?>
> <root xmlns="http://www.test.com/root";><child xmlns="" /></root>
>
> Is there a reason that the child xmlns is empty? Or is this normal
> behavior?

You created the child with no namespace name, so on output it sets xmlns
to "" to preserve that. XOM requires you to specify the namespace name
(or lack thereof) of an element or attribute when you create it, and
preserves it no matter how the tree is arranged or rearranged.

--
You let them out again, Old Man Willow! John Cowan
What you be a-thinking of? You should not be waking! cowan AT ccil.org
Eat earth! Dig deep! Drink water! Go to sleep! www.ap.org
Bombadil is talking. www.ccil.org/~cowan




Archive powered by MHonArc 2.6.24.

Top of Page