The Artima Developer Community
Sponsored Link

Java Buzz Forum
Grumpiness about QName, the null URI, and Fun with XML Namespaces in Java

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Paul Brown

Posts: 284
Nickname: paulrbrown
Registered: Dec, 2003

Paul Brown is an entrepreneur
Grumpiness about QName, the null URI, and Fun with XML Namespaces in Java Posted: Feb 17, 2004 1:12 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Paul Brown.
Original Post: Grumpiness about QName, the null URI, and Fun with XML Namespaces in Java
Feed Title: mult.ifario.us
Feed URL: http://feeds.feedburner.com/MultifariousCategoryJava
Feed Description: Software. Business. Java. XML. Web Services.
Latest Java Buzz Posts
Latest Java Buzz Posts by Paul Brown
Latest Posts From mult.ifario.us

Advertisement
While debugging some code this weekend, I had occasion to step through the bowels of Apache AXIS and came face to face with something that looked suspicious:new QName(null,...)It turns out that SAX, DOM, and javax.xml.namespace.QName all treat unspecified namespaces differently. SAX In SAX, null URIs are not permitted and an absent URI is communicated as the the empty string (""):uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed. DOM In DOM, on the other hand, null URIs are the required representation for an unspecified namespace:Applications should use the value null as the namespaceURI parameter for methods if they wish to have no namespace. In programming languages where empty strings can be differentiated from null, empty strings, when given as a namespace URI, are converted to null. This is true even though the DOM does no lexical checking of URIs.(Namespaces in DOM are a train wreck anyway.) java.xml.namespace.QName Even though it's incompatible with both DOM and SAX, it turns out that according to J2EE 1.4 passing a null URI is OK for javax.xml.namespace.QName:If the Namespace URI is null, it is set to "". This value represents no explicitly defined Namespace as defined by the Namespaces in XML specification. This action preserves compatible behavior with QName 1.0.If the local part is null, an java.lang.IllegalArgumentException is thrown.If the prefix is null, an java.lang.IllegalArgumentException is thrown. Use "" to explicitly indicate that no prefix is present or the prefix is not relevant.

Read: Grumpiness about QName, the null URI, and Fun with XML Namespaces in Java

Topic: Real Programmers Code In Binary Previous Topic   Next Topic Topic: JSP expression language

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use