src/java.xml/share/classes/com/sun/org/apache/xml/internal/resolver/readers/SAXCatalogReader.java
Print this page
*** 1,19 ****
/*
! * reserved comment block
! * DO NOT REMOVE OR ALTER!
! */
! // SAXCatalogReader.java - Read XML Catalog files
!
! /*
! * Copyright 2001-2004 The Apache Software Foundation or its licensors,
! * as applicable.
*
- * Licensed 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.
--- 1,13 ----
/*
! * 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.
*** 150,183 ****
/** The constructor */
public SAXCatalogReader(String parserClass) {
this.parserClass = parserClass;
}
! /** Set the SAXCatalogParser class for the given namespace/root
* element type.
*/
public void setCatalogParser(String namespaceURI,
String rootElement,
String parserClass) {
! if (namespaceURI == null) {
! namespaceMap.put(rootElement, parserClass);
! } else {
namespaceMap.put("{"+namespaceURI+"}"+rootElement, parserClass);
}
- }
! /** Get the SAXCatalogParser class for the given namespace/root
* element type.
*/
public String getCatalogParser(String namespaceURI,
String rootElement) {
! if (namespaceURI == null) {
! return (String) namespaceMap.get(rootElement);
! } else {
return (String) namespaceMap.get("{"+namespaceURI+"}"+rootElement);
}
- }
/**
* Parse an XML Catalog file.
*
* @param catalog The catalog to which this catalog file belongs
--- 144,173 ----
/** The constructor */
public SAXCatalogReader(String parserClass) {
this.parserClass = parserClass;
}
! /**
! * Set the SAXCatalogParser class for the given namespace/root
* element type.
*/
public void setCatalogParser(String namespaceURI,
String rootElement,
String parserClass) {
! namespaceURI = namespaceURI != null ? namespaceURI.trim() : "";
namespaceMap.put("{"+namespaceURI+"}"+rootElement, parserClass);
}
! /**
! * Get the SAXCatalogParser class for the given namespace/root
* element type.
*/
public String getCatalogParser(String namespaceURI,
String rootElement) {
! namespaceURI = namespaceURI != null ? namespaceURI.trim() : "";
return (String) namespaceMap.get("{"+namespaceURI+"}"+rootElement);
}
/**
* Parse an XML Catalog file.
*
* @param catalog The catalog to which this catalog file belongs
*** 324,334 ****
if (localName.indexOf(':') > 0) {
localName = localName.substring(localName.indexOf(':')+1);
}
String namespaceURI = null;
! if (prefix.equals("")) {
namespaceURI = atts.getValue("xmlns");
} else {
namespaceURI = atts.getValue("xmlns:" + prefix);
}
--- 314,324 ----
if (localName.indexOf(':') > 0) {
localName = localName.substring(localName.indexOf(':')+1);
}
String namespaceURI = null;
! if (prefix.length() == 0) {
namespaceURI = atts.getValue("xmlns");
} else {
namespaceURI = atts.getValue("xmlns:" + prefix);
}