1 /**
2 * Copyright (C) 2014-2018 Philip Helger (www.helger.com)
3 * philip[at]helger[dot]com
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17 package com.helger.schematron.svrl;
18
19 import javax.annotation.Nonnull;
20 import javax.annotation.Nullable;
21 import javax.annotation.concurrent.Immutable;
22
23 import org.oclc.purl.dsdl.svrl.SchematronOutputType;
24 import org.w3c.dom.Node;
25
26 import com.helger.commons.annotation.DevelopersNote;
27 import com.helger.commons.annotation.PresentForCodeCoverage;
28 import com.helger.commons.io.resource.IReadableResource;
29
30 /**
31 * This is the XML reader for Schematron SVRL documents. It reads XML DOM
32 * documents and returns {@link SchematronOutputType} elements. The reading
33 * itself is done with JAXB.<br>
34 *
35 * @author Philip Helger
36 */
37 @Immutable
38 @Deprecated
39 @DevelopersNote ("Use SVRLMarshaller direct - much more flexibility")
40 public final class SVRLReader
41 {
42 @PresentForCodeCoverage
43 private static final SVRLReader.html#SVRLReader">SVRLReader s_aInstance = new SVRLReader ();
44
45 private SVRLReader ()
46 {}
47
48 /**
49 * Convert the passed resource into a SVRL domain object
50 *
51 * @param aRes
52 * The resource to be converted. May not be <code>null</code>.
53 * @return <code>null</code> if the passed object could not be interpreted as
54 * SVRL.
55 */
56 @Nullable
57 public static SchematronOutputType readXML (@Nonnull final IReadableResource aRes)
58 {
59 return new SVRLMarshaller ().read (aRes);
60 }
61
62 /**
63 * Convert the passed W3C node into a SVRL domain object
64 *
65 * @param aNode
66 * The node to be converted. May not be <code>null</code>.
67 * @return <code>null</code> if the passed object could not be interpreted as
68 * SVRL.
69 */
70 @Nullable
71 public static SchematronOutputType readXML (@Nonnull final Node aNode)
72 {
73 return new SVRLMarshaller ().read (aNode);
74 }
75 }