XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] XSD Validating unknown number of attributes from 1 to N

Yes, I know is a very, very bad designed XML.
It's exported directly from the administrative software of a High School, I'll try to export it in another way. But anyway I'll try your solution.

Thanks.

El 19 abr 2016, a las 0:20, Michael Kay <mike@saxonica.com> escribiรณ:

This is a very bizarre XML design, and XSD is not designed to enable validation of bizarre XML designs.

It can of course be done using XSD 1.1 assertions: something like

<xs:assert test="every $a in $value/@* satisfies name($a) = 'id' or name($a) = 'link1' or 
   (matches(name($a), 'link[0-9]+' and exists($value/@*[name() = concat('link', number(substring-after(name($a), 'link'))-1)))"/>

Michael Kay
Saxonica


On 18 Apr 2016, at 17:17, Pedro Adame Vergara <pedro.a.1smr@gmail.com> wrote:

Hi!

I need to validate the following xml structure:
...
<element id="1" link1="xyz" link2="xyzz" />
...
There can be from link1 attr to anyone desired.

How could I achieve that using XSD?

Best regards!
/Pedro



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS