Is it possible to define in XSD the following scenario:
Parent element has an attribute that
is optional.
If the attribute is not
present in XML, at least one child
element must exists.
If the
attribute is present, there can be
zero or more child elements.
Example:
VALID
<parent external-source="some_name" />
<par...
My application uses an XML file of some complexity for configuration. It's not much - about two dozen elements - but still non-trivial.
Currently I'm writing XML schema for it, and was wondering if there was a tool which would generate documentation from this schema? Something human-readable that can be used by a person who has to write...
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="http://tempuri.org/ServiceDescription.xsd" xmlns:mstns="http://tempuri.org/ServiceDescription.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org/ServiceDescription.xsd" elementFormDefault="qualified" id="ServiceDescription">
<xs:element name="T...
This is an XML that I want to get:
<root>
<A>
<C>asd</C>
<D>asd</D>
<E>asd</E>
</A>
<B>
<C>asd</C>
<D>asd</D>
<E>asd</E>
<F>asd</F>
</B>
</root>
Here are some more limits:
There can be multiple A and B elements, in any order.
A and B have exactly the same conten...
I'm working on a custom XML format that involves a formatted list of points. We would like to support multiple types of coordinates systems, such as Cartesian and Spherical. Can this be done?
Example:
<point type="cartesian">
<c1>5.0</c1>
<c2>5.6</c2>
<c3>9.1</c3>
</point>
<point type="spherical">
<c1>5.0</c1>
<c2>5.6</c2>
<c3>9.1</c3>...
I am trying to extend and tailor an external xsd schema (of the fixml standard). I need to change the data type of some of the elements, without touching the original schema, but by redefining it; but have been finding it exceedingly cumbersome.
What exists:
fields-base.xsd
<xs:simpleType name="LastUpdateTime_t">
<xs:restr...
I use Java Persistence, and I want a web method to return a 'portion' of an Entity class. For example, I have a Customer class that represents a record in Customer table with many fields, but I want to return just few of them. Is it possible to use mapping to do that? Or the only way is to create a new class (maybe a superclass for Custo...
Hello,
I am creating an XPathDocument from a SQL result set, then I am attempting to use XmlCompiledTransform.Transform on the object like so:
XslCompiledTransform xslCompiledTransform = new XslCompiledTransform();
xslCompiledTransform.Load(Request.PhysicalApplicationPath + "/Abc/Abc.xsl");));
xslCompiledTransf...
I am in the very early stages of writing XML schema for my work's enterprise application. The XML to be validated represents an application - similar to Winforms - forms, grids, menus etc but without layout.
The prime purpose of the XSD is not so much to validate the XML but to add design-time discoverability to the XML file, so that on...
Here is my xml:
<node>
<elem pk="1">test1</elem>
<elem pk="2">test2</elem>
<elem pk="3">test3</elem>
</node>
In my scenario it is required that my node must contain the elements with pk="1" and pk="2".
The element with pk="3" is optional.
Is there a way to catch this scenario in a XSD schema?
Thanks in advance!
...
I've been studying up how to write an XML Schema and I'm stumped on XSD ordering indicators like xs:sequence, xs:all, xs:choice. There seem to be only 3 of them and they're required in complex types. But what if I have the XML like the following:
<row>
<name>John</name>
<city>LA</city>
<country>France</country>
</row>
In w...
I have a number of XML schema that use JAXB (Java Architecture for XML Binding) markup, similar to the following:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="1.0">
<xs:element name="H">
<xs:annotation>
<xs:appinfo>
...
When xml schema validation fails .Net throws some exception. Based on parsing this exception I know how to do some stuff. The problem is that this exception is localized, e.g. on a Japanese machine it is in Japanese.
I do not want to build my application so it will parse every error in any language.
I am an add-in to some other system...
I have an XML schema that uses enumerations, but when I look at the generated XML object in Delphi, the enumeration restriction has been dropped. Is there any way to get Delphi to generate the enum and build it into the object?
XSD Snippet:
<xs:simpleType name="enumType" final="restriction">
<xs:restriction base="xs:NMTOKEN">
...
I've downloaded the official "schema of xsd" from http://www.w3.org/2001/XMLSchema.xsd.
I saved it locally and tried to validate with this code:
var sc = XmlSchema.Read(new FileStream(@"c:\temp\xsd.xsd", FileMode.Open), validate);
sc.Compile(validate);
It failed with an exception that it cannot find some DTD.
Question number 1: Why ...
Hi! Just to be concise I want to obtain something like this:
<root>
<field value="..." text="...">fixed_value1</field>
<field value="..." text="...">fixed_value2</field>
<field value="..." text="...">fixed_value3</field>
<!-- in some cases we can choose the «fixed_value» among different ones -->
...
<field value=...
hi
1) As far as I can tell, only elements can be declared inside <group>declaration, but not attributes. Thus the following text will cause Xml Schema validator to report an error:
<group name="NameGroup">
<sequence>
<element name="first" type="string"></element>
<attribute name="title" type="string"/>
</seq...
I've been trying to deserialize an xml file in C# with classes generated from schemas in xsd.exe. Unfortunately only part of the file is being properly deserialized, the rest is returned as null for reasons I can't work out.
My process is as follows:
Starting with the myschema.xsd file from which the C# code is generated:
<?xml versio...
I'm merging a couple of .xml files together, and need to take certain child elements from each .xml document and put them into a 3rd. And that's OK, but the problem is that then my "child" nodes are in a somewhat random order (well, what I picked from the first file, followed by what I picked from the 2nd), and the schema file (the .xsd...
hi
If we want to create an element containing both simple content ( thus one of the build-in datatypes ) and attributes, then instead of using <simpleType> element, we instead must declare complex type and specify that this complex type will contain simple content. We do this by using <extension> element under the <simpleContent> elemen...