/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Visits a W3C DOM tree and generates SAX2 events from it.
*
* <p>
* This class is just intended to be used by {@link AbstractUnmarshallerImpl}.
* The javax.xml.bind.helpers package is generally a wrong place to put
* classes like this.
*
* @author <ul><li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li></ul>
* @since JAXB1.0
*/
public class DOMScanner implements LocatorEx,InfosetScanner/*<Node> --- but can't do this to protect 1.0 clients, or can I? */
{
/** reference to the current node being scanned - used for determining
* location info for validation events */
/** To save memory, only one instance of AttributesImpl will be used. */
/** This handler will receive SAX2 events. */
public DOMScanner() {
}
/**
* Configures the locator object that the SAX {@link ContentHandler} will see.
*/
}
} else {
}
}
}
setCurrentLocation( e );
}
visit(e);
}
setCurrentLocation( e );
}
/**
* Parses a subtree starting from the element e and
* reports SAX2 events to the specified handler.
*
* @deprecated in JAXB 2.0
* Use {@link #scan(Element)}
*/
// it might be better to set receiver at the constructor.
setCurrentLocation( e );
visit(e);
setCurrentLocation( e );
}
/**
* Similar to the parse method but it visits the ancestor nodes
* and properly emulate the all in-scope namespace declarations.
*
* @deprecated in JAXB 2.0
* Use {@link #scan(Element)}
*/
scan(e);
}
/**
* Recursively visit ancestors and build up {@link NamespaceSupport} oject.
*/
return;
nss.pushContext();
continue;
}
continue;
}
}
}
/**
* Visits an element and its subtree.
*/
setCurrentLocation( e );
// start namespace binding
} else {
// DOM built without namespace support has this problem
}
}
continue;
}
// add other attributes to the attribute list
// that we will pass to the ContentHandler
uri,
a.getName(),
"CDATA",
a.getValue());
}
// visit its children
for( int i=0; i<clen; i++ )
setCurrentLocation( e );
// call the endPrefixMapping method
else
}
}
}
setCurrentLocation( n );
// if a case statement gets too big, it should be made into a separate method.
switch(n.getNodeType()) {
case Node.CDATA_SECTION_NODE:
break;
case Node.ELEMENT_NODE:
break;
case Node.ENTITY_REFERENCE_NODE:
break;
break;
}
}
}
/**
* The same as {@link #getCurrentElement()} but
* better typed.
*/
return currentNode;
}
return currentNode;
}
return this;
}
}
return this.receiver;
}
// LocatorEx implementation
return new ValidationEventLocatorImpl(getCurrentLocation());
}
}