Friday, September 26, 2014

CDATA processing in XML Data Binding

The default option when processing CDATA is to strip away the text ![CDATA[ ... ]] leaving just the contained value. This enables you to display and use  the values without the need for parsing. You can then manually add the ![CDATA[ ... ]] text back in when you set the text (i.e. if the user has updated the value).

However, if you prefer to keep the CDATA tag in the element text, you can set StripCDATA = false in the XmlSerializationContext. But you would then need to strip the CDATA tag yourself before displaying the text to the end user.

E.g.
In C# you would set the following:
LiquidTechnologies.Runtime.Net40.XmlSerializationContext.Default.StripCDATA = false

In C++ you would set the following:
LtXmlLib12::CXmlSerializationContext::GetDefaultContext().SetStripCDATA(false);

Note: This behaviour is the same for simple elements defined as string in the XSD and for extended string elements which are accessed using the PrimitiveValue member in the generated source code.

See Also
CDATA processing in XML Data Binding

Tuesday, September 09, 2014

Error E2001 - The schema does not contain any 'elements' so will not generate any classes

If you run the Liquid XML Data Binder and get error E2001, it means you need to add at least 1 element in order to generate your C#, C++, Java, VB .Net or Visual Basic 6 classes.

As explained in yesterdays blog Element vs complexType, you may only validate an xml document if your schema contains an element which describes each item (tag) used within the document.

Wizard Error E2001

Message

The schema does not contain any 'elements' so will not generate any classes.

Explanation

Xml Schema elements can be considered as objects that have a type defined by the simple and complex types. So if no elements are specified in the schema, no classes will be generated as the optimiser will determine that none of the declared complexTypes will never be utilised.

Solution

The solution is to declare elements within the schema.

E.g. The following Xml Schema (XSD) will not generate any classes as no elements are defined.

<?xml version="1.0" encoding="utf-8"?>
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
   <xs:complexType name="Item">
     <xs:sequence>
       <xs:element name="Description" type="xs:string"/>
       <xs:element name="Quantity" type="xs:unsignedLong"/>
     </xs:sequence>
   </xs:complexType>
   <xs:complexType name="QuotedItem">
     <xs:sequence>
       <xs:element name="Item" type="Item"/>
       <xs:element name="PricePerItemInPence" type="xs:unsignedLong" minOccurs="0"/>
       <xs:element name="CurrentAvalibility" type="xs:unsignedLong" minOccurs="0"/>
     </xs:sequence>
   </xs:complexType>

However, by extending the schema to define the element QuoteRequest and its associated child elements, a full class hierarchy will be generated:

  <xs:element name="QuoteRequest">
     <xs:complexType>
       <xs:sequence>
         <xs:element name="CustomerID" type="xs:string"/>
         <xs:element name="Item" type="Item" minOccurs="0" maxOccurs="unbounded"/>
       </xs:sequence>
     </xs:complexType>
   </xs:element>
  </xs:schema>

See Also

Elements vs complexTypes

Monday, September 08, 2014

Element vs complexType

When to use Element

If an instance document (xml document) requires an item named Address, then you MUST have an element defined within your xml schema named Address. Otherwise the xml document will never be valid against the schema.

E.g. For the following XML Document item to be valid:

<Address>…</Address>

The XML Schema must define a corresponding element:

<xsd:element name=”Address”>…</xsd:element>

Furthermore, if other elements are allowed to act as substitute items, then the item must be declared as an element.

When to use complexType

Any time the above is not true you should consider using a complexType. Even when the above is true, you may still want to create a complexType to define the structure. This is especially true if the structure may be reused by multiple elements.

E.g. If the Address structure may be used by HomeAddress and WorkAddress, you should define Address as a complexType:

<xsd:complexType name=”AddressType”>…</xsd: complexType >

<xsd:element name=” HomeAddress” type=”AddressType” />
<xsd:element name=” WorkAddress” type=”AddressType” />

Note 1: Whilst the complexType could be named “Address” is it good practice to make types distinct from elements, so here we use the name “AddressType”.

Note 2: You could define AddressType as an element and use the “ref” attribute:

<xsd:element name=”AddressType”>…</xsd: element > <xsd:element name=” HomeAddress” ref=”AddressType” />

However, it is good practice to use complexType for the reusable building blocks that make up your document rules and use element for the actual tags that will be present within the document.

Note 3: If you intend to use the “nillable” attribute, then you MUST use a complexType in the above example, as the ref and nillable attributes are mutually exclusive.

Monday, September 01, 2014

20% Summer Discount for Liquid XML 2014

Buy Liquid XML 2014 NOW and enjoy a 20% Discount

Use Shopping Cart Discount Code: SUMMER20

See Online Shop for full details

