• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not quite getting how to allow any html element

 
Thomas Kennedy
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to allow, in addition to any number of my own <link> elements, anything from the html namespace, in any order. I was trying this:



But it will not allow the maxOccurs="unbounded" on line 2. So, I could try this:



Except that I don't want a sequence, I have to allow things in any order. What can I do?
 
g tsuji
Ranch Hand
Posts: 669
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The use of xs:all is certainly not the right choice. Yes, xs:choice should do at the place replacing xs:all.
 
Thomas Kennedy
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, but I do not quite see how an xs:choice would help here. It allows only one of the listed elements to appear, and I need any number of them, before and after and between my own <link> elements. For example


Can you give an example of what you mean?
 
g tsuji
Ranch Hand
Posts: 669
3
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Thomas Kennedy
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I'm going to try that! However I am a little skeptical that it will work, because it seems it must be too ambiguous. If I hand the processor something like this:


I don't see how the processor could validate that. Is it one instance of the sequence with one occurrence of each child, or is it two sequences with the first containing only an html element and the second containing only my element? Each of these scenarios is valid, but it seems to me the processor must know which it is dealing with, and it cannot possibly know. So, here goes.
 
g tsuji
Ranch Hand
Posts: 669
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure you know the difference between how a thing functions and how it might have been functioning.
 
Thomas Kennedy
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, xs:choice worked perfectly. Now I can mix html elements with my own elements.

The other problem, that I was getting html: namespace prefixes and whatnot in the output, I fixed by not using <xs:copy-of> but by re-creating the element instead. So I handle html elements as follows:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic