You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by bu...@apache.org on 2001/08/06 18:03:50 UTC
[Bug 3004] New: - default attribute value not created if value is a null string
PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT
ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW
AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE
DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL
BE LOST SOMEWHERE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3004
*** shadow/3004 Mon Aug 6 09:03:50 2001
--- shadow/3004.tmp.5378 Mon Aug 6 09:03:50 2001
***************
*** 0 ****
--- 1,59 ----
+ +============================================================================+
+ | default attribute value not created if value is a null string |
+ +----------------------------------------------------------------------------+
+ | Bug #: 3004 Product: Xerces-C++ |
+ | Status: NEW Version: 1.5.1 |
+ | Resolution: Platform: PC |
+ | Severity: Normal OS/Version: Windows NT/2K |
+ | Priority: Other Component: DOM |
+ +----------------------------------------------------------------------------+
+ | Assigned To: xerces-c-dev@xml.apache.org |
+ | Reported By: tdodd@iss.net |
+ | CC list: Cc: |
+ +----------------------------------------------------------------------------+
+ | URL: |
+ +============================================================================+
+ | DESCRIPTION |
+ If I have an attribute specified in a schema as being of "string"
+ type, "optional" usage, and with a default value of a null string (""), the DOM
+ does not create a node for the attribute. If I explicitly specify a null
+ string value in the document, the DOM *does* create the node. Here's an
+ example schema:
+
+ <schema xmlns='http://www.w3.org/2001/XMLSchema'
+ targetNamespace='http://www.foo.com'
+ xmlns:foo='http://www.foo.com'
+ elementFormDefault='qualified'
+ version='1.0'>
+
+ <complexType name='FooType'>
+ <attribute name='text' type='string' use='optional' default=''/>
+ </complexType>
+
+ <element name='root' type='foo:FooType'/>
+ </schema>
+
+ Note the default value of the 'text' attribute is specified as ''. Here's an
+ example of a document that doesn't work:
+
+ <?xml version='1.0' encoding='UTF-8' standalone='no'?>
+ <root xmlns='http://www.foo.com'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:schemaLocation='http://www.foo.com file:///xml/NullStringBug.xsd'/>
+
+ When using the DOM to process this document, the call:
+
+ DOM_Node textNode = attrMap.getNamedItem(L"text");
+
+ returns a null node.
+
+ Here's an example of a document that *does* work:
+
+ <?xml version='1.0' encoding='UTF-8' standalone='no'?>
+ <root xmlns='http://www.foo.com'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:schemaLocation='http://www.foo.com
+ file:///tim/dev/Moonwatcher/dev/NPS/xml/NullStringBug.xsd' text=''/>
+
+ In this case, I've included the '' value in the document, and the getNamedItem
+ () call returns a good node with the appropriate value.
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org