You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Mike Boos <mb...@ca.ibm.com> on 2004/04/12 19:43:31 UTC

[PATCH] Built in datatypes, attributes, and namespace attributes in PSVIWriter





I've found some more problems with the PSVIWriter, and have made a patch
that addresses them. Details of the problems and the fixes in the patch are
listed below.
(See attached file: patchfile.txt)
Already declared types and built-in data types are being declared in the
PSVI output.
The most blatant example:
        <psv:simpleTypeDefinition id="string">
         <psv:name>string</psv:name>

<psv:targetNamespace>http://www.w3.org/2001/XMLSchema</psv:targetNamespace>
         <psv:baseTypeDefinition>
          <psv:simpleTypeDefinition ref="anySimpleType" xsi:nil="true"/>
         </psv:baseTypeDefinition>
         <psv:primitiveTypeDefinition>
          <psv:simpleTypeDefinition ref="string" xsi:nil="true"/>
         </psv:primitiveTypeDefinition>
         <psv:facets>
          <psv:whiteSpace>
           <psv:value>preserve</psv:value>
           <psv:fixed>false</psv:fixed>
           <psv:annotation xsi:nil="true"/>
          </psv:whiteSpace>
         </psv:facets>
         <psv:fundamentalFacets>
          <psv:ordered>
           <psv:value>false</psv:value>
          </psv:ordered>
          <psv:bounded>
           <psv:value>false</psv:value>
          </psv:bounded>
          <psv:cardinality>
           <psv:value>false</psv:value>
          </psv:cardinality>
          <psv:numeric>
           <psv:value>false</psv:value>
          </psv:numeric>
         </psv:fundamentalFacets>
         <psv:final xsi:nil="true"/>
         <psv:variety>atomic</psv:variety>
         <psv:memberTypeDefinitions xsi:nil="true"/>
         <psv:annotations xsi:nil="true"/>
        </psv:simpleTypeDefinition>
As opposed to the correct:
<psv:simpleTypeDefinition ref=?string? xsi:nil=?true?/>
The code in the patch will emit a reference instead of a full-blown
description if it the type has already been declared somewhere else in the
output or the type is built-in.

processDOMElement, while printing the information for a child element,
emits the attribute information of the parent element rather than the child
element. The patch corrects this.

processDOMAttributes prints namespace attributes as regular attributes. The
patch differentiates between regular and namespace attributes.

This is just a minor thing, but I found the following in the
PSVIWriter.processPSVIEndElement code:

// A value for nil is not necessary, since we output declaration, instead.
// See
http://www.w3.org/TR/xmlschema-1/#section-Element-Declaration-Validation-Rules.
sendElementEvent("psv:nil");

I found the comment a bit misleading, as I did not find the reasoning for
nil being unnecessary in the validation rules referenced by the URL.
Instead, it was in the next section, 3.3.5 Element Declaration Information
Set Contributions. The URL should read
http://www.w3.org/TR/xmlschema-1/#section-Element-Declaration-Information-Set-Contributions

Thanks

Mike Boos
mboos@ca.ibm.com
(905) 413-3722

Re: [PATCH] Built in datatypes, attributes, and namespace attributes in PSVIWriter

Posted by Sandy Gao <sa...@ca.ibm.com>.



Looks good. Committed. Thx Mike!

Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
sandygao@ca.ibm.com



                                                                           
             Mike                                                          
             Boos/Toronto/IBM@                                             
             IBMCA                                                      To 
                                       xerces-j-dev@xml.apache.org         
             04/12/2004 01:43                                           cc 
             PM                                                            
                                                                   Subject 
                                       [PATCH] Built in datatypes,         
             Please respond to         attributes, and namespace           
               xerces-j-dev            attributes in PSVIWriter            
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           









I've found some more problems with the PSVIWriter, and have made a patch
that addresses them. Details of the problems and the fixes in the patch are
listed below.
(See attached file: patchfile.txt)
Already declared types and built-in data types are being declared in the
PSVI output.
The most blatant example:
        <psv:simpleTypeDefinition id="string">
         <psv:name>string</psv:name>

<psv:targetNamespace>http://www.w3.org/2001/XMLSchema</psv:targetNamespace>
         <psv:baseTypeDefinition>
          <psv:simpleTypeDefinition ref="anySimpleType" xsi:nil="true"/>
         </psv:baseTypeDefinition>
         <psv:primitiveTypeDefinition>
          <psv:simpleTypeDefinition ref="string" xsi:nil="true"/>
         </psv:primitiveTypeDefinition>
         <psv:facets>
          <psv:whiteSpace>
           <psv:value>preserve</psv:value>
           <psv:fixed>false</psv:fixed>
           <psv:annotation xsi:nil="true"/>
          </psv:whiteSpace>
         </psv:facets>
         <psv:fundamentalFacets>
          <psv:ordered>
           <psv:value>false</psv:value>
          </psv:ordered>
          <psv:bounded>
           <psv:value>false</psv:value>
          </psv:bounded>
          <psv:cardinality>
           <psv:value>false</psv:value>
          </psv:cardinality>
          <psv:numeric>
           <psv:value>false</psv:value>
          </psv:numeric>
         </psv:fundamentalFacets>
         <psv:final xsi:nil="true"/>
         <psv:variety>atomic</psv:variety>
         <psv:memberTypeDefinitions xsi:nil="true"/>
         <psv:annotations xsi:nil="true"/>
        </psv:simpleTypeDefinition>
As opposed to the correct:
<psv:simpleTypeDefinition ref=?string? xsi:nil=?true?/>
The code in the patch will emit a reference instead of a full-blown
description if it the type has already been declared somewhere else in the
output or the type is built-in.

processDOMElement, while printing the information for a child element,
emits the attribute information of the parent element rather than the child
element. The patch corrects this.

processDOMAttributes prints namespace attributes as regular attributes. The
patch differentiates between regular and namespace attributes.

This is just a minor thing, but I found the following in the
PSVIWriter.processPSVIEndElement code:

// A value for nil is not necessary, since we output declaration, instead.
// See
http://www.w3.org/TR/xmlschema-1/#section-Element-Declaration-Validation-Rules
.
sendElementEvent("psv:nil");

I found the comment a bit misleading, as I did not find the reasoning for
nil being unnecessary in the validation rules referenced by the URL.
Instead, it was in the next section, 3.3.5 Element Declaration Information
Set Contributions. The URL should read
http://www.w3.org/TR/xmlschema-1/#section-Element-Declaration-Information-Set-Contributions


Thanks

Mike Boos
mboos@ca.ibm.com
(905) 413-3722(See attached file: patchfile.txt)
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org