Ignoring Elements in XSD

How do I write a schema that is only validating elements: 1,4,7,8,9 and

ignores every other element? I also need to not to care about the order

of the elements or how many are in between elements that I am trying to

validate.


XML:
<root>
        <element1 />
        <element2 />
        <element3 />
        <element4 />
        <element5 />
        <element6 />
        <element7 />
        <element8 />
        <element9 />
</root>


XSD:
<xs:element name="root">
        <xs:complexType>
                <xs:sequence>
                        <xs:element name="element1">
                        <xs:element name="element4">
                        <xs:element name="element7">
                        <xs:element name="element8">
                        <xs:element name="element9">
                </xs:sequence>
        </xs:complexType>
</xs:element>


Basically I need it to ignore ANY elements outside of my Schema
declaration and I may not know where they are located in the XML doc.


Thanks. 
Jody

0
5/10/2005 2:15:12 AM
dotnet.xml 7266 articles. 0 followers. Follow

3 Replies
953 Views

Similar Articles

[PageSpeed] 37

If you do not require ALL of the elements defined by your schema to be
present in the instance then you can construct a choice of all these
elements as well as an element wildcard (xs:any) in the content model. Let
me know if you need examples for how to do it.

"Jody Greening" <jodygreening@gmail.com> wrote in message
news:1115691312.563518.262230@o13g2000cwo.googlegroups.com...
> How do I write a schema that is only validating elements: 1,4,7,8,9 and
>
> ignores every other element? I also need to not to care about the order
>
> of the elements or how many are in between elements that I am trying to
>
> validate.
>
>
> XML:
> <root>
>         <element1 />
>         <element2 />
>         <element3 />
>         <element4 />
>         <element5 />
>         <element6 />
>         <element7 />
>         <element8 />
>         <element9 />
> </root>
>
>
> XSD:
> <xs:element name="root">
>         <xs:complexType>
>                 <xs:sequence>
>                         <xs:element name="element1">
>                         <xs:element name="element4">
>                         <xs:element name="element7">
>                         <xs:element name="element8">
>                         <xs:element name="element9">
>                 </xs:sequence>
>         </xs:complexType>
> </xs:element>
>
>
> Basically I need it to ignore ANY elements outside of my Schema
> declaration and I may not know where they are located in the XML doc.
>
>
> Thanks.
> Jody
>


