logo       

Re: namespace shenagans: msg#00010

Subject: Re: namespace shenagans
Hi Mike,

(for the benefit of others please reply to the mailing list when you
respond)

... so you have a method which builds a DOM and returns its root element.
Surely there's some other code which does some processing with this Node,
possibly mutating the subtree before serializing it. You should take a look
at what that code does.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@xxxxxxxxxx
E-mail: mrglavas@xxxxxxxxxx

"Mike Gardiner" <gardinerm@xxxxxxxxx> wrote on 10/04/2007 09:21:01 AM:

> I'm using a Document Builder. In the following section of code, the
> variable 'xml' is a string containing the xml to be transformed to a
> document / document element
>
>         org.w3c.dom.Document   document = null;
>         try {
>             DocumentBuilderFactory factory = org.apache.xerces.jaxp.
> DocumentBuilderFactoryImpl.newInstance();
>             factory.setNamespaceAware(false);
>             factory.setValidating(false);
>
>             DocumentBuilder builder;
>
>              builder = factory.newDocumentBuilder();
>             document = builder.parse(new InputSource(new
StringReader(xml)));
>
>
>
>         return document.getDocumentElement();
>         }
>

> On 10/3/07, Michael Glavassevich < mrglavas@xxxxxxxxxx> wrote:
> Hi Mike,
>
> Xerces doesn't magically add new namespace declarations to documents. In
> each place you mention what "Java" is doing what are you referring to? A
> transformer?
>
> Thanks.
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@xxxxxxxxxx
> E-mail: mrglavas@xxxxxxxxxx
>
> "Mike Gardiner" <gardinerm@xxxxxxxxx> wrote on 10/03/2007 02:44:13 PM:
>
> >  Hello,
> >
> >  I'm trying to load some XML without it being modified but from what I
> > see, no matter which way I load it (.setNamespaceAware = true|false)
> > java is making modifications to my XML.
> >
> >  Eg:
> >
> >  If I have source XML
> >
> >  <root xmlns:ns="http://someURI.net";>
> >  <ns:tag1>some value</ns:tag1>
> >  <ns:tag2>
> >  <tag3>some value for tag 3</tag3>
> >  </ns:tag2>
> >  </root>
> >
> >  And I load it using a DocumentBuilderFactory with
> > .setNamespaceAware=true I get:
> >
> >  <root xmlns:ns="http://someURI.net";>
> >  <ns:tag1>some value</ns:tag1>
> >  <ns:tag2>
> >  <ns5:tag3 xmlns=" http://test.net"; xmlns:ns5="http://test.net";>some
> > value for tag 3</ns5:tag3>
> >  </ns:tag2>
> >  </root>
> >
> >  And if I load it using .setNamespaceAware=false I get:
> >
> >  <root xmlns:ns="http://someURI.net";>
> >  <ns:tag1 xmlns:ns="">some value</ns:tag1>
> >  <ns:tag2 xmlns:ns="">
> >  <tag3>some value for tag 3</tag3>
> >  </ns:tag2>
> >  </root>
> >
> >
> >  So basically what I'm asking is how do I load my source XML as it is
> > without having Java modify it?
> >
> > I have tags that don't have namespace information, and that is by
> > design, but if I load the XML and let java assign a random namespace
> > to it, it's no longer the same XML. And if I tell the document builder
> > to not be namespace aware then it starts redefining namespaces to "".
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: j-users-unsubscribe@xxxxxxxxxxxxxxxxx
> > For additional commands, e-mail: j-users-help@xxxxxxxxxxxxxxxxx


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe