< prev index next >

src/java.xml/share/classes/org/xml/sax/helpers/NamespaceSupport.java

Print this page


   1 /*
   2  * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 // NamespaceSupport.java - generic Namespace support for SAX.
  27 // http://www.saxproject.org
  28 // Written by David Megginson
  29 // This class is in the Public Domain.  NO WARRANTY!
  30 // $Id: NamespaceSupport.java,v 1.5 2004/11/03 22:53:09 jsuttor Exp $
  31 
  32 package org.xml.sax.helpers;
  33 
  34 import java.util.ArrayList;
  35 import java.util.Collections;
  36 import java.util.EmptyStackException;
  37 import java.util.Enumeration;
  38 import java.util.HashMap;
  39 import java.util.List;
  40 import java.util.Map;
  41 
  42 
  43 /**
  44  * Encapsulate Namespace logic for use by applications using SAX,
  45  * or internally by SAX drivers.
  46  *
  47  * <blockquote>
  48  * <em>This module, both source code and documentation, is in the
  49  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
  50  * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
  51  * for further information.
  52  * </blockquote>
  53  *
  54  * <p>This class encapsulates the logic of Namespace processing: it
  55  * tracks the declarations currently in force for each context and
  56  * automatically processes qualified XML names into their Namespace
  57  * parts; it can also be used in reverse for generating XML qnames
  58  * from Namespaces.</p>
  59  *
  60  * <p>Namespace support objects are reusable, but the reset method
  61  * must be invoked between each session.</p>
  62  *
  63  * <p>Here is a simple session:</p>
  64  *
  65  * <pre>
  66  * String parts[] = new String[3];
  67  * NamespaceSupport support = new NamespaceSupport();
  68  *
  69  * support.pushContext();
  70  * support.declarePrefix("", "http://www.w3.org/1999/xhtml");
  71  * support.declarePrefix("dc", "http://www.purl.org/dc#");
  72  *


   1 /*
   2  * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 






  26 package org.xml.sax.helpers;
  27 
  28 import java.util.ArrayList;
  29 import java.util.Collections;
  30 import java.util.EmptyStackException;
  31 import java.util.Enumeration;
  32 import java.util.HashMap;
  33 import java.util.List;
  34 import java.util.Map;
  35 
  36 
  37 /**
  38  * Encapsulate Namespace logic for use by applications using SAX,
  39  * or internally by SAX drivers.







  40  *
  41  * <p>This class encapsulates the logic of Namespace processing: it
  42  * tracks the declarations currently in force for each context and
  43  * automatically processes qualified XML names into their Namespace
  44  * parts; it can also be used in reverse for generating XML qnames
  45  * from Namespaces.</p>
  46  *
  47  * <p>Namespace support objects are reusable, but the reset method
  48  * must be invoked between each session.</p>
  49  *
  50  * <p>Here is a simple session:</p>
  51  *
  52  * <pre>
  53  * String parts[] = new String[3];
  54  * NamespaceSupport support = new NamespaceSupport();
  55  *
  56  * support.pushContext();
  57  * support.declarePrefix("", "http://www.w3.org/1999/xhtml");
  58  * support.declarePrefix("dc", "http://www.purl.org/dc#");
  59  *


< prev index next >