0
zafara (79)
5/10/2005 8:57:50 PM
I do need all of the Elements described in my Schema. :-(

I can't beleive this is so hard to accomplish. The problem is that I
need to validate XML that is used to intergrate with our App, but I am
only concerned with a portion of this XML, and I have absolutely no
control over it.

I have reverted to a custom application for validation that use XPath
and generates a report based on what is found and what is missing.

0
5/10/2005 9:05:46 PM
There is no way in Xml Schema to define such a content model where you want
to impose no order and also mandate the occurence of elements and at the
same time allow other elements which should not be validated.

xsd:all is the contruct normally used to construct content model which
contain element without enforcing any order. But an xsd:all can not contain
an element wildcard (xsd:any), so you do not have the option to not validate
any element.

You could construct a <xsd:choice> containing an element wildcard, as well
as define all elements that you want, and let your application do the
checking that all mandatory elements occur atleast once.

Zafar


"Jody Greening" <jodygreening@gmail.com> wrote in message
news:1115759146.800636.85130@o13g2000cwo.googlegroups.com...
> I do need all of the Elements described in my Schema. :-(
>
> I can't beleive this is so hard to accomplish. The problem is that I
> need to validate XML that is used to intergrate with our App, but I am
> only concerned with a portion of this XML, and I have absolutely no
> control over it.
>
> I have reverted to a custom application for validation that use XPath
> and generates a report based on what is found and what is missing.
>


0
zafara (79)
5/11/2005 4:32:00 PM
Reply:

Similar Artilces:

ignore list
I have importet some contact data into mscrm, When I want to add these contacts to a marketing list (add marketing list members / use advanced find/ add all selected members), the adding stops with an error. I have done a trace during the error (occurs everytime I want to add these contacts) which shows me the following error: [2009-08-24 11:15:36.778] Process:OUTLOOK |Thread:5884 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | Found crmId {319C876A-CC39-DC11-9F61-0030485C3892} in ignore list. Update notification will be ignored Function: CItemHelper<struct Outlook::_Co...

IF to ignore #N/A
Hi, I have a string of IF conditions, which I am combining with SUM. I want to get the IF conditions to ignore any cells containg the error message #N/A. How can I do this? Thanks, Bertie. -- claytorm ------------------------------------------------------------------------ claytorm's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=11610 View this thread: http://www.excelforum.com/showthread.php?threadid=398660 claytorm Wrote: > Hi, > > I have a string of IF conditions, which I am combining with SUM. I want > to get the IF conditions to ignore ...

Stop ignoring me! Emails on behalf of.
I have a rule that moves emails from 'bob@random.rnd' * to another folder. But my rule does not cope when the email comes in like "H.R.Department@random.rnd on behalf of bob@random.rnd" then the rule does not work anymore. How can I write a rule to cope with this sort of annoying email? * Email address has been changed to protect privacy use a rule that looks for words in the header - and use bob@random.rnd as the words? -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Aut...

Sorting ignoring alpahnumeric lists ignoring "the" and "an".
I am trying to sort a large alphanumeric list of titles, but wish to do so igniring definitive articles such as "The" and "an". Is there anyone that can tell me how to do this? ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ create a dummy column using =Substitute(Substitute(substitute(A1,"the ",""),"an ",""),"And ","") then drag fill down the column. Sort on the column with the formul...

testing: please ignore
...

Why is Cancel Ignored?
I have a situation where two fields (both Combo Boxes in this case) are optional if neither is used and required if either is used; i.e., if either one is used they must both be used. The Form BeforeUpdate property is '=CrossCheckKeys(0)'. The CrossCheckKeys function is: Function CrossCheckKeys(Cancel As Integer) Dim CurrForm As Form: Set CurrForm = Screen.ActiveForm With CurrForm If (IsNull(.Controls("comSinkKey")) And Not IsNull(.Controls("comSrceKey"))) _ Or (IsNull(.Controls("comSrceKey")) And Not IsNull(.Controls("comSinkKey...

Ignore Blanks
I have a worksheet that I copy cells from other worksheets. Just a simple copy/paste/link works great - unless the original cell is blank - and then it puts a 0% in. I need it to stay blank and not to put any value if blank but cannot figure out how to do that. I am not trying to sum or concatenate or any other forumula, simply updating various worksheets in a workbook weekly and have my master update from all the worksheets. I have over 57000 cells so I really don't want to have to manually update each cell when it's blank (not to mention I don't know since I do ...

Generate XML File from XSD schema
Hi all, I am trying to build a XML file with the help of the XSD file with VB.NET. Does someone has any tips on how to do this? Thanks a million. C�line The following MSDN article describes a tool to generate XML documents from a schema using c#: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/xmlgen.asp Thanks, Priya "Celine" <celine_rimeur@yahoo.fr> wrote in message news:11628725.0412220117.2d35ae60@posting.google.com... > Hi all, > > I am trying to build a XML file with the help of the XSD file with VB.NET. > Does someone has ...

ignore
test ...

XML generation of empty elements
I use a dataset to generate XML. By default the generated XML doesn't include empty columns. How can I control the generation so that the entire content of the dataset is comming out as XML, including the empty columns. The purpose is so that a recepient of the XML can empty or NULL a row column in a database. You have to set the AllowDBNull property on each column. see http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDataDataColumnClassAllowDBNullTopic.asp -D "Anders Nilsson" <anonymous@discussions.microsoft.com> wrote in message news:09d301c3be3d$f0f1...

Summing #s while ignoring blanks...
Hello all, Before I ask my question I just want to thank you all in this group for your amazing helpfulness... I'd be so lost without this group! Thank you all! Now onto business... H2:H350 all have values... J2:J350 are always changing. by me inputting and deleting etc.. I want to be able to sum H2:H350 ONLY if there is a value in it's corresponding J cell... so if J2, J3, and J20 have values add H2, H3, H20. if I put a # in J4 add H4 too. I hope I worded my question in a way that makes sense... thank you all again! Try this: =3DSUMIF(J2:J350,"<>",H2:H350) H...

Problem using XSD object code generator schema containing abstract elements and substitutionGroup
I am trying to generate the classes for an XSD schema using the Microsoft XSD Object Code Generator (XSDObjGen). I am having a schema that contains the definition of the following: 1. a complex type 'ExternalDestinationBaseComplexType' 2. abstract element 'ExternalDestinationDefinitionEntry' of type 'ExternalDestinationBaseComplexType' 3. two elements 'SAP' and 'Dir' of type ExternalDestinationBaseComplexType with substitutionGroup set to 'ExternalDestinationDefinitionEntry' 4. within the XML root tag defintion, an 'ExternalDestinations'...

Bug: Array formulas in conditional formatting ignored on XML Spreadsheet load
My Google search came up dry... Conditional Formatting rules are *supposed* to treat formulas as array formulas. But when loading an XML Spreadsheet file, conditional formatting rules are *not* treated as array formulas, thus breaking the formatting. At least in Excel 2003, haven't tested others. Workarounds I've considered: - After loading, select the the formatted range, go to Format : Conditional Formatting, and hit OK. Then it works fine, no modification to formulas needed. (not an option here, unsophisticated users) - Use the native Excel format (not an option here, server-ge...

How to ignore #NA in subtotals?
I have several data tables of identical layout that are updated daily, the first two manually and the others by preset formula that calculates from the first two. If a zero or no data are input into cells in the first two then the formula of the others will return #NA, this is intentional because charts are plotted from the latter tables and #NA prevents zero's being plotted all over it for data that has not been entered yet (zero is a valid in negative and positive data entry only when entered). Each table has a SUM total, but, if #NA exits in any one of the cells totaled the S...

Create tables from xsd
I have some xsd files and I want to create tables from them. Is there a utility to do this. I have used the xsd.exe to create the classes from the xsd files and that worked. I am new to xml programming. Thank you -- Jerry Jerry C wrote: > I have some xsd files and I want to create tables from them. Is there a > utility to do this. I have used the xsd.exe to create the classes from the > xsd files and that worked. I am new to xml programming. Do you want to create data base tables? If so which data base management system do you target? Within the .NET framework class library ...

Spelling and "Ignore"/"Ignore All"
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel I have a document with a lot of seventeenth-century spellings and proper names, all of which Word is tagging as misspellings. <br><br>That's all well and good, but I keep having to click &quot;Ignore&quot; or &quot;Ignore All&quot; (I've tried both with the same results) again and again and again. For some reason, Word is not learning NOT to mark those words. <br><br>I don't want to add them to the dictionary, because some of them are too close to actual mis...

Ignore
Please ignore - testing [sent from Jim Dell] -- Jim Bunton ...

HowTo: Generating several namespaces for an element in an XmlDocument?
Hi everybody, I'm using VS 2005, .Net 2.0. The CreateElement() method of XmlDocument allows to supply a namespace URI. Now I want to add several namespace URIs with different prefixes to the element. How do I do that. Here an example: <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40"> I could do this with...

Element order on serialization
Here's a class I'm working with public class BatchHeader { public string ScaleSite; public string FromScaleDate; public string ToScaleDate; public string SubmitterBatchID; System.Xml.Serialization.XmlElementAttribute(DataType="integer")] public string DocumentCount; [System.Xml.Serialization.XmlElementAttribute(DataType="integer")] public string BatchControlTotal; public BatchHeader(ArrayList batchLoads) { string[] BatchInfo; ScaleSite = "First"; FromScaleDate ="second"; ToScaleDate = "third"; SubmitterBatchID = &qu...

Skipping every other data element when charting
When I am charting it is skipping every other data element/row. So for example if I have sally with 40% and then Joe with 70% and then Mary with 80% it only lists Sally and Mary on the chart but shows the bar for Joe, just doesn't list his name under the bar. Why is that? Hi, Double click the category axis and on the scale tab make sure the setting of 'Number of Categories between tick mark labels' is 1. Cheers Andy flegendre wrote: > When I am charting it is skipping every other data element/row. So for > example if I have sally with 40% and then Joe with 70% and th...

Window control elements (minimize, maximize, close, scroll bars, etc) are screwed up
The issue I'm seeing is actually on an NT4 server with IE6-sp1, but I'm asking here because there aren't enough people following NT4 newsgroups any more, and I figure that NT is similar enough to XP in this situation. The problem is that these graphic symbols or control elements are screwed up: - window minimize, maximize, and close buttons (upper right-hand corner of any window) - scroll bar up and down arrows, arrows for drop-down lists (the actual small black arrow) - radio buttons and check boxes are screwed up and seem to have been replaced with numbe...

I want a formula to ignore text eg 5mts * 5 ignoring the mts any .
any help to the above would be appreciated Two ways for the example posted: You could try something like this: =LEFT(I11,1)*I12 If 5mts is in I11 and 5 is in I12 You may also want to consider using a Custom Number format that would put the mts into the cell instead of typing it manually. Something like: General"mts" tj "Malshenton" wrote: > any help to the above would be appreciated ...

How can I create an xsd file out of a Dataset class file?
Hi all, I apologize for posting this question on two groups. I did not know which one out of "XML" and "ADONET" groups, should I post this. I would like to create an xsd file out of an existing dataset.cs file that can be visually manipulated in the VS.NET Dataset Designer wizard in VS.NET 2003 with .NET 1.1 and C#. Here is the issue in more detail: Using the wizard I can drag and drop tables on to the dataset designer surface, set relations between tables etc. Now, this wizard generates a typed DataSet class for me which is remarkable and beautiful. I love Visual St...

How do I ignore newline character/carriage return while importing
I am using Excel 2003. I need to import a comma delimited file into an excel sheet. While importing into an excel sheet I need to ignore some carriage returns/newline characters. I tried using double quotes (") but this doesn't ignore newline charcters. Sample file is as follows 1,name,description details 2,name,description details 3,name,description details In the above I need to ignore the carriage retun of the 1st record and display the 'description details' in one column. AFAIK there is nothing about Excel's importing feature that provides for variable random carr...

Ignore DocType
I am reading data from an XML document with xmlDoc.load(fullname). Unfortunately, in my xml file there is the definition of a doctype file that is not available and so, it buggs. I would like to ignore it, to remove this line, or I don�t know� my language is Visual C#. Thanks in advance for your help. Nathalie *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! Nat wrote: > I am reading data from an XML document with xmlDoc.load(fullname). > Unfortunately, in my xml file there is the definition of a doctype file &g...