The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,861 other subscribers

Archive for the ‘XML’ Category

Microsoft Remote Desktop 8 on OS X stores RDP configuration in com.microsoft.rdc.mac.plist and passwords in keychain

Posted by jpluimers on 2017/03/15

One day I write some scripts based on:

Some starting materials are at:

A thing I learned is that the Microsoft Remote Desktop 8 is basically a rebranded iTap RDP (it looks like Microsoft bought iTap RDP for Mac, as iTap RDP for Mac is now discontinued)

–jeroen

Posted in Apple, Development, Mac OS X / OS X / MacOS, OS X 10.10 Yosemite, OS X 10.11 El Capitan, OS X 10.8 Mountain Lion, OS X 10.9 Mavericks, Power User, Remote Desktop Protocol/MSTSC/Terminal Services, Scripting, Software Development, Windows, XML, XML/XSD | Leave a Comment »

A great way to interactively browse xml/xhtml/html on the console: xmllint –shell

Posted by jpluimers on 2016/10/12

A while ago, I heard about xmllint, a program that can parse and query xml from the command-line.

Later, I discovered it can also parse html, can recover from xml/html errors and has an interactive shell that has a lot of commands (see table below) to navigate through the loaded command.

The relevant command-line options:

--recover
--html
--shell

Note that --recover will output failing input to stderr. You can ignore that using 2> /dev/null

Some good examples of usage are here:

The table of shell commands:

Shell

xmllint offers an interactive shell mode invoked with the –shell command. Available commands in shell mode include:
Command Parameter Description
base display XML base of the node
bye leave shell
cat node Display node if given or current node.
cd path Change the current node to path (if given and unique) or root if no argument given.
dir path Dumps information about the node (namespace, attributes, content).
du path Show the structure of the subtree under path or the current node.
exit Leave the shell.
help Show this help.
free Display memory usage.
load name Load a new document with the given name.
ls path List contents of path (if given) or the current directory.
pwd Display the path to the current node.
quit Leave the shell.
save name Saves the current document to name if given or to the original name.
validate Check the document for error.
write name Write the current node to the given filename.

–jeroen

via xmllint.

Posted in Development, HTML, HTML5, Software Development, Web Development, XML, XML/XSD, XPath | Leave a Comment »

C#, XSD.exe, xsd2code and generating nullable fields+properties from an XSD with and without Specified fields/properties

Posted by jpluimers on 2016/07/27

It comes down to these cases for XML elements having maxOccurs="1" (which the default for maxOccurs):

  1. adding nillable="true" will convert from a regular type to a nullable type.
  2. adding minOccurs="0" will add boolean …Specified properties in the generated C# for each element.
  3. you can have both nillable="true" and minOccurs="0" in an element which gets you a nullable type and a …Specified property.

Note I’m not considering fixed or default here, nor attributes (that have use instead of minOccurs/maxOccurs, but do not allow for nillable) nor larger values of maxOccurs (which both xsd.exe and xsd2code regard as unbounded).

From the above, XML has a richer type system than C#, so in XML there are subtle a differences between:

  1. an explicit nil in the XML element
  2. the XML element being absent
  3. the XML element being empty.

Hopefully later more text and examples to show how to actually work with this.

Delphi related to minOccurs:

Note that xsd2code.codeplex.com (unlike XmlGen#) has at least two forks at github:

From the specs:

–jeroen

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), Conference Topics, Conferences, Development, Event, Software Development, XML, XML/XSD, XSD | Leave a Comment »

XSD enumerations: key value pairs

Posted by jpluimers on 2016/04/26

One of the things you cannot do in XSD, is have string enumerations contain both a key and a value.

But there is a little appinfo trick inside annotation that you can user under some circumstances, for instance when you interpret the XSD:


<xs:simpleType name="event_result">
<xs:restriction base="xs:string">
<xs:enumeration value="101">
<xsd:annotation><xsd:appinfo>Syntax error</xsd:appinfo></xsd:annotation>
</xs:enumeration>
<xs:enumeration value="102">
<xsd:annotation><xsd:appinfo>Illegal operation</xsd:appinfo></xsd:annotation>
</xs:enumeration>
<xs:enumeration value="103">
<xsd:annotation><xsd:appinfo>Service not available</xsd:appinfo></xsd:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>

appinfo is the application counterpart of documentation: both can contain any xml, but appinfo is aimed at machines, whereas documentation is aimed at humans.

–jeroen

via:

Posted in Development, Software Development, XML, XML/XSD, XSD | Leave a Comment »

Best Online XML Viewer, Formatter, Editor, Analyser, Beautify-Beautifier, Minify, Tree structure, Notepad, Marker

Posted by jpluimers on 2015/10/14

Thanks Joshep Prajapati for pointing me to this great page which can do a lot of XML related things:

Best Online XML Viewer, Formatter, Editor, Analyser, Beautify-Beautifier, Minify, Tree structure, Notepad, Marker.

–jeroen

via: Generate XSD from XML – XSD.EXE versus on-line tools – take 2 « The Wiert Corner.

Posted in Development, Software Development, XML, XML/XSD, XSD | 3 Comments »

Example of xsd2code only handling xsd annotations for attributes, not for elements, types and other places where they can be used in an XSD.

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:

  1. Install xsd2code and Visual Studio.
  2. Put all these files in one directory.
  3. Run `generate-C#-from-XSD-annotations.bat`.
  4. Diff `annotations.xsd.exe.cs` and `annotations.xsd2code.exe.cs`.
  5. 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 »

Note to self: When sending our xml schema to a third party, make sure to…

Posted by jpluimers on 2015/01/27

From a nice G+ thread:

Maximum line length for XML, oh boy that is just brilliant!

–jeroen

via: Note to self: When sending our xml schema to a third party, make sure to….

Posted in Development, XML, XML/XSD | Leave a Comment »

Some on-line XML tools I use often

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 »

Generate XSD from XML – XSD.EXE versus on-line tools – take 2

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:

  1. Free Online XSD/XML Schema Generator From XML – FreeFormatter.com.
  2. 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 »

Online XML Pretty Print

Posted by jpluimers on 2014/04/22

On my list of on-line tools: XML Pretty Print.

–jeroen

Posted in Development, Software Development, XML, XML/XSD | Leave a Comment »