xsd

How to change XmlSchemaElement.SchemaType (or: difference between SchemaType and ElementSchemaType)

Hey, I'm working on a XML Editor which gets all his information from the corresponding XSD file. To work with the XSD files I use the System.Xml.Schema Namespace (XmlSchema*). Because of an 'xsi:type' attribute in the XML I've to change the XmlSchemaType of an XmlSchemaElement. Until now I use in my code the 'ElementSchemaType' property...

Selection Path of a JTree

I've loaded a JTree with nodes from an XML Schema file using the XSOM API (https://xsom.dev.java.net). Every time a file is selected I do the folowing: schemaParser = new XSDParser(selectedFile.getAbsolutePath()); TreeModel model = schemaParser.generateTreeModel(); schemaTree.setModel(model); schemaTree.setCellRenderer(new SchemaTreeT...

tool to generate xml file from xsd (for testing)

I have an xsd file and have not done much xml manipulation, parsing, etc. I want/need test xml files for my code but don't have any samples. (I am using xerces to parse) This is similar to: xml-instance-generation-from-xml-schema-xsd but I don't really want to make it a two step process. (python or java) I just want to feed xsd fi...

XSD - one of 2 attributes is required?

Hi, Is there a way to specify that one of 2 attributes is required in XSD? for example, i have a definition like this. <xs:attribute name="Name" type="xs:string" use="optional" /> <xs:attribute name="Id" type="xs:string" use="optional" /> I want to be able to define that atleast one of these is required. Is that possible? ...

How to tell if XML element is marked as required in the XSD file

Hi All, I need to mark some elements as non required in the XSD schema that some one else created. How do I go about figuring out which elements are marked as required, is there a particular flag I could search for. Currently all of my elements are marked with minOccurs="0" is this what needs to be changed? Thanks! ...

Adding more promoted properties after a first one in BizTalk

I've got a BizTalk solution where I added a schema, and promoted a field - this added the default PropertySchema.xsd with the element in A bit later, added another schema, but when I try and promote a couple of fields, but when I select Show Promotions, I end up mapping the new field to one of the existing fields in the PropertySchema ...

Problem validating against an XSD with Java5

I'm trying to validate an Atom feed with Java 5 (JRE 1.5.0 update 11). The code I have works without problem in Java 6, but fails when running in Java 5 with a org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'xml:base' to a(n) 'attribute declaration' component. I think I remember reading something about the version...

XML Schema: Why can't <xs:all> have <choice> children? and how can this be bypassed?

I'm trying to create a schema for a <property> element which must have a <key> sub-element, and one of <val>, <shell> or <perl> and an optional <os> or <condition>, and the order of the sub-elements doesn't matter. Here are some sample for valid <property> elements: <property> <key>A</key> <val>b</val> </property> <property> <k...

Need help with (recursive) xsd group

I have this xsd: <?xml version="1.0" encoding="utf-8" ?> <xs:schema xmlns="http://myschema.com/schema" targetNamespace="http://myschema.com/schema" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; <xs:complexType name="aType" mixed="true"> <xs:group ref="aElements" minOccurs="0" maxOccurs="unbounded"/> ...

Extract enumeration values from xsd schema file in .net

How programmatically extract enumeration constraint values of an element from xsd schema file using .net? for example I'd like to extract 'Audi', 'Golf' and 'BMW' from the following xsd: <xs:element name="car"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="Audi"/> <xs:enumeration value="Golf...

How to read XML into a class/classes that matches its xsd

So I have an XSD and a webservice that delivers in that same format. Now I could go ahead and read the xml into a document, create my objects from the class etc... But I am thinking, there must be some easier way to do that. Am I right? ;) Yahoo Maps GeocodeResponse XSD Yahoo Maps GeocodeResponse sample <ResultSet xsi:schemaLoc...

Extending the html schema

I'm trying to create a templating engine not too synactically far from ASP.net WebForms. I want the markup to look like this: <ext:Templates xmlns:ext="http://www.myschema.com/" xmlns="http://www.w3.org/1999/xhtml"&gt; <ext:Template name="Template1"> <div id="someid" style="display:none" ext:extendedAttr="someValue"> ...

Create xml from xsd with xlinq

How do I generate, based on a xsd and c#, an xml containing only the mandatory elements. I would prefer to use xlinq but I am also open to alternatives. ...

XSD Schemas allowing special/reserved characters in string element tag

In a string element tag the XML parser will get confused if it finds the following characters ' " < > & (i.e. lets say the name of company has been retrieved from a database field, and it looks like this: "Smith & Sons") The question is - how can you design your XSD to ignore these characters if found within an element? ...

XSD - xs:nonNegativeInteger and values ending with .00

I realize that the value 0.00 is not a valid nonNegativeInteger, nor is it even an Integer. Unfortunately, the data is coming in that format. I don't want to throw it away if it ends with .0 but, I also don't want to change the type to Decimal and possibly have values ending in .1 coming in as valid. Is there a way my XSD can validate ...

Is it possible to redefine something defined as xsd:element?

I need to extend an element in an XSD schema. In the original schema, the element is defined as: <xsd:element name="RemarkText"> <xsd:complexType> <xsd:simpleContent> <xsd:extension base="C-Infinite"> <xsd:attribute name="IdRef" type="IDREF" use="required"/> </xsd:extension> ...

Problem deserializing validated XML, can't convert to/from array

I'm a bit out of my element. I've used xsd.exe to create an xsd schema from an xml file, and then to create a C# class from that xsd. That all seems to work fine. At the moment I'm just trying to get the XML deserialized. The file I'm deserializing if the very same file I used to build the class originally. Here's my code: String xsdPa...

Restrict word list in XML schema

I'm writing an XML schema and need to prevent the text of an element from matching certain values. (Eg. the variableName element cannot match 'int', 'byte', 'string' etc.) I have tried using a restriction with a pattern element similar to "^(int|byte|string)", but without success. Do you know the way to format the regular expression, o...

XML: attributes or children?

In XSD, SOAP and other XML conventions you'll often see things like: <book> <title>Harry Potter</title> <author>J.K. Rowling</author> </book> Now I'm wondering, what happened to attributes? To me it makes more sense to write this as: <book title="Harry Potter" author="J.K. Rowling" /> But apparently, for some reason, smarter peop...

XML Schema For A Simple XML Goods-List

I'm trying to write a schema that will validate the following XML: <category type="rifles"> <item> <name> AK47 </name> <description> The USSR's chief export back in the day, and the guerrilla's best friend. On African flags than any other symbol. </description> <cost> 4000 </cost> <image> ak47.jpg </imag...