LMSouq
moodle-core Open

How to specify repeated elements in XSD

CO
Community Contributor
1 month ago
3 views
Problem Description
I have a an XSD which validates my XML file. The problem is that it works for one element, but when I have more than one it doesn't work and I can't find the problem. This is my XML file: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <UrlList> <url> <url>https://www.youtube.com/watch?v=ke92CDVQsb8</url> <idUrl>72</idUrl> <urlShort>http://short.ly:8080/SOB/url/832261</urlShort> <numVisits>2</numVisits> </url> <url> <url>http://moodle.urv.cat/moodle/pluginfil</url> <idUrl>73</idUrl> <urlShort>http://short.ly:8080/SOB/url/45ea9b</urlShort> <numVisits>1</numVisits> </url> </UrlList> And this is my XSD file: <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="UrlList"> <xs:complexType> <xs:sequence> <xs:element ref="url"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="url"> <xs:complexType> <xs:sequence> <xs:element name="url" type="xs:string"/> <xs:element name="idUrl" type="xs:integer"/> <xs:element name="urlShort" type="xs:string"/> <xs:element name="numVisits" type="xs:integer"/> </xs:sequence> </xs:complexType> </xs:element> </xs:...

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base