mrglavas    2005/02/24 14:23:16

  Modified:    java/src/org/apache/xerces/parsers AbstractDOMParser.java
  Log:
  When the type of an element is a union, the [member type definition] will not 
be available
  until the end of the element (the exception being if the element is empty). 
This is required
  for TypeInfo [1] though we weren't picking it up in endElement. Should be 
fixed now.
  
  Still keeping the code which sets the type in startElement since its possible 
the user
  has registered a filter which determines whether to accept or reject nodes 
based on
  type information.
  
  [1] http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo
  
  Revision  Changes    Path
  1.113     +17 -5     
xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java
  
  Index: AbstractDOMParser.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/parsers/AbstractDOMParser.java,v
  retrieving revision 1.112
  retrieving revision 1.113
  diff -u -r1.112 -r1.113
  --- AbstractDOMParser.java    7 May 2004 21:40:59 -0000       1.112
  +++ AbstractDOMParser.java    24 Feb 2005 22:23:15 -0000      1.113
  @@ -1,5 +1,5 @@
   /*
  - * Copyright 2001-2004 The Apache Software Foundation.
  + * Copyright 2001-2005 The Apache Software Foundation.
    * 
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
  @@ -1251,10 +1251,22 @@
           if (!fDeferNodeExpansion) {
   
               // REVISIT: Should this happen after we call the filter?
  -            if (fStorePSVI && augs != null) {
  -                ElementPSVI elementPSVI = (ElementPSVI)augs.getItem 
(Constants.ELEMENT_PSVI);
  +            if (augs != null && fDocumentImpl != null && (fNamespaceAware || 
fStorePSVI)) {
  +                ElementPSVI elementPSVI = (ElementPSVI) 
augs.getItem(Constants.ELEMENT_PSVI);
                   if (elementPSVI != null) {
  -                    ((PSVIElementNSImpl)fCurrentNode).setPSVI (elementPSVI);
  +                    // Updating TypeInfo. If the declared type is a union the
  +                    // [member type definition] will only be available at the
  +                    // end of an element.
  +                    if (fNamespaceAware) {
  +                        XSTypeDefinition type = 
elementPSVI.getMemberTypeDefinition();
  +                        if (type == null) {
  +                            type = elementPSVI.getTypeDefinition();
  +                        }
  +                        ((ElementNSImpl)fCurrentNode).setType(type);
  +                    }
  +                    if (fStorePSVI) {
  +                        ((PSVIElementNSImpl)fCurrentNode).setPSVI 
(elementPSVI);
  +                    }
                   }
               }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to