473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Schema validating document with any element names


Hello,

I'm processing documents that can have any element names in them. The
only restriction is placed on the attributes of these elements, each
of them can only have two attributes of given names. I'd like to
validate this input.

I can specify this requirement using xsd:any for /root element, like:

<xsd:element name="root">
<xsd:complexType>
<xsd:sequence>
<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="strict"
namespace="##targetNamespace"/>
</xsd:sequence>
<xsd:attribute name="type" type="xsd:string"/>
<xsd:attribute name="ph" type="xsd:string"/>
</xsd:complexType>
</xsd:element>

However, I'm probably missing a way to specify the

<xsd:element name="root">

as a wildcard matching type. I tried

<xsd:any>
<xsd:complexType>
<xsd:sequence>
<xsd:any minOccurs="1" maxOccurs="unbounded" processContents="strict"
namespace="##targetNamespace"/>
</xsd:sequence>
<xsd:attribute name="type" type="xsd:string"/>
<xsd:attribute name="ph" type="xsd:string"/>
</xsd:complexType>
</xsd:any>

but xsd:any is not allowed directly in xsd:schema.

I'd appreciate any pointer that would help me to specify element type
for wildcard name. Likewise, I tried to find a way to achieve this
with DTD but got stuck in the same place -- specifying the <!ELEMENT>
as a wildcard, matching all element names.

--
------------------------------------------------------------------------
Honza Pazdziora | ad*****@fi.muni.cz | http://www.fi.muni.cz/~adelton/
.project: Perl, mod_perl, DBI, Oracle, auth. WWW servers, XML/XSL, ...
Only self-confident people can be simple.
Jul 20 '05 #1
1 1665
Honza Pazdziora <ad*****@fi.muni.cz> wrote:
:
: Hello,
:
: I'm processing documents that can have any element names in them. The
: only restriction is placed on the attributes of these elements, each
: of them can only have two attributes of given names. I'd like to
: validate this input.

Can you assume that input is wellformed?
In this case you could transform the document and replcace
all element names with any one of your choice and thus reduce
the number of element type definitions to 1.
Georg
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Xavier Seneque | last post by:
hello, i'm trying to parse an XML file from a java program, and the structure of the XML document is described in a schema file. here is the simple schema file (departement.xsd) : <?xml...
2
by: Dan Shookowsky | last post by:
I'm trying to write a schema that allows me to substitute entensions for a base type. The schema (included below) defines a StepType and an AnnouncementStepType that is an extension of the base...
1
by: Andy | last post by:
I am having some trouble validating XML using the XmlValidatingReader. I have created some xml and used the visual studio to generate the schema. So I am confident that the xml and schema match. ...
3
by: Matt | last post by:
I know how to use the XmlReader to validate XML against a Schema but how do I take this one step further and get the Facet information for an invalid Xml element? I have my own validation event...
3
by: Shailendra Batham | last post by:
hi guys I need your suggestions / opinion for doing this the right way. I have a XML and a Schema for the same What I want is when its validated against the schema, it should give custom...
1
by: Dan Bass | last post by:
There's an XML message I have, that has no namespace information. Then there is a XSD schema that is must validate against, but this has a targetNamespace and xmlns of...
2
by: Edward Diener | last post by:
I could not find an example of an inline XSD schema for an XML document which has no namespaces. Could someone supply one ? When I tried validating my XML with an inline XSD schema, using...
2
by: srujana | last post by:
Hi I am validating an xml document against schema . when i am passing the xml file location as an input to the parse method String XmlDocumentUrl="E:/books.xml"; parser.parse(XmlDocumentUrl);...
9
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13>...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.