Archive for the ‘XSD’ Category
Posted by jpluimers on 2016/04/14
It is pretty easy to switch from the XSD Designer to the Code view: c# – Viewing XSD as code – Stack Overflow .
But I got a bit fed up of doing this each and every time after opening an XSD file in Visual Studio.
It turns out there is a default for that which is a bit hidden away: in the File Open dialog. There,
right click on an XSD file, choose “Open with…” and select the appropriate option – then click on “Set as Default” before you actually open it.
via Stop Visual Studio 2010 opening XSDs in design mode – Stack Overflow .
–jeroen
Posted in Development , Software Development , Visual Studio 11 , Visual Studio 2010 , Visual Studio 2013 , Visual Studio 2014 , Visual Studio 2015 , Visual Studio and tools , XML/XSD , XSD | 1 Comment »
Posted by jpluimers on 2015/07/22
See the gist below:
Example of xsd2code only handling xsd annotations for attributes, not for elements, types and other places where they can be used in an XSD.
Steps to reproduce:
Install xsd2code and Visual Studio.
Put all these files in one directory.
Run `generate-C#-from-XSD-annotations.bat`.
Diff `annotations.xsd.exe.cs` and `annotations.xsd2code.exe.cs`.
Observe only 1 spot in `annotations.xsd2code.exe.cs` has the annotations converted to C# comments.
Gist: Example of xsd2code only handling xsd annotations for attributes, not for elements, types and other places where they can be used in an XSD. Steps to reproduce.
Read the rest of this entry »
Posted in .NET , .NET 2.0 , .NET 3.0 , .NET 3.5 , .NET 4.0 , .NET 4.5 , C# , C# 2.0 , C# 3.0 , C# 4.0 , C# 5.0 , C# 6 (Roslyn) , Development , Software Development , XML , XML/XSD , XSD | Leave a Comment »
Posted by jpluimers on 2015/05/12
Boy, Microsoft made it hard to find the location of xsd.exe !
It is actually located like here:
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\xsd.exe
But that is nowhere on the default path, nor in the registry.
What happens during installation of Visual Studio and/or the Microsoft SDK, is that the vsvars32.bat file of Visual Studio is updated so it can add the location of many tools (including xsd.exe) to the PATH.
So the trick is to find the youngest Visual Studio first, then run the according vsvars32.bat, and then xsd.exe is on the path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: Dynamically finds the installed xsd.exe, then calls it with the passed parameters
:: test these environment variables that have 110 or 120 in them (future enhancements: support more Visual Studio versions):
:: Visual Studio .NET 2002: VS70COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio .NET\Common7\Tools\
:: Visual Studio .NET 2003: VS71COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Common7\Tools\
:: Visual Studio 2005: VS80COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\Tools\
:: Visual Studio 2008: VS90COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\
:: Visual Studio 2010: VS100COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\
:: Visual Studio 2012: VS110COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\
:: Visual Studio 2013: VS120COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
:: They contain `vsvars32.bat` which will update the `PATH` so it includes where `xsd.exe` resides
setlocal enabledelayedexpansion
:: delayed expansion allows for the exclamation marks
:: see http://ss64.com/nt/delayedexpansion.html
:: see http://stackoverflow.com/questions/22857407/windows-batch-how-to-assign-variable-with-dynamic-name
for %%v in (70 71 80 90 100 110 120 130) do if not [!VS%%vCOMNTOOLS!]==[] set VSCOMNTOOLS=!VS%%vCOMNTOOLS!
call :do call "!VSCOMNTOOLS!vsvars32.bat"
call :do where xsd.exe
xsd.exe %*
endlocal
goto :eof
:do
echo %*
%*
goto :eof
–jeroen
via:
Read the rest of this entry »
Posted in .NET , .NET 2.0 , .NET 3.0 , .NET 3.5 , .NET 4.0 , .NET 4.5 , C# , C# 2.0 , C# 3.0 , C# 4.0 , C# 5.0 , C# 6 (Roslyn) , Development , Software Development , Visual Studio 11 , Visual Studio 2010 , Visual Studio 2013 , Visual Studio 2014 , Visual Studio and tools , XML/XSD , XSD | 1 Comment »
Posted by jpluimers on 2015/05/05
I wrote about the xsd.exe tool before to generate XSD from XML:
But it is much more than that, as it is a great way of generating .NET (not only C# and VB.NET code) from XSD files:
Long ago, xsd.exe used to come as part of Visual Studio , but now it is installed with the various Microsoft Windows SDK versions (of which some are downloadable ) which makes it harder to locate on your system.
The really bad thing is that Visual Studio cannot find XSD.exe as part of your project Build Events , as the PATH has not been set up correctly.
Starting xsd.exe from a Visual Studio Build Events
In my hunt for the xsd.exe location, I started with a small batch file to find the xsd.exe locations from the registry:
Read the rest of this entry »
Posted in .NET , Continuous Integration , Development , msbuild , Software Development , Visual Studio 2003 , Visual Studio 2005 , Visual Studio 2008 , Visual Studio 2010 , Visual Studio 2013 , Visual Studio 2014 , Visual Studio and tools , XML/XSD , XSD | 3 Comments »
Posted by jpluimers on 2014/12/31
While creating jeroenp / BeSharp.net / source / Native / Delphi / Scripts / GroupProj.xsd — Bitbucket , I bumped into the fact that regular expressions in XSD *or better XML Schema Regular Expressions ) regular expressions are a tad different than the RegEx.
Actually, there are quite a few regular expression flavours, and all of them are a tad different. The page Compare Regular Expression Flavors at Regular-Expressions.info .
That is a great site with Regex Tutorial, Examples and Reference – Regexp Patterns by RegEx guru Jan Goyvaerts (yes, that looks Dutch, but he was born in Belgium and now lives in Phuket ) famous for tools like PowerGREP and RegExBuddy . All based on the great Delphi RegEx PCRE library written by Jan and included in Delphi XE and up.
The thing that baffled me most is that even though XML Schema Regular Expressions do not support anchors ^ and $ , you still have to escape them.
–jeroen
via: XML Schema Regular Expressions .
Posted in Development , RegEx , Software Development , XML/XSD , XSD | 2 Comments »
Posted by jpluimers on 2014/10/16
A big part of the cloud is not about storage, it is about on-line tools that run in your web-browser so you do not have to install them locally.
Quite a bit of my XML work can be done with on-line tools like these:
–jeroen
Posted in " quot , & amp , > gt , < lt , ' apos , CSV , Development , nbsp , Software Development , XML , XML escapes , XML/XSD , XPath , XSD , XSLT | Leave a Comment »
Posted by jpluimers on 2014/09/23
Almost 4 years ago, I compared XSD.EXE to some on-line tools. Time for a follow-up.
From the old post:
XML Utilities has since then moved to a new domain: www.xmlutilities.net ; the other 2 are still at their original locations.
New on-line generators I got pointed at by Mark O’Connor’s stackoverflow answer :
Free Online XSD/XML Schema Generator From XML – FreeFormatter.com .
XML to XSD Generater Online – xmlGrid.net .
Neither of them can generate the XML types separately like XmlForAsp XML Schema Generator does.
But the first one does get attributes right, whereas all the others often skip some or all of the attributes.
–jeroen
via Generate XSD from XML – XSD.EXE versus on-line tools « The Wiert Corner – irregular stream of stuff .
Posted in Development , Software Development , XML , XML/XSD , XSD | 4 Comments »
Posted by jpluimers on 2013/09/01
While working on my Delphi: First try on an XSD for .groupproj files , I bumped into an error `Namespace ” is not available to be referenced in this schema `.
I added a targetNamespace attribute to the GroupProj.xsd so the .grouproj files would use the right namespace.
That resulted into two funny errors:
Namespace ” is not available to be referenced in this schema .
Visual Studio (which I normally use for editing XSD) would only throw this error on these elements:
<xsd:element ...>
So it would not throw them on nodes using the empty namespace.
That was really confusing!
When validating .grouproj files using this GroupProj.xsd, I would get this error for all .groupproj files:
System.Xml.Schema.XmlSchemaValidationException: Type ‘<type>’ is not declared. (in this case for ‘<type>’ ‘ProjectType’).
That was odd too: the ‘ProjectType’ was indeed declared, and should be valid.
I could hardly find any information about the latter error, but the former gave a few useful hits.
Thanks User weston – Stack Overflow . for answering this: it made me smack to my head (like usual, a case of EBCAK ). Read the rest of this entry »
Posted in Delphi , Delphi 2007 , Delphi 2009 , Delphi 2010 , Delphi XE , Delphi XE2 , Delphi XE3 , Delphi XE4 , Delphi XE5 , Development , Software Development , XML/XSD , XSD | Tagged: software , stack overflow , technology | 2 Comments »