Wednesday, August 27, 2014

How to create XML Schema from XML Documents

Create XML Schema using XML documents directly from your XML Editor.

Liquid XML Studio provides a great tool to enable you to infer XML Schema (XSD) from a set of XML Documents, via an easy to use Wizard user interface. This can save you hours of time when you need to define the rules for validating XML Documents which may have been provided by an external source.

Along with been faster, using the tool is significantly more accurate than trying to manually work out what element and attribute values are allowed in the structure of the document.

To use the wizard, follow these simple steps.

Stage 1 - Select an XML Schema name and options:

Wizard Page 1: Select XSD name

Stage 2 - Add sample XML Documents to help define the rules of the XML Schema:

Wizard Page 2: Add sample XML Documents

Stage 3 - Validate your XML Documents using the new XML Schema (XSD):

Use XSD to validate XML Document

Usage Tip

The more sample XML Documents you add, the more accurate your XSD will be as the more rules for element structure and attribute values will be able to be determined by the tool.

Download Liquid XML Studio free trial



Thursday, July 03, 2014

Default Proxy Settings for Large Rollouts

A new point for Liquid XML 2014 is available (12.2.1) which allows for Default Proxy Settings to be added to the registry to assist in large rollouts.

Details can be found in the Knowledge Base article:
http://support.liquid-technologies.com/KB/a43/automatic-activation-for-large-rollouts.aspx

Liquid XML 2014 v12.2.1 is a FREE upgrade for all 2014 license holders and users with a current Upgrade Support Protection Plan (USPP).

Monday, June 23, 2014

XML Editor Software Update 2 Performance and Stability Release

We are pleased to announce a new release of our XML Editor software, Liquid XML Studio 2014.

Update 2 provides better Performance and Stability for editing XML, XSD and WSDL documents and includes:
  • Faster XML Document Loads Times
  • Improved XML Document Validation
  • Improved Progress Monitoring from the Status Bar
  • Improved XML Breadcrumb Bar and XML Document Outline Tree node descriptions
  • Added Command Line support for opening multiple XML files
  • Added Windows Explorer support for opening multiple XML files
  • Added URL tooltips and colour coding to XSD Dependency Viewer
  • Removed diagonal lines from read only XSD items
  • Improved read only XSD item Tooltips
  • Improved default ordering of Error List
  • Improved Find in Files
  • Fix for Large File Editor stability
  • fix for WSDL editor with no schema section
  • Fix for opening empty XSD from WSDL
  • Fix for running XML Diff from inside XML Studio
  • Fix for Project file stability
  • Fix for SVN file monitoring stability
  • General improvements and fixes

Liquid XML 2014 Update 2 is FREE update for all 2014 license holders or those with current Upgrade Support Protection Plan (USPP).

Download a free Trial:
http://www.liquid-technologies.com/Download.aspx

Wednesday, June 11, 2014

Opening Large XML Documents

The Liquid XML Editor can open XML documents of any size so there is not an XML file size limit.

Features are automatically turned on and off depending on the size of the document as follows:

  • XML Documents < 2 MB - All features (Syntax Highlighting, Document Outlining, Intellisense) default value = ON.
  • XML Documents > 2 MB - Document Outlining default value = OFF.
  • XML Documents > 15 MB - Large File Editor is used by default*.

*You can change this value using Tools->Options->Environment->Max File Size in MB. Values of 30MB+ have been used without issue, but performance degrades with file size so 15MB is the default.

The Large File Editor can open files of any size (tested to 2GB+) as it pages the data from disk. This restricts the functionality, but still allows you to use the tools Format Document and Validation.

Tuesday, March 25, 2014

Recent Liquid XML 2014 Fixes


Version : 12.1.3.5036
25 March 2014 - Fix for XML and XSD validation when XSD imports DTDs. General Fixes.

Version: 12.1.2.5004
12 March 2014 - Fix for Schema containing AnyAttribute in XML Data Mapper. General Fixes.

Version: 12.1.1.4994
26 February 2014 - Fix for using GroupDef and GroupRef in XML Data Mapper. General Fixes.


Tip: You can use the Liquid XML Studio 'Help->Check For Updates' menu to find new point releases.

Existing users can see all available downloads for their product from the downloads section o the website. You will need to login as the user who made the original purchase.

If you find any issues with Liquid XML 2014, please make sure you Submit a Support Ticket. Thanks.

Monday, February 24, 2014

Liquid XML 2014 - Update 1

Xml Editor Performance enhancements. Liquid Runtime (C++, Java, .Net, COM) Fixes. General Fixes.

Liquid XML 2014 - Update 1 is a  FREE upgrade for all 2014 license holders and users with current Upgrade Support Protection Plan (USPP).

Download XML Editor