Schema: element may have "any" content?

Lord0

Usenet Archive
Joined
Jul 18, 2003
Messages
92
Reaction score
0
Hi there,

How do I define in a schema that an element (<element>) may have any content i.e. text, other elements, partial elements, angle brackets etc?

So all of the following would be valid:

<element>
aaaaaaa<foo/>bbbbbb<bar/>cccccc
</element>

<element>
aaaaaaa<foo>bbbbbb<bar>cccccc
</element>

<element>
<foobbbbbbb<bar>cccccccc
</element>

etd

So I basically would like to tell the parser, via the schema, to ignore anything between the opening and closing <element> tags

Lord0
 

Lord0

Usenet Archive
Joined
Jul 18, 2003
Messages
92
Reaction score
0
I should say that I got as far as this:

<element name="element" minOccurs="1" maxOccurs="unbounded"> <complexType mixed="true"> <sequence> <any minOccurs="0" maxOccurs="unbounded" processContents="skip"/> </sequence> </complexType> </element>

But this obviously still tried to "parse" incomplete elements contained within the element tag.
 

Martin Honnen

Usenet Archive
Joined
Apr 8, 2000
Messages
6,174
Reaction score
0
Lord0 said:
Hi there,

How do I define in a schema that an element (<element>) may have any content i.e. text, other elements, partial elements, angle brackets etc?

So all of the following would be valid:

<element>
aaaaaaa<foo/>bbbbbb<bar/>cccccc
</element>

<element>
aaaaaaa<foo>bbbbbb<bar>cccccc

The content has to be well-formed before you can talk about validity at all so having a <foo> start tag but not closing </foo> is not possible.
</element>

<element>
<foobbbbbbb<bar>cccccccc

Same here, the contents has to be well-formed.
</element>

So I basically would like to tell the parser, via the schema, to ignore anything between the opening and closing <element> tags

The content has to be well-formed, the parser will not ignore well-formedness constraints.

As for not doing validation of the contents, look into xs:any and processContents="skip":

<xs:element name="element" maxOccurs="unbounded"> <xs:complexType mixed="true"> <xs:sequence> <xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element>
 

Richard Tobin

Usenet Archive
Joined
Jan 6, 2000
Messages
4,251
Reaction score
0
Lord0 said:
So I basically would like to tell the parser, via the schema, to ignore anything between the opening and closing <element> tags

You can't. Schemas operate on documents that have already been parsed. All you can do is add constraints to well-formed XML, not remove them.

-- Richard
 

Lord0

Usenet Archive
Joined
Jul 18, 2003
Messages
92
Reaction score
0
"You can't. Schemas operate on documents that have already been parsed."

Damn - I suspected as much!

BTW Richard how's the Text Mining/PDF parsing etc etc going with Cognia? :)
 

Manuel Collado

Usenet Archive
Joined
Jun 19, 2002
Messages
93
Reaction score
0
Lord0 escribió:
"You can't. Schemas operate on documents that have already been parsed."

Damn - I suspected as much!

Have you considered using CDATA sections? Its content is not parsed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,049
Messages
3,104,243
Members
248,133
Latest member
DujonT

Latest Threads

Top