/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.ode.bpel.compiler.bom;

import org.w3c.dom.Document;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;

import com.sun.org.apache.xml.internal.utils.DOMBuilder;

public class DOMBuilderContentHandler extends DOMBuilder {
    private Locator _locator;


    public DOMBuilderContentHandler(Document doc) {
        super(doc);
       
    }

    @Override
    public void startElement(String ns, String localName, String name, Attributes atts) throws SAXException {
        if (_locator != null) {
            AttributesImpl a = new AttributesImpl(atts);
            a.addAttribute(BpelObject.ATTR_LINENO.getNamespaceURI(), BpelObject.ATTR_LINENO.getLocalPart(),
                    "odebpelc:"+BpelObject.ATTR_LINENO.getLocalPart(), "CDATA", "" + _locator.getLineNumber());
            atts = a;
        }
        super.startElement(ns, localName, name, atts);
    }


    @Override
    public void setDocumentLocator(Locator locator) {
        _locator = locator;
        super.setDocumentLocator(locator);
    }

}

@@ -1158,16 +1158,53 @@
 cator;%0A%0A
+    private int _suppressLineNo = 0;%0A
 %0A    pub
@@ -1407,16 +1407,128 @@
 ption %7B%0A
+        if (localName.equals(%22literal%22) %7C%7C _suppressLineNo %3E 0)%0A            ++_suppressLineNo;%0A                %0A
         
@@ -1547,16 +1547,39 @@
  != null
+ && _suppressLineNo %3E 0
 ) %7B%0A    
@@ -1946,16 +1946,257 @@
     %7D%0A%0A%0A
+    @Override%0A    public void endElement(String ns, String localName, String name) throws SAXException %7B%0A        if (_suppressLineNo %3E 0)%0A            --_suppressLineNo;%0A        %0A        super.endElement(ns, localName, name);%0A        %0A    %7D%0A%0A
     @Ove

Fixe lineno in literal.