GH-2430: rdf:XMLLiteral for RDF 1.1
diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotEvalTest.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotEvalTest.java
index 0a6559e..1be7c55 100644
--- a/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotEvalTest.java
+++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/riot/RiotEvalTest.java
@@ -104,6 +104,7 @@
System.out.println("---- Parsed");
RDFDataMgr.write(System.out, graph, Lang.TURTLE);
System.out.println("---- Expected");
+ results.getPrefixMapping().setNsPrefixes(graph.getPrefixMapping());
RDFDataMgr.write(System.out, results, Lang.TURTLE);
System.out.println("--------");
}
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/system/TestChecker.java b/jena-arq/src/test/java/org/apache/jena/riot/system/TestChecker.java
index caeb426..5687410 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/system/TestChecker.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/system/TestChecker.java
@@ -18,134 +18,137 @@
package org.apache.jena.riot.system;
-import org.apache.jena.graph.Node ;
-import org.apache.jena.riot.ErrorHandlerTestLib ;
-import org.apache.jena.riot.ErrorHandlerTestLib.ExWarning ;
-import org.apache.jena.shared.impl.JenaParameters ;
-import org.apache.jena.sparql.util.NodeFactoryExtra ;
-import org.junit.After ;
-import org.junit.Before ;
-import org.junit.Test ;
+import org.apache.jena.graph.Node;
+import org.apache.jena.riot.ErrorHandlerTestLib;
+import org.apache.jena.riot.ErrorHandlerTestLib.ExWarning;
+import org.apache.jena.shared.impl.JenaParameters;
+import org.apache.jena.sparql.util.NodeFactoryExtra;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/** Tests for node Checker */
public class TestChecker
{
- private boolean b ;
+ private boolean value_enableWhitespaceCheckingOfTypedLiterals;
@Before
public void before() {
- b = JenaParameters.enableWhitespaceCheckingOfTypedLiterals ;
+ value_enableWhitespaceCheckingOfTypedLiterals = JenaParameters.enableWhitespaceCheckingOfTypedLiterals;
// The default is false which allows whitespace around integers.
// Jena seems to allow white space around dateTimes either way.
- // JenaParameters.enableWhitespaceCheckingOfTypedLiterals = true ;
+ // JenaParameters.enableWhitespaceCheckingOfTypedLiterals = true;
}
@After
public void after() {
- JenaParameters.enableWhitespaceCheckingOfTypedLiterals = b;
+ JenaParameters.enableWhitespaceCheckingOfTypedLiterals = value_enableWhitespaceCheckingOfTypedLiterals;
}
@Test
- public void checker_uri_01() { check("<http://example/x>") ; }
+ public void checker_uri_01() { check("<http://example/x>"); }
@Test(expected=ExWarning.class)
- public void checker_uri_02() { check("<x>") ; }
+ public void checker_uri_02() { check("<x>"); }
@Test (expected=ExWarning.class)
- public void checker_uri_03() { check("<urn:abc>") ; }
+ public void checker_uri_03() { check("<urn:abc>"); }
@Test (expected=ExWarning.class)
- public void checker_uri_04() { check("<urn:x:bc>") ; }
+ public void checker_uri_04() { check("<urn:x:bc>"); }
@Test
- public void checker_uri_05() { check("<urn:abc:y>") ; }
+ public void checker_uri_05() { check("<urn:abc:y>"); }
@Test (expected=ExWarning.class)
- public void checker_uri_06() { check("<URN:abc:y>") ; }
+ public void checker_uri_06() { check("<URN:abc:y>"); }
@Test (expected=ExWarning.class)
- public void checker_uri_07() { check("<http://example:80/>") ; }
+ public void checker_uri_07() { check("<http://example:80/>"); }
@Test
- public void checker01() { check("''") ; }
+ public void checker01() { check("''"); }
@Test
- public void checker02() { check("''@en") ; }
+ public void checker02() { check("''@en"); }
@Test (expected=ExWarning.class)
- public void checker10() { check("''^^xsd:dateTime") ; }
+ public void checker10() { check("''^^xsd:dateTime"); }
// Whitespace facet processing.
// Strictly illegal RDF but Jena accepts them.
// See JenaParameters.enableWhitespaceCheckingOfTypedLiterals
@Test
- public void checker11() { check("' 2010-05-19T01:01:01.01+01:00'^^xsd:dateTime") ; }
+ public void checker11() { check("' 2010-05-19T01:01:01.01+01:00'^^xsd:dateTime"); }
@Test
- public void checker12() { check("'\\n2010-05-19T01:01:01.01+01:00\\t\\r '^^xsd:dateTime") ; }
+ public void checker12() { check("'\\n2010-05-19T01:01:01.01+01:00\\t\\r '^^xsd:dateTime"); }
@Test
- public void checker13() { check("' 123'^^xsd:integer") ; }
+ public void checker13() { check("' 123'^^xsd:integer"); }
// Internal white space - illegal
@Test (expected=ExWarning.class)
- public void checker14() { check("'12 3'^^xsd:integer") ; }
+ public void checker14() { check("'12 3'^^xsd:integer"); }
@Test
- public void checker15() { check("'\\n123'^^xsd:integer") ; }
+ public void checker15() { check("'\\n123'^^xsd:integer"); }
// Test all the data type hierarchies that whitespace foo affects.
@Test
- public void checker16() { check("'123.0 '^^xsd:float") ; }
+ public void checker16() { check("'123.0 '^^xsd:float"); }
@Test
- public void checker17() { check("'123.0\\n'^^xsd:double") ; }
+ public void checker17() { check("'123.0\\n'^^xsd:double"); }
@Test(expected=ExWarning.class)
- public void checker18() { check("'\\b123.0\\n'^^xsd:double") ; }
+ public void checker18() { check("'\\b123.0\\n'^^xsd:double"); }
// Other bad lexical forms.
@Test(expected=ExWarning.class)
- public void checker20() { check("'XYZ'^^xsd:integer") ; }
+ public void checker20() { check("'XYZ'^^xsd:integer"); }
// Lang tag
@Test(expected=ExWarning.class)
- public void checker21() { check("'XYZ'@abcdefghijklmn") ; }
+ public void checker21() { check("'XYZ'@abcdefghijklmn"); }
@Test(expected=ExWarning.class)
- public void checker30() { check("<http://base/[]iri>") ; }
+ public void checker30() { check("<http://base/[]iri>"); }
// XML Literals.
@Test
- public void checker40() { check("\"<x></x>\"^^rdf:XMLLiteral") ; }
+ public void checker40() { check("\"<x></x>\"^^rdf:XMLLiteral"); }
@Test(expected=ExWarning.class)
// Unmatched tag
- public void checker41() { check("\"<x>\"^^rdf:XMLLiteral") ; }
+ public void checker41() { check("\"<x>\"^^rdf:XMLLiteral"); }
+
+ @Test(expected=ExWarning.class)
+ // Unmatched tag
+ public void checker42() { check("\"</x>\"^^rdf:XMLLiteral"); }
@Test(expected=ExWarning.class)
// Bad tagging.
- public void checker42() { check("\"<x><y></x></y>\"^^rdf:XMLLiteral") ; }
+ public void checker43() { check("\"<x><y></x></y>\"^^rdf:XMLLiteral"); }
- @Test(expected=ExWarning.class)
- // Not exclusive canonicalization
- public void checker43() { check("\"<x/>\"^^rdf:XMLLiteral") ; }
+ // Not exclusive canonicalization - bad in RDF 1.0
+ @Test // Valid RDF 1.1
+ public void checker44() { check("\"<x/>\"^^rdf:XMLLiteral"); }
@Test
- public void checker44() { check("'''<x xmlns=\"http://example/ns#\" attr=\"foo\"></x>'''^^rdf:XMLLiteral" ) ; }
+ public void checker45() { check("'''<x xmlns=\"http://example/ns#\" attr=\"foo\"></x>'''^^rdf:XMLLiteral" ); }
- @Test(expected=ExWarning.class)
- // Exclusive canonicalization requires namespace declaration before attributes
- public void checker45() { check("'''<x attr=\"foo\" xmlns=\"http://example/ns#\"></x>'''^^rdf:XMLLiteral") ; }
+ // Exclusive canonicalization requires namespace declaration before attributes - bad in RDF 1.0
+ @Test // Valid RDF 1.1
+ public void checker46() { check("'''<x attr=\"foo\" xmlns=\"http://example/ns#\"></x>'''^^rdf:XMLLiteral"); }
private static ErrorHandler errorHandler = new ErrorHandlerTestLib.ErrorHandlerEx();
- private static void check(String string)
- {
- Node n = NodeFactoryExtra.parseNode(string) ;
+ private static void check(String string) {
+ Node n = NodeFactoryExtra.parseNode(string);
Checker.check(n, errorHandler, -1, -1);
}
}
diff --git a/jena-core/src/main/java/org/apache/jena/datatypes/xsd/impl/XMLLiteralType.java b/jena-core/src/main/java/org/apache/jena/datatypes/xsd/impl/XMLLiteralType.java
new file mode 100644
index 0000000..10832f8
--- /dev/null
+++ b/jena-core/src/main/java/org/apache/jena/datatypes/xsd/impl/XMLLiteralType.java
@@ -0,0 +1,229 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.datatypes.xsd.impl;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Objects;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.jena.atlas.lib.Lib;
+import org.apache.jena.atlas.logging.Log;
+import org.apache.jena.datatypes.BaseDatatype;
+import org.apache.jena.datatypes.DatatypeFormatException;
+import org.apache.jena.datatypes.RDFDatatype;
+import org.apache.jena.graph.impl.LiteralLabel;
+import org.apache.jena.shared.JenaException;
+import org.apache.jena.util.JenaXMLInput;
+import org.apache.jena.util.JenaXMLOutput;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * <a href="https://www.w3.org/TR/rdf-concepts/#section-XMLLiteral"<rdf:XMLLiteral</a>.
+ * <p>
+ * This implementation has RDF 1.1/RDF1.2 semantics.
+ * <p>
+ * Valid XML is legal. The value space is an XML document fragment.
+ */
+public class XMLLiteralType extends BaseDatatype implements RDFDatatype {
+
+ public static String XMLLiteralTypeURI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral";
+ /** Singleton instance */
+ // Include the string for the RDF namespace, do not use RDF.getURI(), to avoid the risk of an initializer circularity.
+ public static final RDFDatatype theXMLLiteralType = new XMLLiteralType(XMLLiteralTypeURI);
+
+ private static final String xmlWrapperTagName = "xml-literal-fragment";
+ private static final String xmlWrapperTagStart = "<"+xmlWrapperTagName+">";
+ private static final String xmlWrapperTagEnd = "</"+xmlWrapperTagName+">";
+
+ /**
+ * Test where an {@link RDFDatatype} is that for {@code rdf:XMLLiteral}.
+ */
+ public static boolean isXMLLiteral(RDFDatatype rdfDatatype) {
+ Objects.requireNonNull(rdfDatatype);
+ return XMLLiteralTypeURI.equals(rdfDatatype.getURI());
+ }
+
+ private XMLLiteralType(String uri) {
+ super(uri);
+ }
+
+ /**
+ * Compares two instances of values of the given datatype.
+ */
+ @Override
+ public boolean isEqual(LiteralLabel value1, LiteralLabel value2) {
+ try {
+ if ( ! value1.getDatatype().getURI().equals(XMLLiteralTypeURI) )
+ return false;
+ if ( ! value2.getDatatype().getURI().equals(XMLLiteralTypeURI) )
+ return false;
+ DocumentFragment f1 = (DocumentFragment)value1.getValue();
+ DocumentFragment f2 = (DocumentFragment)value2.getValue();
+ return f1.isEqualNode(f2);
+ } catch (Exception ex) {
+ throw new DatatypeFormatException();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public Object parse(String lexicalForm) {
+ try {
+ return xmlLiteralValue(lexicalForm);
+ } catch (Exception ex) {
+ throw new DatatypeFormatException();
+ }
+ }
+
+ /**
+ * Parse a lexical form for an rdf:XMLLiteral to produce the literal value.
+ * The value is an XML {@link DocumentFragment}.
+ */
+ public static DocumentFragment xmlLiteralValue(String string) {
+ DocumentBuilder builder = newDocumentBuilder();
+ builder.isNamespaceAware();
+ ErrorHandlerCounting eh = new ErrorHandlerCounting();
+ builder.setErrorHandler(eh);
+
+ // Wrap in an outer start-finish to make it into a XML document
+ String xmlString = xmlWrapperTagStart+string+xmlWrapperTagEnd;
+
+ // Parse document.
+ InputSource source = new InputSource(new StringReader(xmlString));
+ final Document doc;
+ try {
+ doc = builder.parse(source);
+ if ( eh.errorHappened() )
+ return null;
+ doc.normalizeDocument();
+ } catch (IOException ex) {
+ throw new java.io.UncheckedIOException(ex);
+ } catch (SAXException ex) {
+ throw Lib.runtimeException(ex);
+ }
+ // Unwrap the outer start-finish element.
+ NodeList nodeList0 = doc.getChildNodes();
+ if ( nodeList0.getLength() != 1 )
+ throw new JenaException("XML parser did not produce exactly one child node");
+ // The DocumentFragment as a NodeList.
+ NodeList nodeList = nodeList0.item(0).getChildNodes();
+
+ // The value of an rdf:XMLLIteral is a org.w3c.dom.DocumentFragment object.
+ // Build the DocumentFragment -- NB "appendChild" removes from the doc DOM
+ // if the node comes form the parsed document, which is it in our situation.
+ // Hence the "item(0)" removes the nodes in order.
+ DocumentFragment docFrag = doc.createDocumentFragment();
+ while(nodeList.getLength() > 0) {
+ Node n = nodeList.item(0);
+ docFrag.appendChild(n); // Destructive - removes from doc, changes nodeList
+ }
+ return docFrag;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String unparse(Object value) {
+ // "unparse" value to string.
+ if ( value instanceof DocumentFragment docFrag )
+ return xmlDocumentFragmentToString(docFrag);
+ throw new IllegalArgumentException("Value is not a ocumentFragment");
+ }
+
+ /**
+ * Turn an org.w3c.dom.DocumentFragment into a string.
+ */
+ public static String xmlDocumentFragmentToString(DocumentFragment fragment) {
+ StringWriter sw = new StringWriter();
+ Source source = new DOMSource(fragment);
+ try {
+ Transformer transformer = JenaXMLOutput.xmlTransformer();
+ // Essential for a DocumentFragment
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ //transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ StreamResult output = new StreamResult(sw);
+ transformer.transform(source, output);
+ } catch (TransformerException ex) {
+ Log.error(XMLLiteralType.class, "Failed to convert an org.w3c.dom.Node to a string", ex);
+ // Fall through
+ }
+ return sw.toString();
+ }
+
+ private static DocumentBuilder newDocumentBuilder() {
+ try {
+ return docBuilderFactory.newDocumentBuilder();
+ } catch (ParserConfigurationException ex) {
+ throw Lib.runtimeException(ex);
+ }
+ }
+
+ private static DocumentBuilderFactory docBuilderFactory = createDocumentBuilderFactory();
+ private static DocumentBuilderFactory createDocumentBuilderFactory() {
+ try {
+ return JenaXMLInput.newDocumentBuilderFactory();
+ } catch (ParserConfigurationException ex) {
+ Log.error(XMLLiteralType.class, "Failed to build a javax.xml.parsers.DocumentBuilderFactory", ex);
+ return null;
+ }
+ }
+
+ private static class ErrorHandlerCounting implements ErrorHandler {
+ int warning = 0;
+ int errors = 0;
+ int fatalErrors = 0;
+
+ boolean errorHappened() {
+ return errors > 0 || fatalErrors > 0;
+ }
+
+ @Override
+ public void warning(SAXParseException exception) {
+ warning++;
+ }
+
+ @Override
+ public void error(SAXParseException exception) {
+ errors++;
+ }
+
+ @Override
+ public void fatalError(SAXParseException exception) throws SAXException {
+ fatalErrors++;
+ throw exception;
+ }
+ }
+}
diff --git a/jena-core/src/main/java/org/apache/jena/datatypes/xsd/impl/XSDBaseNumericType.java b/jena-core/src/main/java/org/apache/jena/datatypes/xsd/impl/XSDBaseNumericType.java
index 22ba236..788c225 100644
--- a/jena-core/src/main/java/org/apache/jena/datatypes/xsd/impl/XSDBaseNumericType.java
+++ b/jena-core/src/main/java/org/apache/jena/datatypes/xsd/impl/XSDBaseNumericType.java
@@ -29,23 +29,23 @@
/**
* Base implementation for all numeric datatypes derived from
* xsd:decimal. The only purpose of this place holder is
- * to support the isValidLiteral tests across numeric types.
+ * to support the isValidLiteral tests across numeric types.
* * <p>Note that float and double are not included in this set.
*/
public class XSDBaseNumericType extends XSDDatatype {
/**
- * Constructor.
- * @param typeName the name of the XSD type to be instantiated, this is
+ * Constructor.
+ * @param typeName the name of the XSD type to be instantiated, this is
* used to lookup a type definition from the Xerces schema factory.
*/
public XSDBaseNumericType(String typeName) {
super(typeName);
}
-
+
/**
- * Constructor.
- * @param typeName the name of the XSD type to be instantiated, this is
+ * Constructor.
+ * @param typeName the name of the XSD type to be instantiated, this is
* used to lookup a type definition from the Xerces schema factory.
* @param javaClass the java class for which this xsd type is to be
* treated as the cannonical representation
@@ -54,7 +54,7 @@
super(typeName, javaClass);
}
-
+
/**
* Test whether the given LiteralLabel is a valid instance
* of this datatype. This takes into account typing information
@@ -79,7 +79,7 @@
return false;
}
}
-
+
/**
* Test whether the given object is a legal value form
* of this datatype. Brute force implementation.
@@ -92,16 +92,16 @@
return false;
}
}
-
+
/**
* Cannonicalise a java Object value to a normal form.
* Primarily used in cases such as xsd:integer to reduce
* the Java object representation to the narrowest of the Number
- * subclasses to ensure that indexing of typed literals works.
+ * subclasses to ensure that indexing of typed literals works.
*/
@Override
public Object cannonicalise( Object value ) {
-
+
if (value instanceof BigInteger) {
return cannonicalizeInteger( (BigInteger)value );
} else if (value instanceof BigDecimal) {
@@ -109,7 +109,7 @@
}
return suitableInteger( ((Number)value).longValue() );
}
-
+
private static final BigInteger ten = new BigInteger("10");
private static final int QUOT = 0;
private static final int REM = 1;
@@ -139,7 +139,7 @@
return cannonicalizeInteger( value.toBigInteger() );
}
}
-
+
/**
* Cannonicalize a big integer
*/
@@ -150,31 +150,31 @@
return suitableInteger( value.longValue() );
}
}
-
+
/**
* Parse a lexical form of this datatype to a value
* @throws DatatypeFormatException if the lexical form is not legal
*/
@Override
public Object parse(String lexicalForm) throws DatatypeFormatException {
- checkWhitespace(lexicalForm);
+ checkWhitespace(lexicalForm);
return super.parse(lexicalForm);
}
-
+
/**
* Convert a value of this datatype to lexical form.
- * Certain forms are not a simple matter of java's toString on the Number object.
+ * Certain forms are not a simple matter of java's toString on the Number object.
*/
@Override
public String unparse(Object value) {
if ( value instanceof BigDecimal )
// Avoid exponent usage.
return ((BigDecimal)value).toPlainString() ;
- // See also for XSDfloat and XSDdouble.
+ // See also for XSDfloat and XSDdouble.
// Integer hierarchy is OK.
return value.toString();
}
-
+
/**
* Check for whitespace violations.
* Turned off by default.
@@ -186,7 +186,7 @@
}
}
}
-
+
/**
* Compares two instances of values of the given datatype.
*/
@@ -199,7 +199,7 @@
// us just that equals doesn't work on BigDecimals in the way you expect
if (n1 instanceof BigDecimal && n2 instanceof BigDecimal) {
return ((BigDecimal)n1).compareTo((BigDecimal)n2) == 0;
- }
+ }
return n1.equals(n2);
} else {
// At least one arg is not part of the integer hierarchy
diff --git a/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabel.java b/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabel.java
index 9cb19d5..06b5adb 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabel.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/impl/LiteralLabel.java
@@ -471,6 +471,7 @@
public boolean sameValueAs( LiteralLabel other ) {
return sameValueAs(this, other);
}
+
/**
* Two literal labels are the "same value" if they are the same string,
* or same language string or same value-by-datatype or .equals (= Same RDF Term)
diff --git a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput0/DOM2Model.java b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput0/DOM2Model.java
index dcff057..677d11f 100644
--- a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput0/DOM2Model.java
+++ b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput0/DOM2Model.java
@@ -20,12 +20,12 @@
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXResult;
import org.apache.jena.rdf.model.Model ;
import org.apache.jena.shared.JenaException ;
+import org.apache.jena.util.JenaXMLOutput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Node;
@@ -36,12 +36,12 @@
* 1.4.1.
*/
public class DOM2Model extends SAX2Model {
-
+
static Logger logger = LoggerFactory.getLogger(DOM2Model.class) ;
-
+
/**
* Create a new DOM2Model.
- *
+ *
* @param base
* The retrieval URL, or the base URI to be used while parsing.
* @param m
@@ -49,8 +49,8 @@
* it is null, then use {@link SAX2RDF#getHandlers}or
* {@link SAX2RDF#setHandlersWith}to provide a {@link StatementHandler},
* and usually an {@link org.xml.sax.ErrorHandler}
- * @throws SAXParseException
- */
+ * @throws SAXParseException
+ */
static public DOM2Model createD2M(String base, Model m) throws SAXParseException {
return new DOM2Model(base, m, "", true) ;
}
@@ -60,7 +60,7 @@
* needs to find this value in the outer context. Optionally, namespace
* prefixes can be passed from the outer context using
* {@link SAX2RDF#startPrefixMapping}.
- *
+ *
* @param base
* The retrieval URL, or the base URI to be used while parsing.
* @param m
@@ -71,7 +71,7 @@
* @param lang
* The current value of <code>xml:lang</code> when parsing
* starts, usually "".
- * @throws SAXParseException
+ * @throws SAXParseException
*/
static public DOM2Model createD2M(String base, Model m, String lang) throws SAXParseException {
return new DOM2Model(base, m, lang, true) ;
@@ -85,7 +85,7 @@
/**
* Parse a DOM Node with the RDF/XML parser, loading the triples into the
* associated Model. Known not to work with Java 1.4.1.
- *
+ *
* @param document
*/
public void load(Node document) {
@@ -96,17 +96,16 @@
output.setLexicalHandler(this);
// Run transform
- TransformerFactory xformFactory = TransformerFactory.newInstance();
try {
- Transformer idTransform = xformFactory.newTransformer();
+ Transformer idTransform = JenaXMLOutput.xmlTransformer();
idTransform.transform(input, output);
}
catch (FatalParsingErrorException e) {
// Old code ignored this,
// given difficult bug report, don't be silent.
logger.error("Unexpected exception in DOM2Model", e) ;
-
- }
+
+ }
catch (RuntimeException rte) {
throw rte;
} catch (Exception nrte) {
diff --git a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput0/XMLLiteralTypeARP0.java b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput0/XMLLiteralTypeARP0.java
index 8ef2f4d..c4a7707 100644
--- a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput0/XMLLiteralTypeARP0.java
+++ b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput0/XMLLiteralTypeARP0.java
@@ -21,9 +21,10 @@
import java.io.IOException ;
import java.io.StringReader ;
-import org.apache.jena.datatypes.BaseDatatype ;
+import org.apache.jena.datatypes.BaseDatatype;
import org.apache.jena.datatypes.DatatypeFormatException ;
-import org.apache.jena.datatypes.RDFDatatype ;
+import org.apache.jena.datatypes.RDFDatatype;
+import org.apache.jena.datatypes.xsd.impl.XMLLiteralType;
import org.apache.jena.shared.BrokenException ;
import org.xml.sax.ErrorHandler ;
import org.xml.sax.SAXException ;
@@ -32,19 +33,14 @@
/**
* Builtin data type to represent XMLLiteral (i.e. items created
* by use of <code>rdf:parsetype='literal'</code>.
+ * Version of rdf:XMLLiteral using ARP1 and hence has RDF1.0 semantics for the value space
*/
-public class XMLLiteralType0 extends BaseDatatype implements RDFDatatype {
+@Deprecated(forRemoval=true, since="5.0.0")
+public class XMLLiteralTypeARP0 extends BaseDatatype implements RDFDatatype {
+ public static final RDFDatatype dtRDF10 = new XMLLiteralTypeARP0(XMLLiteralType.XMLLiteralTypeURI);
- public static String XMLLiteralTypeURI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral";
- /** Singleton instance */
- // Include the string for the RDF namespace, not use RDF.getURI(), to avoid an initializer circularity
- public static final RDFDatatype theXMLLiteralType = new XMLLiteralType0(XMLLiteralTypeURI);
-
- /**
- * Private constructor.
- */
- private XMLLiteralType0(String uri) {
+ private XMLLiteralTypeARP0(String uri) {
super(uri);
}
@@ -73,7 +69,6 @@
* of this datatype.
*/
@Override
- @SuppressWarnings("deprecation")
public boolean isValid(final String lexicalForm) {
/*
* To check the lexical form we construct
diff --git a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput1/DOM2Model.java b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput1/DOM2Model.java
index c270332..e2a4be2 100644
--- a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput1/DOM2Model.java
+++ b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput1/DOM2Model.java
@@ -20,12 +20,12 @@
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXResult;
import org.apache.jena.rdf.model.Model ;
import org.apache.jena.shared.JenaException ;
+import org.apache.jena.util.JenaXMLOutput;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Node;
@@ -36,12 +36,12 @@
* 1.4.1.
*/
public class DOM2Model extends SAX2Model {
-
+
static Logger logger = LoggerFactory.getLogger(DOM2Model.class) ;
-
+
/**
* Create a new DOM2Model.
- *
+ *
* @param base
* The retrieval URL, or the base URI to be used while parsing.
* @param m
@@ -49,8 +49,8 @@
* it is null, then use {@link SAX2RDF#getHandlers}or
* {@link SAX2RDF#setHandlersWith}to provide a {@link StatementHandler},
* and usually an {@link org.xml.sax.ErrorHandler}
- * @throws SAXParseException
- */
+ * @throws SAXParseException
+ */
static public DOM2Model createD2M(String base, Model m) throws SAXParseException {
return new DOM2Model(base, m, "", true) ;
}
@@ -60,7 +60,7 @@
* needs to find this value in the outer context. Optionally, namespace
* prefixes can be passed from the outer context using
* {@link SAX2RDF#startPrefixMapping}.
- *
+ *
* @param base
* The retrieval URL, or the base URI to be used while parsing.
* @param m
@@ -71,7 +71,7 @@
* @param lang
* The current value of <code>xml:lang</code> when parsing
* starts, usually "".
- * @throws SAXParseException
+ * @throws SAXParseException
*/
static public DOM2Model createD2M(String base, Model m, String lang) throws SAXParseException {
return new DOM2Model(base, m, lang, true) ;
@@ -85,7 +85,7 @@
/**
* Parse a DOM Node with the RDF/XML parser, loading the triples into the
* associated Model. Known not to work with Java 1.4.1.
- *
+ *
* @param document
*/
public void load(Node document) {
@@ -96,17 +96,16 @@
output.setLexicalHandler(this);
// Run transform
- TransformerFactory xformFactory = TransformerFactory.newInstance();
try {
- Transformer idTransform = xformFactory.newTransformer();
+ Transformer idTransform = JenaXMLOutput.xmlTransformer();
idTransform.transform(input, output);
}
catch (FatalParsingErrorException e) {
// Old code ignored this,
// given difficult bug report, don't be silent.
logger.error("Unexpected exception in DOM2Model", e) ;
-
- }
+
+ }
catch (RuntimeException rte) {
throw rte;
} catch (Exception nrte) {
diff --git a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput1/XMLLiteralTypeARP1.java b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput1/XMLLiteralTypeARP1.java
index c8fad70..82a27f0 100644
--- a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput1/XMLLiteralTypeARP1.java
+++ b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput1/XMLLiteralTypeARP1.java
@@ -16,18 +16,15 @@
* limitations under the License.
*/
-package org.apache.jena.datatypes.xsd.impl;
+package org.apache.jena.rdfxml.xmlinput1;
import java.io.IOException ;
import java.io.StringReader ;
-import org.apache.jena.datatypes.BaseDatatype ;
+import org.apache.jena.datatypes.BaseDatatype;
import org.apache.jena.datatypes.DatatypeFormatException ;
-import org.apache.jena.datatypes.RDFDatatype ;
-import org.apache.jena.rdfxml.xmlinput1.ALiteral;
-import org.apache.jena.rdfxml.xmlinput1.ARP;
-import org.apache.jena.rdfxml.xmlinput1.AResource;
-import org.apache.jena.rdfxml.xmlinput1.StatementHandler;
+import org.apache.jena.datatypes.RDFDatatype;
+import org.apache.jena.datatypes.xsd.impl.XMLLiteralType;
import org.apache.jena.shared.BrokenException ;
import org.xml.sax.ErrorHandler ;
import org.xml.sax.SAXException ;
@@ -36,20 +33,14 @@
/**
* Builtin data type to represent XMLLiteral (i.e. items created
* by use of <code>rdf:parsetype='literal'</code>.
+ * Version of rdf:XMLLiteral using ARP1 and hence has RDF1.0 semantics for the value space
*/
-@SuppressWarnings("deprecation")
-public class XMLLiteralType extends BaseDatatype implements RDFDatatype {
+@Deprecated(forRemoval=true, since="5.0.0")
+public class XMLLiteralTypeARP1 extends BaseDatatype implements RDFDatatype {
+ public static final RDFDatatype dtRDF10 = new XMLLiteralTypeARP1(XMLLiteralType.XMLLiteralTypeURI);
- public static String XMLLiteralTypeURI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral";
- /** Singleton instance */
- // Include the string for the RDF namespace, not use RDF.getURI(), to avoid an initializer circularity
- public static final RDFDatatype theXMLLiteralType = new XMLLiteralType(XMLLiteralTypeURI);
-
- /**
- * Private constructor.
- */
- private XMLLiteralType(String uri) {
+ private XMLLiteralTypeARP1(String uri) {
super(uri);
}
diff --git a/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/RDFXML_Basic.java b/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/RDFXML_Basic.java
index 4a186bc..7a38f00 100644
--- a/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/RDFXML_Basic.java
+++ b/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/RDFXML_Basic.java
@@ -151,11 +151,11 @@
}
}
- protected void writeLiteral( Literal l, PrintWriter writer ) {
- String lang = l.getLanguage();
- String form = l.getLexicalForm();
- boolean isXML = XMLLiteralType.theXMLLiteralType.equals(l.getDatatype());
- if (Util.isLangString(l)) {
+ protected void writeLiteral( Literal literal, PrintWriter writer ) {
+ String lang = literal.getLanguage();
+ String form = literal.getLexicalForm();
+ boolean isXML = XMLLiteralType.isXMLLiteral(literal.getDatatype());
+ if (Util.isLangString(literal)) {
writer.print(" xml:lang=" + attributeQuoted( lang ));
} else if ( isXML && !blockLiterals) {
// RDF XML Literals inline.
@@ -164,8 +164,8 @@
return ;
} else {
// Datatype (if not xsd:string and RDF 1.1)
- String dt = l.getDatatypeURI();
- if ( ! Util.isSimpleString(l) )
+ String dt = literal.getDatatypeURI();
+ if ( ! Util.isSimpleString(literal) )
writer.print( " " + rdfAt( "datatype" ) + "=" + substitutedAttribute( dt ) );
}
// Content.
diff --git a/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/Unparser.java b/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/Unparser.java
index f36cbfe..db7e80f 100644
--- a/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/Unparser.java
+++ b/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/Unparser.java
@@ -427,24 +427,26 @@
* [6.12.2] propertyElt ::= '<' propName idAttr? parseLiteral '>' literal '</'
* propName '>'
*/
- private boolean wPropertyEltLiteral(WType wt, Property prop, Statement s, RDFNode r) {
+ private boolean wPropertyEltLiteral(WType wt, Property prop, Statement statement, RDFNode rdfNode) {
if (prettyWriter.sParseTypeLiteralPropertyElt)
return false;
- boolean isXML = (r instanceof Literal) && XMLLiteralType.theXMLLiteralType.equals(((Literal) r).getDatatype());
- if (! isXML ) {
+ if ( ! (rdfNode instanceof Literal lit) )
return false;
- }
+
+ if (! XMLLiteralType.isXMLLiteral(lit.getDatatype()) )
+ return false;
+
// print out.
- done(s);
+ done(statement);
tab();
print("<");
wt.wTypeStart(prop);
- wIdAttrReified(s);
+ wIdAttrReified(statement);
maybeNewline();
wParseLiteral();
maybeNewline();
print(">");
- print(((Literal) r).getLexicalForm());
+ print(lit.getLexicalForm());
print("</");
wt.wTypeEnd(prop);
print(">");
diff --git a/jena-core/src/main/java/org/apache/jena/util/JenaXMLInput.java b/jena-core/src/main/java/org/apache/jena/util/JenaXMLInput.java
index 8bb5684..498f86d 100644
--- a/jena-core/src/main/java/org/apache/jena/util/JenaXMLInput.java
+++ b/jena-core/src/main/java/org/apache/jena/util/JenaXMLInput.java
@@ -49,7 +49,6 @@
public class JenaXMLInput {
// ---- SAX
- // RDFXMLParser
private static SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
static {
@@ -72,6 +71,7 @@
}
public static XMLReader createXMLReader() throws ParserConfigurationException, SAXException {
+ // Used by RRX: ReaderRDFXML_SAX
/*
* https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html#xmlreader
* ----
@@ -111,7 +111,8 @@
static { initXMLInputFactory(xmlInputFactory); }
// ---- StAX
- // RRX SR and RRX EV, TriX and SPARQL XML Results.
+ // Used by SysRRX for RRX SR (StreamReader) and RRX EV (XMLEventReader),
+ // for TriX and for SPARQL XML Results.
/**
* Initialize an XMLInputFactory to Jena settings such as protecting against XXE.
* Return the XMLInputFactory.
@@ -151,7 +152,7 @@
setXMLInputFactoryProperty(xmlInputFactory, XMLConstants.ACCESS_EXTERNAL_DTD, "");
return xmlInputFactory;
- // RRX
+ // Modified by RRX SysRRX.createXMLInputFactory()
// private static XMLInputFactory createXMLInputFactory() {
// XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
// JenaXMLInput.initXMLInputFactory(xmlInputFactory);
@@ -162,8 +163,6 @@
// xmlInputFactory.setProperty(XMLInputFactory.IS_COALESCING, Boolean.FALSE);
// return xmlInputFactory;
// }
-
-
}
/**
@@ -195,9 +194,11 @@
}
// ---- DocumentBuilder
- // For reference - not used in Jena src/main, but is used in src/test DOM2RDFTest and MoreDOM2RDFTest
+ // Used by XMLLiteralType (rdf:XMLLitral)
+
public static DocumentBuilderFactory newDocumentBuilderFactory() throws ParserConfigurationException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
// Causes SAXParseException if there is an external entity.
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
return factory;
diff --git a/jena-core/src/test/java/org/apache/jena/datatypes/TestPackage_dt.java b/jena-core/src/test/java/org/apache/jena/datatypes/TestPackage_dt.java
index 446189e..f0df6a9 100644
--- a/jena-core/src/test/java/org/apache/jena/datatypes/TestPackage_dt.java
+++ b/jena-core/src/test/java/org/apache/jena/datatypes/TestPackage_dt.java
@@ -31,11 +31,12 @@
static public TestSuite suite() {
return new TestPackage_dt();
}
-
+
/** Creates new TestPackage */
private TestPackage_dt() {
super("datatypes");
addTest(new JUnit4TestAdapter(TestDatatypes.class)) ;
addTest(new JUnit4TestAdapter(TestDatatypeValues.class)) ;
+ addTest(new JUnit4TestAdapter(TestRDFXMLiteral.class)) ;
}
}
diff --git a/jena-core/src/test/java/org/apache/jena/datatypes/TestRDFXMLiteral.java b/jena-core/src/test/java/org/apache/jena/datatypes/TestRDFXMLiteral.java
new file mode 100644
index 0000000..8297208
--- /dev/null
+++ b/jena-core/src/test/java/org/apache/jena/datatypes/TestRDFXMLiteral.java
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.datatypes;
+
+import static org.junit.Assert.*;
+
+import org.apache.jena.datatypes.xsd.impl.XMLLiteralType;
+import org.apache.jena.graph.Node;
+import org.apache.jena.graph.NodeFactory;
+import org.junit.Test;
+
+public class TestRDFXMLiteral {
+ // Different RDF terms with the same value.
+
+ @Test public void rdfxmlLiteral_1() {
+ // Normalization -> different terms, same value
+ test("<x></x>", "<x/>", false, false, true);
+ }
+
+ @Test public void rdfxmlLiteral_2() {
+ // Normalization -> different terms, same value
+ test("<x b='8' a='123'></x>", "<x a='123' b='8'/>", false, false, true);
+ }
+
+ @Test public void rdfxmlLiteral_3() {
+ // Same term.
+ test("<x a:b='8' xmlns:a='http://ex/'></x>", "<x a:b='8' xmlns:a='http://ex/'></x>", true, true, true);
+ }
+
+ @Test public void rdfxmlLiteral_4() {
+ // Different term by trivial white space (removed by XML Node normalization)
+ test("<x b='8' xmlns:a='http://ex/'></x>","<x b='8' xmlns:a='http://ex/' ></x>", false, false, true);
+ }
+
+ // Lexical forms do not conform to the lexical space of legal XML fragments.
+ @Test public void rdfxmlLiteral_illgeal_1() {
+ test("<x>", "<x>", true, true, true);
+ }
+
+ @Test public void rdfxmlLiteral_illgeal_2() {
+ test("<x>", "<y>", false, false, false);
+ }
+
+ // ----
+
+ private static void test(String lex1, String lex2, boolean javaEquals, boolean sameTerm, boolean sameValue) {
+ Node n1 = NodeFactory.createLiteral(lex1, XMLLiteralType.theXMLLiteralType);
+ Node n2 = NodeFactory.createLiteral(lex2, XMLLiteralType.theXMLLiteralType);
+ assertEquals(javaEquals, n1.equals(n2));
+ assertEquals(sameTerm, n1.sameTermAs(n2));
+ assertEquals(sameValue, n1.sameValueAs(n2));
+ }
+
+}
diff --git a/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput1/WGTestSuite.java b/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput1/WGTestSuite.java
index 01a2fc9..58b8dc0 100644
--- a/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput1/WGTestSuite.java
+++ b/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput1/WGTestSuite.java
@@ -775,10 +775,9 @@
Model m2 = read(out, outtype);
super.runTest();
if (!m1.isIsomorphicWith(m2)) {
- // save(output);
- System.err.println("=====");
+ System.err.println("== m1 ==");
m1.write(System.err,"N-TRIPLE");
- System.err.println("=====");
+ System.err.println("== m2 ==");
m2.write(System.err,"N-TRIPLE");
System.err.println("=====");
fail("Models were not equal.");
diff --git a/jena-core/src/test/java/org/apache/jena/rdfxml/xmloutput/TestXMLFeatures.java b/jena-core/src/test/java/org/apache/jena/rdfxml/xmloutput/TestXMLFeatures.java
index 0293d96..c1fc70c5 100644
--- a/jena-core/src/test/java/org/apache/jena/rdfxml/xmloutput/TestXMLFeatures.java
+++ b/jena-core/src/test/java/org/apache/jena/rdfxml/xmloutput/TestXMLFeatures.java
@@ -33,7 +33,6 @@
import org.apache.jena.rdf.model.RDFWriterI ;
import org.apache.jena.rdf.model.impl.RDFDefaultErrorHandler ;
import org.apache.jena.rdf.model.impl.Util ;
-import org.apache.jena.rdf.model.test.ModelTestBase ;
import org.apache.jena.rdfxml.xmlinput1.RDFXMLReader;
import org.apache.jena.rdfxml.xmloutput.impl.BaseXMLWriter ;
import org.apache.jena.rdfxml.xmloutput.impl.SimpleLogger ;
@@ -60,49 +59,9 @@
return getName() + " " + lang;
}
- public void SUPPRESSEDtestRelativeURI() {
- Model m = ModelFactory.createDefaultModel();
- m.createResource("foo").addProperty(RDF.value, "bar");
- m.write(new OutputStream() {
- @Override
- public void write(int b) {
- }
- }, lang);
- }
-
- public void SUPPRESStestNoStripes() throws IOException {
- check("testing/abbreviated/collection.rdf",
- " <[a-zA-Z][-a-zA-Z0-9._]*:Class",
- Change.blockRules("resourcePropertyElt"),
- "http://example.org/foo");
- }
-
- /**
- * Very specific test case to trap bug whereby a model which has a prefix
- * j.0 defined (eg it was read in from a model we wrote out earlier) wants
- * to allocate a new j.* prefix and picked j.0, BOOM.
- */
- public void SUPPRESSEDtestBrokenPrefixing() {
- Model m = ModelFactory.createDefaultModel();
- m.add(ModelTestBase.statement(m, "a http://bingle.bongle/booty#PP b"));
- m.add(ModelTestBase.statement(m, "c http://dingle.dongle/dooty#PP d"));
- StringWriter sw = new StringWriter();
- m.write(sw, "RDF/XML");
- Model m2 = ModelFactory.createDefaultModel();
- String written = sw.toString();
- m2.read(new StringReader(written), "", "RDF/XML");
- StringWriter sw2 = new StringWriter();
- m2.write(sw2, "RDF/XML");
- String s2 = sw2.toString();
- int first = s2.indexOf("xmlns:j.0=");
- int last = s2.lastIndexOf("xmlns:j.0=");
- assertEquals(first, last);
- System.out.println(sw2.toString());
- }
-
/**
* Writing a model with the base URI set to null should not throw a
- * nullpointer exception.
+ * null pointer exception.
*/
public void testNullBaseWithAbbrev() {
ModelFactory.createDefaultModel().write(new StringWriter(), lang, null);
diff --git a/jena-iri/src/main/java/org/apache/jena/iri/impl/BuildViolationCodes.java b/jena-iri/src/main/java/org/apache/jena/iri/impl/BuildViolationCodes.java
index 9deca5a..b018f60 100644
--- a/jena-iri/src/main/java/org/apache/jena/iri/impl/BuildViolationCodes.java
+++ b/jena-iri/src/main/java/org/apache/jena/iri/impl/BuildViolationCodes.java
@@ -30,14 +30,12 @@
public class BuildViolationCodes {
public static void main(String[] args) throws TransformerException, TransformerFactoryConfigurationError {
System.out.println();
- Transformer xsl =
- TransformerFactory.newInstance().newTransformer(
- new StreamSource(new File("src/main/xml/org/apache/jena/iri/impl/viol2java.xsl"))
- );
+ Transformer xsl = TransformerFactory.newInstance()
+ .newTransformer(
+ new StreamSource(new File("src/main/xml/org/apache/jena/iri/impl/viol2java.xsl")));
xsl.transform(
new StreamSource(new File("src/main/xml/org/apache/jena/iri/impl/violations.xml")),
new StreamResult(new File("src/main/java/org/apache/jena/iri/ViolationCodes.java"))
-
);
System.out.println("Finished BuildViolationCodes");
}