Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xml schema question

Status
Not open for further replies.

lexul

Programmer
May 10, 2007
5
RO
is there a way to specify that a xml element is allowed to contain ANYTHING?(no matter how many subtags, nested subtags, quotation marks, text, ANYTHING?). Something like:
<element1>
<subelem'ent>randomtext<sube'lement1/><subelement>
randomtext
</element>

How am i this specifying in a .xsd file ?
 
I assume there are typos otherwise no need to validate: it is already not well-formed. If yes, you can do this.
[tt]
<xs:element name="[blue]element[/blue]" minOccurs="0" maxOccurs="unbounded">
<xs:complexType mixed="true">
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="skip" />
</xs:sequence>
</xs:complexType>
</xs:element>
[/tt]
 
thanks tsuji
anyway,
in this case, being well-formed and valid is the same thing(this is the case, no matter how unusual this may be) and i want to allow non well-formed xml(i want to allow ANYTHING to be included there, in that element, it doesn't matter what) ONLY between the <element1> and </element1>(within the content of an element) and define the necessity of presence of other elements. as long as there is an element <element1> which is properly closed with </element1>, i just don't care what is included there
 
If you want to allow anything, it is anything. But, non well-formed xml? not much meaning...
 
i will explain the exact situation:
i need to find whether an xml string is in the format I expect it to be..which is to contain a number of elements(which i specify in my .xsd validation file), and, also, within the starting tag and closing tag of an particular(<element1> element) element to allow ANYTHING..i want the validation process to flow without any generated error no matter what is contained within that special element(<element1> in my example)-i want to allow this element to contain tags, subtags, punctuation marks, plain text, ANYTHING. if the elements i expect are present and <element1> is also present and correctly closed, i don't care what is it inside the opening tag and closing that of <element1>

so, this should be a valid element(in my acceptance):

<root>
<requiredElement>randomText</requiredElement>
<element1><unclosedOpeningTag></element1>
</root>

For me, this SHOULD be a valid element because i simply don't care what is comprised between <element1> and </element1>. As long as <requiredElement> element and <element1> are present(and correctly closed) i want my element to be validated without the validation procedure to check the insides of <element1>(again, i want to allow the presence of well-formed or non well-formed xml structures between the <element> and </element>)

Is there a solution to this?
Thanks
 
[1]
><element1><unclosedOpeningTag></element1>
[tt]<element1>[red]<![CDATA[[/red]<unclosedOpeningTag>[red]]]>[/red]</element1>[/tt]

[2]
[tt]<xsl:element name="element1" type="xs:string" />[/tt]
 
the <element1> doesn't encircles its content in a [CDATA] clause in my xml file:(
if this is the only solution you know of, thank you very much, it's helpful to find out it's pointless to search more for a solution
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top