# XML Validator in SWI-Prolog

**URL:** <https://swi-prolog.discourse.group/t/xml-validator-in-swi-prolog/5152>\
**Category:** Pack\
**Created:** [March 21, 2022, 1:54pm UTC](https://swi-prolog.discourse.group/t/xml-validator-in-swi-prolog/5152 "2022-03-21T13:54:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![labormarket](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/labormarket/32/975_2.png) [@labormarket](https://swi-prolog.discourse.group/u/labormarket)\
**Post date:** [March 21, 2022, 1:54pm UTC](https://swi-prolog.discourse.group/t/xml-validator-in-swi-prolog/5152/1 "2022-03-21T13:54:50Z")

</div>

We received two files from government : .xsd and .xml.  
From the xsd we selected all necessary data.  
Now we want to validate xml file against the (altered) xsd.  
[https://www.swi-prolog.org/pack/list?p=xsd](https://www.swi-prolog.org/pack/list?p=xsd)  
xsd\_validate(+Schema, +Document)  
This validates but output is ‘true’ of ‘false’  
output should be a Modified XML for the Modified Xsd , out of de original XML  
?- start\_xml\_xsd().  
results in: Warning: SGML2PL(xmlns): dossiers\_2022.xsd:1: #PCDATA ("") not allowed here  
false.  
So:

- we have 1 XML with 1 XSD which represents its structure
- we have modified the XSD file , we stripped out the unwanted fields
- now we want to have a New stripped XML for the the modified Xsd  
Thanks!

---

<div class="post-metadata">

**Author:** ![fnogatz](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/fnogatz/32/19_2.png) [@fnogatz](https://swi-prolog.discourse.group/u/fnogatz)\
**Post date:** [March 22, 2022, 9:50am UTC](https://swi-prolog.discourse.group/t/xml-validator-in-swi-prolog/5152/2 "2022-03-22T09:50:55Z")

</div>

Hi, author of library(xsd) here. Would you mind sending me both files [via e-mail](mailto:fnogatz@gmail.com) or in a [GitHub issue](https://github.com/fnogatz/xsd), so we could see what’s going wrong here?

---

<div class="post-metadata">

**Author:** ![grossdan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/grossdan/32/23_2.png) [@grossdan](https://swi-prolog.discourse.group/u/grossdan)\
**Post date:** [March 22, 2022, 10:27am UTC](https://swi-prolog.discourse.group/t/xml-validator-in-swi-prolog/5152/3 "2022-03-22T10:27:28Z")

</div>

Would’t XSLT be the tech of choice for that …

---

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [March 22, 2022, 12:52pm UTC](https://swi-prolog.discourse.group/t/xml-validator-in-swi-prolog/5152/4 "2022-03-22T12:52:33Z")

</div>

XSLT is sadly just a language/spec. You need an implementation in order to use it, and at that point you have to start making decisions what to use and what it means for your use case.

---

<div class="post-metadata">

**Author:** ![grossdan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/grossdan/32/23_2.png) [@grossdan](https://swi-prolog.discourse.group/u/grossdan)\
**Post date:** [March 22, 2022, 12:55pm UTC](https://swi-prolog.discourse.group/t/xml-validator-in-swi-prolog/5152/5 "2022-03-22T12:55:59Z")

</div>

As far as i recall, I used an XSLT processor, with a built-in debugger – to translate between one XML based representation to another one

---

<div class="post-metadata">

**Author:** ![labormarket](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/labormarket/32/975_2.png) [@labormarket](https://swi-prolog.discourse.group/u/labormarket)\
**Post date:** [March 22, 2022, 3:02pm UTC](https://swi-prolog.discourse.group/t/xml-validator-in-swi-prolog/5152/6 "2022-03-22T15:02:46Z")

</div>

> [@Boris](#):
>
> XSLT

> **[Free Online XSL Transformer (XSLT) - FreeFormatter.com](https://www.freeformatter.com/xsl-transformer.html)**
>
> This free online XSL Transformer (XSLT) lets you transform an XML file using an XSL file and formats the output with your chosen indentation
