How to visualize an XML schema programatically? [closed]

The open source command line java application xsdvi creates an interactive diagram in SVG format from an XML Schema Definition. The generated SVG file can be displayed by a modern web browser where the user can expand and collapse the tree by mouse clicking. Here is an example of a generated diagram http://xsdvi.sourceforge.net/ipo.svg The software … Read more

Validating an XML against referenced XSD in C#

You need to create an XmlReaderSettings instance and pass that to your XmlReader when you create it. Then you can subscribe to the ValidationEventHandler in the settings to receive validation errors. Your code will end up looking like this: using System.Xml; using System.Xml.Schema; using System.IO; public class ValidXSD { public static void Main() { // … Read more

What is the difference between XSD and WSDL?

WSDL (Web Services Description Language) describes your service and its operations – what is the service called, which methods does it offer, what kind of in parameters and return values do these methods have? It’s a description of the behavior of the service – it’s functionality. XSD (Xml Schema Definition) describes the static structure of … Read more

What’s the difference between xsd:include and xsd:import?

The fundamental difference between include and import is that you must use import to refer to declarations or definitions that are in a different target namespace and you must use include to refer to declarations or definitions that are (or will be) in the same target namespace. Source: https://web.archive.org/web/20070804031046/http://xsd.stylusstudio.com/2002Jun/post08016.htm

XML Schema minOccurs / maxOccurs default values

The default values for minOccurs and maxOccurs are 1. Thus: <xsd:element minOccurs=”1″ name=”asdf”/> cardinality is [1-1] Note: if you specify only minOccurs attribute, it can’t be greater than 1, because the default value for maxOccurs is 1. <xsd:element minOccurs=”5″ maxOccurs=”2″ name=”asdf”/> invalid <xsd:element maxOccurs=”2″ name=”asdf”/> cardinality is [1-2] Note: if you specify only maxOccurs attribute, … Read more

XML attribute vs XML element

I use this rule of thumb: An Attribute is something that is self-contained, i.e., a color, an ID, a name. An Element is something that does or could have attributes of its own or contain other elements. So yours is close. I would have done something like: EDIT: Updated the original example based on feedback … Read more

Generate C# class from XML

If you are working on .NET 4.5 project in VS 2012 (or newer), you can just Special Paste your XML file as classes. Copy your XML file’s content to clipboard In editor, select place where you want your classes to be pasted From the menu, select EDIT > Paste Special > Paste XML As Classes

How to validate an XML file against an XSD file?

The Java runtime library supports validation. Last time I checked this was the Apache Xerces parser under the covers. You should probably use a javax.xml.validation.Validator. import javax.xml.XMLConstants; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.*; import java.net.URL; import org.xml.sax.SAXException; //import java.io.File; // if you use File import java.io.IOException; … URL schemaFile = new URL(“http://host:port/filename.xsd”); // webapp example … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)