'How can we allow any parent to a specific tag xsd rule
I need to allow any parent tag over <a>
tag except <root>
tag which means tag have any parent element except root.
Example:
<root>
<p><a href=""></a></p> //This is correct and valid
</root>
<root>
<a href=""></a> //This is inc and valid
</root>
<root>
<u><a href=""></a></u> //This is correct and valid
</root>
Allow tag to have any element as parent.
<root><p id="622def0ae96ee826ce70ed87">
<u>
<a href="https://offerislive.xyz/offer/eco-fuel-obd2/" rel="nofollow">
<strong>==>>ECO Fuel OBD2 Gasoline Saver Device (Official Website) USA {United States}: Save Fuel Buy 90%::Order At 50% Off Now<<==</strong>
</a>
</u>
<br />
</p> </root>
In this above snippet i'm getting validation error as Invalid content was found starting with element 'a'. One of '{p, h2, h3, h4, h5, h6, figure, ul, ol, blockquote, table}' is expected.
But i haven't added any rule for this to not allow <u>
tag as it's parent.
My only validations for u and a tags are:
<xs:element name="u">
<xs:annotation>
<xs:documentation>
underline
</xs:documentation>
</xs:annotation>
<xs:complexType mixed="true">
<xs:complexContent>
<xs:extension base="Inline"/>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="a">
<xs:annotation>
<xs:documentation>
content is "Inline" except that anchors shouldn't be nested
</xs:documentation>
</xs:annotation>
<xs:complexType mixed="true">
<xs:complexContent>
<xs:extension base="a.content">
<xs:attribute name="href" type="xs:string"/>
<xs:attribute name="rel" type="LinkTypes"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
Thanks is advance. New bee in xsd.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|