< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/DOM2SAX.java

Print this page


   1 /*
   2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * @LastModified: Oct 2017
   4  */
   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  *
  13  *     http://www.apache.org/licenses/LICENSE-2.0
  14  *
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.xalan.internal.xsltc.trax;
  23 


  29 import java.util.List;
  30 import java.util.Map;
  31 import java.util.Stack;
  32 import org.w3c.dom.NamedNodeMap;
  33 import org.w3c.dom.Node;
  34 import org.xml.sax.ContentHandler;
  35 import org.xml.sax.DTDHandler;
  36 import org.xml.sax.EntityResolver;
  37 import org.xml.sax.ErrorHandler;
  38 import org.xml.sax.InputSource;
  39 import org.xml.sax.Locator;
  40 import org.xml.sax.SAXException;
  41 import org.xml.sax.SAXNotRecognizedException;
  42 import org.xml.sax.SAXNotSupportedException;
  43 import org.xml.sax.XMLReader;
  44 import org.xml.sax.ext.LexicalHandler;
  45 import org.xml.sax.helpers.AttributesImpl;
  46 
  47 /**
  48  * @author G. Todd Miller

  49  */
  50 public class DOM2SAX implements XMLReader, Locator {
  51 
  52     private final static String EMPTYSTRING = "";
  53     private static final String XMLNS_PREFIX = "xmlns";
  54 
  55     private Node _dom = null;
  56     private ContentHandler _sax = null;
  57     private LexicalHandler _lex = null;
  58     private SAXImpl _saxImpl = null;
  59     private Map<String, Stack<String>> _nsPrefixes = new HashMap<>();
  60 
  61     public DOM2SAX(Node root) {
  62         _dom = root;
  63     }
  64 
  65     public ContentHandler getContentHandler() {
  66         return _sax;
  67     }
  68 


   1 /*
   2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.

   3  */
   4 /*
   5  * Licensed to the Apache Software Foundation (ASF) under one or more
   6  * contributor license agreements.  See the NOTICE file distributed with
   7  * this work for additional information regarding copyright ownership.
   8  * The ASF licenses this file to You under the Apache License, Version 2.0
   9  * (the "License"); you may not use this file except in compliance with
  10  * the License.  You may obtain a copy of the License at
  11  *
  12  *     http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xalan.internal.xsltc.trax;
  22 


  28 import java.util.List;
  29 import java.util.Map;
  30 import java.util.Stack;
  31 import org.w3c.dom.NamedNodeMap;
  32 import org.w3c.dom.Node;
  33 import org.xml.sax.ContentHandler;
  34 import org.xml.sax.DTDHandler;
  35 import org.xml.sax.EntityResolver;
  36 import org.xml.sax.ErrorHandler;
  37 import org.xml.sax.InputSource;
  38 import org.xml.sax.Locator;
  39 import org.xml.sax.SAXException;
  40 import org.xml.sax.SAXNotRecognizedException;
  41 import org.xml.sax.SAXNotSupportedException;
  42 import org.xml.sax.XMLReader;
  43 import org.xml.sax.ext.LexicalHandler;
  44 import org.xml.sax.helpers.AttributesImpl;
  45 
  46 /**
  47  * @author G. Todd Miller
  48  * @LastModified: Oct 2017
  49  */
  50 public class DOM2SAX implements XMLReader, Locator {
  51 
  52     private final static String EMPTYSTRING = "";
  53     private static final String XMLNS_PREFIX = "xmlns";
  54 
  55     private Node _dom = null;
  56     private ContentHandler _sax = null;
  57     private LexicalHandler _lex = null;
  58     private SAXImpl _saxImpl = null;
  59     private Map<String, Stack<String>> _nsPrefixes = new HashMap<>();
  60 
  61     public DOM2SAX(Node root) {
  62         _dom = root;
  63     }
  64 
  65     public ContentHandler getContentHandler() {
  66         return _sax;
  67     }
  68 


< prev index next >