< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/validation/Util.java

Print this page




  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.xerces.internal.jaxp.validation;
  23 
  24 import javax.xml.transform.stream.StreamSource;
  25 
  26 import com.sun.org.apache.xerces.internal.xni.XNIException;
  27 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
  28 import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException;
  29 import org.xml.sax.SAXException;
  30 import org.xml.sax.SAXParseException;
  31 
  32 /**
  33  * <p>Static utility methods for the Validation API implementation.</p>
  34  *
  35  * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
  36  */
  37 final class Util {
  38 
  39     /**
  40      * Creates a proper {@link XMLInputSource} from a {@link StreamSource}.
  41      *
  42      * @return always return non-null valid object.
  43      */
  44     public static final XMLInputSource toXMLInputSource( StreamSource in ) {
  45         if( in.getReader()!=null )
  46             return new XMLInputSource(
  47             in.getPublicId(), in.getSystemId(), in.getSystemId(),
  48             in.getReader(), null );
  49         if( in.getInputStream()!=null )
  50             return new XMLInputSource(
  51             in.getPublicId(), in.getSystemId(), in.getSystemId(),
  52             in.getInputStream(), null );
  53 
  54         return new XMLInputSource(
  55         in.getPublicId(), in.getSystemId(), in.getSystemId(), false );




  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.xerces.internal.jaxp.validation;
  23 
  24 import javax.xml.transform.stream.StreamSource;
  25 
  26 import com.sun.org.apache.xerces.internal.xni.XNIException;
  27 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
  28 import com.sun.org.apache.xerces.internal.xni.parser.XMLParseException;
  29 import org.xml.sax.SAXException;
  30 import org.xml.sax.SAXParseException;
  31 
  32 /**
  33  * <p>Static utility methods for the Validation API implementation.</p>
  34  *
  35  * @author Kohsuke Kawaguchi
  36  */
  37 final class Util {
  38 
  39     /**
  40      * Creates a proper {@link XMLInputSource} from a {@link StreamSource}.
  41      *
  42      * @return always return non-null valid object.
  43      */
  44     public static final XMLInputSource toXMLInputSource( StreamSource in ) {
  45         if( in.getReader()!=null )
  46             return new XMLInputSource(
  47             in.getPublicId(), in.getSystemId(), in.getSystemId(),
  48             in.getReader(), null );
  49         if( in.getInputStream()!=null )
  50             return new XMLInputSource(
  51             in.getPublicId(), in.getSystemId(), in.getSystemId(),
  52             in.getInputStream(), null );
  53 
  54         return new XMLInputSource(
  55         in.getPublicId(), in.getSystemId(), in.getSystemId(), false );


< prev index next >