Skip to content

Commit

Permalink
Merge pull request #9 from usnistgov/json2xml-fix
Browse files Browse the repository at this point in the history
Q1 2025 fixes improvements
  • Loading branch information
JDziurlaj authored Jan 23, 2025
2 parents 697b160 + a73d777 commit 5078adb
Show file tree
Hide file tree
Showing 9 changed files with 2,543 additions and 2,525 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The NIST Test Method license can be found [here](LICENSE.md). NIST Test Data lic
This tool uses several open source libraries including:

- MorganaXProc [GPLv3]
- Saxon-HE 11.5 [MPLv2]
- Saxon-HE [MPLv2]
- schxslt [MIT]
- Xerces 2.12.2 [Apache]

Expand Down
8 changes: 3 additions & 5 deletions catalog_documents/addr_type.xsd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--W3C XML Schema generated by XMLSpy v2018 sp1 (x64) (http://www.altova.com)-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:addr_type="http://www.fgdc.gov/schemas/address/addr_type" xmlns:gml="http://www.opengis.net/gml" targetNamespace="http://www.fgdc.gov/schemas/address/addr_type" elementFormDefault="qualified" version="1.0.0">
<xsd:import namespace="http://www.opengis.net/gml" schemaLocation="geometryPrimitives.xsd"/>
<xsd:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/>
<!--
Adopted FGDC Address Standard, version 1.0.0
Prepared by a Working Group coordinated by URISA and NENA
Expand Down Expand Up @@ -621,9 +621,7 @@ A word, phrase, or symbol used as a separator between components of a complex el
military addresses).
</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:pattern value=".*"/>
</xsd:restriction>
<xsd:restriction base="xsd:string" />
</xsd:simpleType>
<xsd:simpleType name="AddressAuthorityIdentifiertype_old">
<xsd:annotation>
Expand Down Expand Up @@ -2464,4 +2462,4 @@ c. The suffix, if any (such as the "1/2" in 194-03 1/2), is an Address Number Su
</xsd:choice>
</xsd:group>
<!-- End Utility Groups -->
</xsd:schema>
</xsd:schema>
14 changes: 11 additions & 3 deletions config/catalog.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD XML Catalogs V1.1//EN" "http://www.oasis-open.org/committees/entity/release/1.1/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri name="http://itl.nist.gov/ns/voting/1500-103/v1" uri="../catalog_documents/NIST_V0_cast_vote_records.xsd"/>
<uri name="http://itl.nist.gov/ns/voting/1500-103/v1/json" uri="../catalog_documents/NIST_V0_cast_vote_records.json"/>
Expand All @@ -14,8 +13,16 @@
<uri name="http://www.w3.org/2000/09/xmldsig#" uri="../catalog_documents/xmldsig-core-schema.xsd" />
<uri name="http://www.fgdc.gov/schemas/address/addr" uri="../catalog_documents/addr.xsd" />
<uri name="http://www.fgdc.gov/schemas/address/addr_type" uri="../catalog_documents/addr_type.xsd" />
<uri name="https://www.fgdc.gov/schemas/addresses/addr" uri="../catalog_documents/addr.xsd" />
<uri name="https://www.fgdc.gov/schemas/addresses/addr_type" uri="../catalog_documents/addr_type.xsd" />
<uri name="https://www.fgdc.gov/schemas/address/addr.xsd" uri="../catalog_documents/addr.xsd" />
<uri name="https://www.fgdc.gov/schemas/address/addr_type.xsd" uri="../catalog_documents/addr_type.xsd" />
<!-- workaround for flattened GML -->
<uri name="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd" uri="../catalog_documents/geometryPrimitives.xsd" />
<uri name="http://schemas.opengis.net/gml/3.1.1/base/xlink.xsd" uri="../catalog_documents/xlink.xsd" />
<uri name="http://schemas.opengis.net/gml/3.1.1/base/smil20.xsd" uri="../catalog_documents/smil20.xsd" />
<uri name="http://schemas.opengis.net/gml/3.1.1/base/smil20-language.xsd" uri="../catalog_documents/smil20-language.xsd" />
<uri name="http://schemas.opengis.net/gml/3.1.1/base/xml.xsd" uri="../catalog_documents/xml.xsd" />
<!-- end workaround -->
<uri name="http://www.w3.org/2001/SMIL20/Language" uri="../catalog_documents/smil20-language.xsd" />
<uri name="http://www.opengis.net/gml" uri="../catalog_documents/geometryPrimitives.xsd" />
<uri name="http://www.w3.org/1999/xlink" uri="../catalog_documents/xlink.xsd" />
<uri name="http://www.w3.org/2001/SMIL20/" uri="../catalog_documents/smil20.xsd" />
Expand All @@ -26,6 +33,7 @@
<uri name="http://itl.nist.gov/ns/voting/1500-20/v1#json2xml" uri="../resources/bd_v1/json2xml.xsl"/>
<uri name="http://itl.nist.gov/ns/voting/1500-100/v2#json2xml" uri="../resources/err_v2/err_v2_json2xml.xsl"/>
<uri name="http://itl.nist.gov/ns/voting/1500-101/v1#json2xml" uri="../resources/eel_v1/json2xml.xsl"/>
<uri name="http://itl.nist.gov/ns/voting/1500-102/v1#json2xml" uri="../resources/vri_v1/json2xml.xsl"/>
<uri name="http://itl.nist.gov/ns/voting/1500-103/v1#json2xml" uri="../resources/cvr_v1/json2xml.xsl"/>
<!-- begin Schematron schemas -->
<uri name="http://itl.nist.gov/ns/voting/1500-20/v1/sch" uri="../resources/bd_v1/bd_v1_sua.sch"/>
Expand Down
6 changes: 3 additions & 3 deletions pipelines/consolidate_reports.xpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="pipeline"
xmlns:tm="http://itl.nist.gov/ns/voting/test-method" type="tm:consolidate-reports" version="3.0">
<p:input port="source" primary="true" sequence="true" />
<p:output port="result" />
<p:output port="result" primary="true" />
<p:option name="mode" select="'conformance'" />
<p:option name="reportType" />
<p:option name="stopOnError" select="false()" />
Expand All @@ -14,7 +14,7 @@
<p:with-input port="insertion">
<p:inline>
<xvrl:metadata xmlns:xvrl="http://www.xproc.org/ns/xvrl">
<xvrl:creator name="NIST Common Data Format Test Method" version="1.0.1" />
<xvrl:creator name="NIST Common Data Format Test Method" version="1.1.0" />
<xvrl:timestamp>{$start-dateTime}</xvrl:timestamp>
<xvrl:summary>Please review each report to determine conformance to the applicable test assertions / requirements</xvrl:summary>
<xvrl:supplemental tm:xproc-engine-name="{p:system-property('p:product-name')}"
Expand All @@ -38,7 +38,7 @@
<p:if test="lower-case($reportType) = 'xml'">
<!-- removes namespace prefixes, but keeps default namespace -->
<p:namespace-delete prefixes="xvrl" xmlns:xvrl="http://www.xproc.org/ns/xvrl" />
<p:namespace-rename from="" to="http://www.xproc.org/ns/xvrl"/>
<p:namespace-rename from="" to="http://www.xproc.org/ns/xvrl" apply-to="elements"/>
</p:if>
<p:if test="lower-case($reportType) = 'html'">
<p:xslt name="generate-sch" message="Converting XVRL to HTML Report">
Expand Down
6 changes: 3 additions & 3 deletions pipelines/validate_xml.xpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="../resources/xproc30.rng" type="application/xml"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" name="pipeline"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tm="http://itl.nist.gov/ns/voting/test-method" type="tm:xml-steps" version="3.0">
<p:import href="./consolidate_reports.xpl" />
<p:input port="json-report" sequence="true">
Expand All @@ -14,8 +15,7 @@
<p:option name="stopOnError" select="false()" />
<!-- we could also just delete it, but not sure we want to modify input, might break streaming
later -->
<p:if test="exists(/*/@xsi:schemaLocation)"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<p:if test="exists(/*/@xsi:schemaLocation)">
<p:error code="tm:schemaLocationNotAllowed">
<p:with-input port="source">
<message>Attribute xsi:schemaLocation on root tag is disallowed for
Expand All @@ -40,7 +40,7 @@
</p:with-input>
<p:with-input port="source" pipe="source@pipeline" />
</p:validate-with-schematron>
<p:catch xmlns:err="http://www.w3.org/ns/xproc-error" code="err:XD0049">
<p:catch xmlns:err="http://www.w3.org/ns/xproc-error" code="err:XD0049 err:XD0011">
<p:output port="report" primary="false" pipe="result@empty" sequence="true" />
<p:identity name="empty" message="Schematron Ruleset for {$schemaNS} not found">
<p:with-input>
Expand Down
Loading

0 comments on commit 5078adb

Please sign in to comment.