How to generate elements that comply with schema?

S

Steve Marshall

Hi, I am working on a Visual Studio 2005 application that works with
quite complex data in XML form. The XML format is controlled by a
schema. There are times when I need to generate an (optional) element
in the XML that is quite far down in the tree structure. I can see
how to do this, but it is fairly fiddly and it seems to me there
should be a simpler way to do it, like a method on the XMLDocument or
XMLSChema object. I don't see such a thing. What I want is to
specify the schema element uniquely in some way, then say "create me
one of these in this XML document, creating any necessary parent
elements so that it all complies with the schema structure". If the
selected schema element is part of a sequence then it should of course
be inserted at the correct place in the sequence.

Am I missing something here? I can't imagine I'm alone in needing to
do this.
 
M

Martin Honnen

Steve said:
Hi, I am working on a Visual Studio 2005 application that works with
quite complex data in XML form. The XML format is controlled by a
schema. There are times when I need to generate an (optional) element
in the XML that is quite far down in the tree structure. I can see
how to do this, but it is fairly fiddly and it seems to me there
should be a simpler way to do it, like a method on the XMLDocument or
XMLSChema object. I don't see such a thing. What I want is to
specify the schema element uniquely in some way, then say "create me
one of these in this XML document, creating any necessary parent
elements so that it all complies with the schema structure". If the
selected schema element is part of a sequence then it should of course
be inserted at the correct place in the sequence.

See whether this article
<http://msdn2.microsoft.com/en-us/library/aa302296.aspx> helps.
 

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
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top