Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/validate_xml_with_xsd_and_schematron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:

jobs:
discover:
name: Discover *.pv2 example files
name: Discover *.pvc2 example files
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.build.outputs.matrix }}
Expand All @@ -32,7 +32,7 @@ jobs:
python3 - <<'PY' > matrix.json
import json, re, pathlib
root = pathlib.Path("Examples")
pattern = re.compile(r".+\.pv2$", re.IGNORECASE)
pattern = re.compile(r".+\.pvc2$", re.IGNORECASE)
files = []
if root.exists():
for p in sorted(root.iterdir()):
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
uses: actions/checkout@v4
with:
sparse-checkout: |
schema/pvcollada_schema_0.1.xsd
schema/pvcollada_schema_2.0.xsd
schema/pvcollada_structure_2.0.sch
schema/pvcollada_references_2.0.sch
schema/pvcollada_business_2.0.sch
Expand All @@ -78,7 +78,7 @@ jobs:
run: |
python3 "$GITHUB_WORKSPACE"/.github/workflows/validate_xml_with_xsd_and_schematron.py \
"$GITHUB_WORKSPACE"/"${{ matrix.xml_doc }}" \
--xsd pvcollada_schema_0.1.xsd
--xsd pvcollada_schema_2.0.xsd

- name: Validate against Structure Schematron
working-directory: schema
Expand Down
File renamed without changes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 8 additions & 9 deletions docs/dev_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This guide explains how to use the `pvcollada_schema_0.1.xsd` XML schema file in

The schema file is located at:
```
schema/pvcollada_schema_0.1.xsd
schema/pvcollada_schema_2.0.xsd
```

This schema imports the COLLADA schema (`collada_schema_1_5.xsd`) and defines enumerations and types specific to photovoltaic (PV) system design.
Expand Down Expand Up @@ -42,8 +42,8 @@ A Python script is provided at `schema/validate.py` that uses `lxml` to validate
```python
from lxml import etree

XML_FILE_PATH = "../Examples/05 - VerySimpleFixedPVC2_with_electrical_layout_v3.pvc"
XSD_FILE_PATH = "pvcollada_schema_0.1.xsd"
XML_FILE_PATH = "../Examples/05 - VerySimpleFixedPVC2_with_electrical_layout.pvc2"
XSD_FILE_PATH = "pvcollada_schema_2.0.xsd"

with open(XML_FILE_PATH, "rb") as xml:
xml_doc = etree.XML(xml.read())
Expand All @@ -67,7 +67,7 @@ else:
### Automatically (using GitHub Actions)

The repository includes a GitHub Actions workflow:
`.github/workflows/validate_xml_with_xsd.yml`
`.github/workflows/validate_xml_with_xsd_and_schematron.yml`

This workflow automatically validates example PVCollada XML files on every push or pull request affecting relevant files.

Expand All @@ -82,25 +82,24 @@ Key steps:

Example XMLs are found in the `Examples/` directory.
Example:
`Examples/05 - VerySimpleFixedPVC2_with_electrical_layout_v3.pvc`
`Examples/05 - VerySimpleFixedPVC2_with_electrical_layout.pvc2`

---

## 5. Extending the Schema

If you need to add new enumerations or elements:
- Edit `schema/pvcollada_schema_0.1.xsd`.
- Ensure new values are added as `<xs:enumeration value="..."/>` or new types as needed.
- Edit `schema/pvcollada_schema_2.0.xsd`.
- Update or add example XML files to reflect the changes.
- Run the validation script to confirm correctness.

---

## 6. References

- [pvcollada_schema_0.1.xsd (GitHub link)](https://github.com/pvlib/pvcollada/blob/main/schema/pvcollada_schema_0.1.xsd)
- [pvcollada_schema_2.0.xsd (GitHub link)](https://github.com/pvlib/pvcollada/blob/main/schema/pvcollada_schema_2.0.xsd)
- [validate.py](https://github.com/pvlib/pvcollada/blob/main/schema/validate.py)
- [Validation Workflow](https://github.com/pvlib/pvcollada/blob/main/.github/workflows/validate_xml_with_xsd.yml)
- [Validation Workflow](https://github.com/pvlib/pvcollada/blob/main/.github/workflows/validate_xml_with_xsd_and_schematron.yml)
- [Browse more files in the repository](https://github.com/pvlib/pvcollada)

---
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions schema/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))

# Default file paths
DEFAULT_XML_FILE = os.path.join(SCRIPT_DIR, "../Examples/05 - VerySimpleFixedPVC2_with_electrical_layout.pv2")
XSD_FILE_PATH = os.path.join(SCRIPT_DIR, "pvcollada_schema_0.1.xsd")
DEFAULT_XML_FILE = os.path.join(SCRIPT_DIR, "../Examples/05 - VerySimpleFixedPVC2_with_electrical_layout.pvc2")
XSD_FILE_PATH = os.path.join(SCRIPT_DIR, "pvcollada_schema_2.0.xsd")
SCH_STRUCTURE_FILE = os.path.join(SCRIPT_DIR, "pvcollada_structure_2.0.sch")
SCH_REFERENCES_FILE = os.path.join(SCRIPT_DIR, "pvcollada_references_2.0.sch")
SCH_BUSINESS_FILE = os.path.join(SCRIPT_DIR, "pvcollada_business_2.0.sch")
Expand Down