Return-Path: Delivered-To: apmail-incubator-geronimo-cvs-archive@www.apache.org Received: (qmail 15522 invoked from network); 21 Mar 2004 17:49:24 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 21 Mar 2004 17:49:24 -0000 Received: (qmail 74835 invoked by uid 500); 21 Mar 2004 17:49:16 -0000 Delivered-To: apmail-incubator-geronimo-cvs-archive@incubator.apache.org Received: (qmail 74632 invoked by uid 500); 21 Mar 2004 17:49:15 -0000 Mailing-List: contact geronimo-cvs-help@incubator.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: geronimo-dev@incubator.apache.org Delivered-To: mailing list geronimo-cvs@incubator.apache.org Received: (qmail 74619 invoked from network); 21 Mar 2004 17:49:15 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 21 Mar 2004 17:49:15 -0000 Received: (qmail 15503 invoked by uid 1751); 21 Mar 2004 17:49:22 -0000 Date: 21 Mar 2004 17:49:22 -0000 Message-ID: <20040321174922.15502.qmail@minotaur.apache.org> From: adc@apache.org To: incubator-geronimo-cvs@apache.org Subject: cvs commit: incubator-geronimo/modules/common/src/java/org/apache/geronimo/common/xml XmlBeansUtil.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N adc 2004/03/21 09:49:22 Added: modules/common/src/java/org/apache/geronimo/common/xml XmlBeansUtil.java Log: I can use this for my networking configuration. Revision Changes Path 1.1 incubator-geronimo/modules/common/src/java/org/apache/geronimo/common/xml/XmlBeansUtil.java Index: XmlBeansUtil.java =================================================================== /** * * Copyright 2004 The Apache Software Foundation * * 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. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.geronimo.common.xml; import java.io.InputStream; import java.io.IOException; import java.util.ArrayList; import java.net.URL; import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.SchemaType; import org.apache.xmlbeans.XmlException; import org.apache.xmlbeans.SchemaTypeLoader; import org.apache.xmlbeans.XmlBeans; import org.apache.xmlbeans.XmlOptions; /** * * * @version $Revision: 1.1 $ $Date: 2004/03/21 17:49:22 $ * * */ public class XmlBeansUtil { private XmlBeansUtil() {} public static XmlObject getPlan(URL planURL, SchemaType type) { InputStream is; try { is = planURL.openStream(); try { return parse(is, type); } finally { is.close(); } } catch (IOException e) { return null; } catch (XmlException e) { return null; } } public static XmlObject parse(InputStream is, SchemaType type) throws IOException, XmlException { ArrayList errors = new ArrayList(); SchemaTypeLoader loader = XmlBeans.getContextTypeLoader(); XmlOptions options = new XmlOptions(); options.setLoadLineNumbers(); options.setErrorListener(errors); return loader.parse(is, type, options); } }