325N/A/*
325N/A * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
325N/A *
325N/A * This code is free software; you can redistribute it and/or modify it
325N/A * under the terms of the GNU General Public License version 2 only, as
325N/A * published by the Free Software Foundation. Oracle designates this
325N/A * particular file as subject to the "Classpath" exception as provided
325N/A * by Oracle in the LICENSE file that accompanied this code.
325N/A *
325N/A * This code is distributed in the hope that it will be useful, but WITHOUT
325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
325N/A * version 2 for more details (a copy is included in the LICENSE file that
325N/A * accompanied this code).
325N/A *
325N/A * You should have received a copy of the GNU General Public License version
325N/A * 2 along with this work; if not, write to the Free Software Foundation,
325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
325N/A *
325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
325N/A * or visit www.oracle.com if you need additional information or have any
325N/A * questions.
325N/A */
325N/A
325N/Apackage com.sun.tools.internal.xjc.reader.internalizer;
325N/A
325N/Aimport java.net.MalformedURLException;
325N/Aimport java.net.URL;
325N/Aimport java.util.ArrayList;
325N/Aimport java.util.HashMap;
325N/Aimport java.util.HashSet;
325N/Aimport java.util.List;
325N/Aimport java.util.Map;
325N/Aimport java.util.Set;
325N/Aimport java.text.ParseException;
325N/A
325N/Aimport javax.xml.xpath.XPath;
325N/Aimport javax.xml.xpath.XPathConstants;
325N/Aimport javax.xml.xpath.XPathExpressionException;
325N/Aimport javax.xml.xpath.XPathFactory;
325N/A
325N/Aimport com.sun.istack.internal.SAXParseException2;
325N/Aimport com.sun.istack.internal.NotNull;
325N/Aimport com.sun.istack.internal.Nullable;
325N/Aimport com.sun.tools.internal.xjc.ErrorReceiver;
325N/Aimport com.sun.tools.internal.xjc.reader.Const;
325N/Aimport com.sun.tools.internal.xjc.util.DOMUtils;
325N/Aimport com.sun.xml.internal.bind.v2.util.EditDistance;
325N/Aimport com.sun.xml.internal.xsom.SCD;
325N/Aimport java.io.File;
325N/Aimport java.io.IOException;
325N/Aimport java.util.logging.Level;
325N/Aimport java.util.logging.Logger;
325N/Aimport javax.xml.XMLConstants;
325N/A
325N/Aimport org.w3c.dom.Attr;
325N/Aimport org.w3c.dom.Document;
325N/Aimport org.w3c.dom.Element;
325N/Aimport org.w3c.dom.NamedNodeMap;
325N/Aimport org.w3c.dom.Node;
325N/Aimport org.w3c.dom.NodeList;
325N/Aimport org.xml.sax.SAXParseException;
325N/A
325N/A/**
325N/A * Internalizes external binding declarations.
325N/A *
325N/A * <p>
325N/A * The {@link #transform(DOMForest,boolean)} method is the entry point.
325N/A *
325N/A * @author
325N/A * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
325N/A */
325N/Aclass Internalizer {
325N/A
325N/A private static final String WSDL_NS = "http://schemas.xmlsoap.org/wsdl/";
325N/A
325N/A private static final XPathFactory xpf = XPathFactory.newInstance();
325N/A
325N/A private final XPath xpath = xpf.newXPath();
325N/A
325N/A /**
325N/A * Internalize all &lt;jaxb:bindings> customizations in the given forest.
325N/A *
325N/A * @return
325N/A * if the SCD support is enabled, the return bindings need to be applied
325N/A * after schema components are parsed.
325N/A * If disabled, the returned binding set will be empty.
325N/A * SCDs are only for XML Schema, and doesn't make any sense for other
325N/A * schema languages.
325N/A */
325N/A static SCDBasedBindingSet transform( DOMForest forest, boolean enableSCD ) {
325N/A return new Internalizer( forest, enableSCD ).transform();
325N/A }
325N/A
325N/A
325N/A private Internalizer( DOMForest forest, boolean enableSCD ) {
325N/A this.errorHandler = forest.getErrorHandler();
325N/A this.forest = forest;
325N/A this.enableSCD = enableSCD;
325N/A }
325N/A
325N/A /**
325N/A * DOMForest object currently being processed.
325N/A */
325N/A private final DOMForest forest;
325N/A
325N/A /**
325N/A * All errors found during the transformation is sent to this object.
325N/A */
325N/A private ErrorReceiver errorHandler;
325N/A
325N/A /**
325N/A * If true, the SCD-based target selection is supported.
325N/A */
325N/A private boolean enableSCD;
325N/A
325N/A
325N/A private SCDBasedBindingSet transform() {
325N/A
325N/A // either target nodes are conventional DOM nodes (as per spec),
325N/A Map<Element,List<Node>> targetNodes = new HashMap<Element,List<Node>>();
325N/A // ... or it will be schema components by means of SCD (RI extension)
325N/A SCDBasedBindingSet scd = new SCDBasedBindingSet(forest);
325N/A
325N/A //
325N/A // identify target nodes for all <jaxb:bindings>
325N/A //
325N/A for (Element jaxbBindings : forest.outerMostBindings) {
325N/A // initially, the inherited context is itself
325N/A buildTargetNodeMap(jaxbBindings, jaxbBindings, null, targetNodes, scd);
325N/A }
325N/A
325N/A //
325N/A // then move them to their respective positions.
325N/A //
325N/A for (Element jaxbBindings : forest.outerMostBindings) {
325N/A move(jaxbBindings, targetNodes);
325N/A }
325N/A
325N/A return scd;
325N/A }
325N/A
325N/A /**
325N/A * Validates attributes of a &lt;jaxb:bindings> element.
325N/A */
325N/A private void validate( Element bindings ) {
325N/A NamedNodeMap atts = bindings.getAttributes();
325N/A for( int i=0; i<atts.getLength(); i++ ) {
325N/A Attr a = (Attr)atts.item(i);
325N/A if( a.getNamespaceURI()!=null )
325N/A continue; // all foreign namespace OK.
325N/A if( a.getLocalName().equals("node") )
325N/A continue;
325N/A if( a.getLocalName().equals("schemaLocation"))
325N/A continue;
325N/A if( a.getLocalName().equals("scd") )
325N/A continue;
325N/A
325N/A // enhancements
325N/A if( a.getLocalName().equals("required") ) //
325N/A continue;
325N/A if( a.getLocalName().equals("multiple") ) //
325N/A continue;
325N/A
325N/A
325N/A // TODO: flag error for this undefined attribute
325N/A }
325N/A }
325N/A
325N/A /**
325N/A * Determines the target node of the "bindings" element
325N/A * by using the inherited target node, then put
325N/A * the result into the "result" map and the "scd" map.
325N/A *
325N/A * @param inheritedTarget
325N/A * The current target node. This always exists, even if
325N/A * the user starts specifying targets via SCD (in that case
325N/A * this inherited target is just not going to be used.)
325N/A * @param inheritedSCD
325N/A * If the ancestor &lt;bindings> node specifies @scd to
325N/A * specify the target via SCD, then this parameter represents that context.
325N/A */
325N/A private void buildTargetNodeMap( Element bindings, @NotNull Node inheritedTarget,
325N/A @Nullable SCDBasedBindingSet.Target inheritedSCD,
325N/A Map<Element,List<Node>> result, SCDBasedBindingSet scdResult ) {
325N/A // start by the inherited target
325N/A Node target = inheritedTarget;
325N/A ArrayList<Node> targetMultiple = null;
325N/A
325N/A validate(bindings); // validate this node
325N/A
325N/A boolean required = true;
325N/A boolean multiple = false;
325N/A
325N/A if(bindings.getAttribute("required") != null) {
325N/A String requiredAttr = bindings.getAttribute("required");
325N/A
325N/A if(requiredAttr.equals("no") || requiredAttr.equals("false") || requiredAttr.equals("0"))
325N/A required = false;
325N/A }
325N/A
325N/A if(bindings.getAttribute("multiple") != null) {
325N/A String requiredAttr = bindings.getAttribute("multiple");
325N/A
325N/A if(requiredAttr.equals("yes") || requiredAttr.equals("true") || requiredAttr.equals("1"))
325N/A multiple = true;
325N/A }
325N/A
325N/A
325N/A // look for @schemaLocation
325N/A if( bindings.getAttributeNode("schemaLocation")!=null ) {
325N/A String schemaLocation = bindings.getAttribute("schemaLocation");
325N/A
325N/A // enhancement - schemaLocation="*" = bind to all schemas..
325N/A if(schemaLocation.equals("*")) {
325N/A for(String systemId : forest.listSystemIDs()) {
325N/A if (result.get(bindings) == null)
325N/A result.put(bindings, new ArrayList<Node>());
325N/A result.get(bindings).add(forest.get(systemId).getDocumentElement());
325N/A
325N/A Element[] children = DOMUtils.getChildElements(bindings, Const.JAXB_NSURI, "bindings");
325N/A for (Element value : children)
325N/A buildTargetNodeMap(value, forest.get(systemId).getDocumentElement(), inheritedSCD, result, scdResult);
325N/A }
325N/A return;
325N/A } else {
325N/A try {
325N/A // TODO: use the URI class
325N/A // TODO: honor xml:base
325N/A URL loc = new URL(
325N/A new URL(forest.getSystemId(bindings.getOwnerDocument())), schemaLocation
325N/A );
325N/A schemaLocation = loc.toExternalForm();
325N/A target = forest.get(schemaLocation);
325N/A if ((target == null) && (loc.getProtocol().startsWith("file"))) {
325N/A File f = new File(loc.getFile());
325N/A schemaLocation = new File(f.getCanonicalPath()).toURI().toString();
325N/A }
325N/A } catch( MalformedURLException e ) {
325N/A } catch( IOException e ) {
325N/A Logger.getLogger(Internalizer.class.getName()).log(Level.FINEST, e.getLocalizedMessage());
325N/A }
325N/A
325N/A target = forest.get(schemaLocation);
325N/A if(target==null) {
325N/A reportError( bindings,
325N/A Messages.format(Messages.ERR_INCORRECT_SCHEMA_REFERENCE,
325N/A schemaLocation,
325N/A EditDistance.findNearest(schemaLocation,forest.listSystemIDs())));
325N/A
325N/A return; // abort processing this <jaxb:bindings>
325N/A }
325N/A
325N/A target = ((Document)target).getDocumentElement();
325N/A }
325N/A }
325N/A
325N/A // look for @node
325N/A if( bindings.getAttributeNode("node")!=null ) {
325N/A String nodeXPath = bindings.getAttribute("node");
325N/A
325N/A // evaluate this XPath
325N/A NodeList nlst;
325N/A try {
325N/A xpath.setNamespaceContext(new NamespaceContextImpl(bindings));
325N/A nlst = (NodeList)xpath.evaluate(nodeXPath,target,XPathConstants.NODESET);
325N/A } catch (XPathExpressionException e) {
325N/A if(required) {
325N/A reportError( bindings,
325N/A Messages.format(Messages.ERR_XPATH_EVAL,e.getMessage()), e );
325N/A return; // abort processing this <jaxb:bindings>
325N/A } else {
325N/A return;
325N/A }
325N/A }
325N/A
325N/A if( nlst.getLength()==0 ) {
325N/A if(required)
325N/A reportError( bindings,
325N/A Messages.format(Messages.NO_XPATH_EVAL_TO_NO_TARGET, nodeXPath) );
325N/A return; // abort
325N/A }
325N/A
325N/A if( nlst.getLength()!=1 ) {
325N/A if(!multiple) {
325N/A reportError( bindings,
325N/A Messages.format(Messages.NO_XPATH_EVAL_TOO_MANY_TARGETS, nodeXPath,nlst.getLength()) );
325N/A
325N/A return; // abort
325N/A } else {
325N/A if(targetMultiple == null) targetMultiple = new ArrayList<Node>();
325N/A for(int i = 0; i < nlst.getLength(); i++) {
325N/A targetMultiple.add(nlst.item(i));
325N/A }
325N/A }
325N/A }
325N/A
325N/A // check
325N/A if(!multiple || nlst.getLength() == 1) {
325N/A Node rnode = nlst.item(0);
325N/A if (!(rnode instanceof Element)) {
325N/A reportError(bindings,
325N/A Messages.format(Messages.NO_XPATH_EVAL_TO_NON_ELEMENT, nodeXPath));
325N/A return; // abort
325N/A }
325N/A
325N/A if (!forest.logic.checkIfValidTargetNode(forest, bindings, (Element) rnode)) {
325N/A reportError(bindings,
325N/A Messages.format(Messages.XPATH_EVAL_TO_NON_SCHEMA_ELEMENT,
325N/A nodeXPath, rnode.getNodeName()));
325N/A return; // abort
325N/A }
325N/A
325N/A target = rnode;
325N/A } else {
325N/A for(Node rnode : targetMultiple) {
325N/A if (!(rnode instanceof Element)) {
325N/A reportError(bindings,
325N/A Messages.format(Messages.NO_XPATH_EVAL_TO_NON_ELEMENT, nodeXPath));
325N/A return; // abort
325N/A }
325N/A
325N/A if (!forest.logic.checkIfValidTargetNode(forest, bindings, (Element) rnode)) {
325N/A reportError(bindings,
325N/A Messages.format(Messages.XPATH_EVAL_TO_NON_SCHEMA_ELEMENT,
325N/A nodeXPath, rnode.getNodeName()));
325N/A return; // abort
325N/A }
325N/A }
325N/A }
325N/A }
325N/A
325N/A // look for @scd
325N/A if( bindings.getAttributeNode("scd")!=null ) {
325N/A String scdPath = bindings.getAttribute("scd");
325N/A if(!enableSCD) {
325N/A // SCD selector was found, but it's not activated. report an error
325N/A // but recover by handling it anyway. this also avoids repeated error messages.
325N/A reportError(bindings,
325N/A Messages.format(Messages.SCD_NOT_ENABLED));
325N/A enableSCD = true;
325N/A }
325N/A
325N/A try {
325N/A inheritedSCD = scdResult.createNewTarget( inheritedSCD, bindings,
325N/A SCD.create(scdPath, new NamespaceContextImpl(bindings)) );
325N/A } catch (ParseException e) {
325N/A reportError( bindings, Messages.format(Messages.ERR_SCD_EVAL,e.getMessage()),e );
325N/A return; // abort processing this bindings
325N/A }
325N/A }
325N/A
325N/A // update the result map
325N/A if (inheritedSCD != null) {
325N/A inheritedSCD.addBinidng(bindings);
325N/A } else if (!multiple || targetMultiple == null) {
325N/A if (result.get(bindings) == null)
325N/A result.put(bindings, new ArrayList<Node>());
325N/A result.get(bindings).add(target);
325N/A } else {
325N/A for (Node rnode : targetMultiple) {
325N/A if (result.get(bindings) == null)
325N/A result.put(bindings, new ArrayList<Node>());
325N/A
325N/A result.get(bindings).add(rnode);
325N/A }
325N/A
325N/A }
325N/A
325N/A
325N/A // look for child <jaxb:bindings> and process them recursively
325N/A Element[] children = DOMUtils.getChildElements( bindings, Const.JAXB_NSURI, "bindings" );
325N/A for (Element value : children)
325N/A if(!multiple || targetMultiple == null)
325N/A buildTargetNodeMap(value, target, inheritedSCD, result, scdResult);
325N/A else {
325N/A for(Node rnode : targetMultiple) {
325N/A buildTargetNodeMap(value, rnode, inheritedSCD, result, scdResult);
325N/A }
325N/A }
325N/A }
325N/A
325N/A /**
325N/A * Moves JAXB customizations under their respective target nodes.
325N/A */
325N/A private void move(Element bindings, Map<Element, List<Node>> targetNodes) {
325N/A List<Node> nodelist = targetNodes.get(bindings);
325N/A
325N/A if(nodelist == null) {
325N/A return; // abort
325N/A }
325N/A
325N/A for (Node target : nodelist) {
325N/A if (target == null) // this must be the result of an error on the external binding.
325N/A // recover from the error by ignoring this node
325N/A {
325N/A return;
325N/A }
325N/A
325N/A for (Element item : DOMUtils.getChildElements(bindings)) {
325N/A String localName = item.getLocalName();
325N/A
325N/A if ("bindings".equals(localName)) {
325N/A // process child <jaxb:bindings> recursively
325N/A move(item, targetNodes);
325N/A } else if ("globalBindings".equals(localName)) {
325N/A // <jaxb:globalBindings> always go to the root of document.
325N/A Element root = forest.getOneDocument().getDocumentElement();
325N/A if (root.getNamespaceURI().equals(WSDL_NS)) {
325N/A NodeList elements = root.getElementsByTagNameNS(XMLConstants.W3C_XML_SCHEMA_NS_URI, "schema");
325N/A if ((elements == null) || (elements.getLength() < 1)) {
325N/A reportError(item, Messages.format(Messages.ORPHANED_CUSTOMIZATION, item.getNodeName()));
325N/A return;
325N/A } else {
325N/A moveUnder(item, (Element)elements.item(0));
325N/A }
325N/A } else {
325N/A moveUnder(item, root);
325N/A }
325N/A } else {
325N/A if (!(target instanceof Element)) {
325N/A reportError(item,
325N/A Messages.format(Messages.CONTEXT_NODE_IS_NOT_ELEMENT));
325N/A return; // abort
325N/A }
325N/A
325N/A if (!forest.logic.checkIfValidTargetNode(forest, item, (Element) target)) {
325N/A reportError(item,
325N/A Messages.format(Messages.ORPHANED_CUSTOMIZATION, item.getNodeName()));
325N/A return; // abort
325N/A }
325N/A
325N/A // move this node under the target
325N/A moveUnder(item, (Element) target);
325N/A }
325N/A }
325N/A }
325N/A }
325N/A
325N/A /**
325N/A * Moves the "decl" node under the "target" node.
325N/A *
325N/A * @param decl
325N/A * A JAXB customization element (e.g., &lt;jaxb:class>)
325N/A *
325N/A * @param target
325N/A * XML Schema element under which the declaration should move.
325N/A * For example, &lt;xs:element>
325N/A */
325N/A private void moveUnder( Element decl, Element target ) {
325N/A Element realTarget = forest.logic.refineTarget(target);
325N/A
325N/A declExtensionNamespace( decl, target );
325N/A
325N/A // copy in-scope namespace declarations of the decl node
325N/A // to the decl node itself so that this move won't change
325N/A // the in-scope namespace bindings.
325N/A Element p = decl;
325N/A Set<String> inscopes = new HashSet<String>();
325N/A while(true) {
325N/A NamedNodeMap atts = p.getAttributes();
325N/A for( int i=0; i<atts.getLength(); i++ ) {
325N/A Attr a = (Attr)atts.item(i);
325N/A if( Const.XMLNS_URI.equals(a.getNamespaceURI()) ) {
325N/A String prefix;
325N/A if( a.getName().indexOf(':')==-1 ) prefix = "";
325N/A else prefix = a.getLocalName();
325N/A
325N/A if( inscopes.add(prefix) && p!=decl ) {
325N/A // if this is the first time we see this namespace bindings,
325N/A // copy the declaration.
325N/A // if p==decl, there's no need to. Note that
325N/A // we want to add prefix to inscopes even if p==Decl
325N/A
325N/A decl.setAttributeNodeNS( (Attr)a.cloneNode(true) );
325N/A }
325N/A }
325N/A }
325N/A
325N/A if( p.getParentNode() instanceof Document )
325N/A break;
325N/A
325N/A p = (Element)p.getParentNode();
325N/A }
325N/A
325N/A if( !inscopes.contains("") ) {
325N/A // if the default namespace was undeclared in the context of decl,
325N/A // it must be explicitly set to "" since the new environment might
325N/A // have a different default namespace URI.
325N/A decl.setAttributeNS(Const.XMLNS_URI,"xmlns","");
325N/A }
325N/A
325N/A
325N/A // finally move the declaration to the target node.
325N/A if( realTarget.getOwnerDocument()!=decl.getOwnerDocument() ) {
325N/A // if they belong to different DOM documents, we need to clone them
325N/A Element original = decl;
325N/A decl = (Element)realTarget.getOwnerDocument().importNode(decl,true);
325N/A
325N/A // this effectively clones a ndoe,, so we need to copy locators.
325N/A copyLocators( original, decl );
325N/A }
325N/A
325N/A realTarget.appendChild( decl );
325N/A }
325N/A
325N/A /**
325N/A * Recursively visits sub-elements and declare all used namespaces.
325N/A * TODO: the fact that we recognize all namespaces in the extension
325N/A * is a bad design.
325N/A */
325N/A private void declExtensionNamespace(Element decl, Element target) {
325N/A // if this comes from external namespaces, add the namespace to
325N/A // @extensionBindingPrefixes.
325N/A if( !Const.JAXB_NSURI.equals(decl.getNamespaceURI()) )
325N/A declareExtensionNamespace( target, decl.getNamespaceURI() );
325N/A
325N/A NodeList lst = decl.getChildNodes();
325N/A for( int i=0; i<lst.getLength(); i++ ) {
325N/A Node n = lst.item(i);
325N/A if( n instanceof Element )
325N/A declExtensionNamespace( (Element)n, target );
325N/A }
325N/A }
325N/A
325N/A
325N/A /** Attribute name. */
325N/A private static final String EXTENSION_PREFIXES = "extensionBindingPrefixes";
325N/A
325N/A /**
325N/A * Adds the specified namespace URI to the jaxb:extensionBindingPrefixes
325N/A * attribute of the target document.
325N/A */
325N/A private void declareExtensionNamespace( Element target, String nsUri ) {
325N/A // look for the attribute
325N/A Element root = target.getOwnerDocument().getDocumentElement();
325N/A Attr att = root.getAttributeNodeNS(Const.JAXB_NSURI,EXTENSION_PREFIXES);
325N/A if( att==null ) {
325N/A String jaxbPrefix = allocatePrefix(root,Const.JAXB_NSURI);
325N/A // no such attribute. Create one.
325N/A att = target.getOwnerDocument().createAttributeNS(
325N/A Const.JAXB_NSURI,jaxbPrefix+':'+EXTENSION_PREFIXES);
325N/A root.setAttributeNodeNS(att);
325N/A }
325N/A
325N/A String prefix = allocatePrefix(root,nsUri);
325N/A if( att.getValue().indexOf(prefix)==-1 )
325N/A // avoid redeclaring the same namespace twice.
325N/A att.setValue( att.getValue()+' '+prefix);
325N/A }
325N/A
325N/A /**
325N/A * Declares a new prefix on the given element and associates it
325N/A * with the specified namespace URI.
325N/A * <p>
325N/A * Note that this method doesn't use the default namespace
325N/A * even if it can.
325N/A */
325N/A private String allocatePrefix( Element e, String nsUri ) {
325N/A // look for existing namespaces.
325N/A NamedNodeMap atts = e.getAttributes();
325N/A for( int i=0; i<atts.getLength(); i++ ) {
325N/A Attr a = (Attr)atts.item(i);
325N/A if( Const.XMLNS_URI.equals(a.getNamespaceURI()) ) {
325N/A if( a.getName().indexOf(':')==-1 ) continue;
325N/A
325N/A if( a.getValue().equals(nsUri) )
325N/A return a.getLocalName(); // found one
325N/A }
325N/A }
325N/A
325N/A // none found. allocate new.
325N/A while(true) {
325N/A String prefix = "p"+(int)(Math.random()*1000000)+'_';
325N/A if(e.getAttributeNodeNS(Const.XMLNS_URI,prefix)!=null)
325N/A continue; // this prefix is already allocated.
325N/A
325N/A e.setAttributeNS(Const.XMLNS_URI,"xmlns:"+prefix,nsUri);
325N/A return prefix;
325N/A }
325N/A }
325N/A
325N/A
325N/A /**
325N/A * Copies location information attached to the "src" node to the "dst" node.
325N/A */
325N/A private void copyLocators( Element src, Element dst ) {
325N/A forest.locatorTable.storeStartLocation(
325N/A dst, forest.locatorTable.getStartLocation(src) );
325N/A forest.locatorTable.storeEndLocation(
325N/A dst, forest.locatorTable.getEndLocation(src) );
325N/A
325N/A // recursively process child elements
325N/A Element[] srcChilds = DOMUtils.getChildElements(src);
325N/A Element[] dstChilds = DOMUtils.getChildElements(dst);
325N/A
325N/A for( int i=0; i<srcChilds.length; i++ )
325N/A copyLocators( srcChilds[i], dstChilds[i] );
325N/A }
325N/A
325N/A
325N/A private void reportError( Element errorSource, String formattedMsg ) {
325N/A reportError( errorSource, formattedMsg, null );
325N/A }
325N/A
325N/A private void reportError( Element errorSource,
325N/A String formattedMsg, Exception nestedException ) {
325N/A
325N/A SAXParseException e = new SAXParseException2( formattedMsg,
325N/A forest.locatorTable.getStartLocation(errorSource),
325N/A nestedException );
325N/A errorHandler.error(e);
325N/A }
325N/A}