XML

How to Design XML Documents

  1. Design your XML documents so that they are well-suited for processing by your applications today.
    1. If your XML is intended to be a transport between relational databases, design your XML to be flat, with easy mappings from XML to (relational) database tables.
    2. If you intend to use and manipulate the XML data directly, design easy XPath access points for XSL transforms and XQuery application.
  2. Eliminate nonessential markup (tags). Only use tags that are actually used by your applications today.
  3. Identify likely future expansion points to the XML. For example, would new data members be captured by adding a new attribute? A new element? A new namespace?

XMLKit

XMLKit is a bundle of useful XML conversion and validation programs using batch files to simplify their deployment and use. Available programs include:

jing
Validate XML against RelaxNG and RelaxNG Compact schema
msv
The Sun Multi-Schema XML Validator allows validation of XML documents
in RELAX NG, TREX, XML DTDs, and a subset of W3C XML Schema
relames
Validates RELAX NG with embedded Schematron support

xpatch (take 2)

This is a follow up to my previous proposal on xpatch.

Joe has rightly pointed out that XPath is not sufficient to handles XML files where ordering is not guaranteed. For example:

  <attendees>
    <attendee name="Dream" status="Confirmed" />
    <attendee name="Desire" status="No reply" />
  </attendees>

If I want to update Desire's status, but don't know a priori which order these elements will be returned, xpatch won't work:

xpatch - a proposed XML diff format

UPDATE: Also see my follow-up post on an alternative method for replacing nodes.

Joe Gregorio asks about available XML diff formats, and based on some Googling, there really isn't anything robust and/or readable out there.

In particular, most formats seem to hard code differences by node number, which doesn't hold up at all well if you may want to merge diffs from multiple sources from a single code base a la traditional diff merging in code bases.

Given the enormous amounts of XML being processed, it seems incredible that nothing has been defined no standards have emerged so far. So here's a possible option. It's based heavily on the Mozilla XUL Overlays pattern, but generalised for any XML.

More on VBScript and SharePoint SOAP

In response to a question from a reader, Tim, this is a follow-up from an earlier article on SharePoint, SOAP and VBScript. This time, we'll look at how to do more complex calls to SharePoint web services in VBScript

Some web services in SharePoint require passing XML as parameters. Unfortunately, you can't pass an XML document, it has to be an XML node element, and this takes a bit of effort to construct in VBScript.

The example we'll use is making a call to GetListItems, which returns all items in a SharePoint library, optionally matching a query formatted using a special XML syntax.

Call Apache Ant from Java

This is a nice trick. Particularly since Ant provides some pretty nice tools for XML manipulation.

eXisting with WebDAV

I've long been fascinated by the eXist native XML database, and I think it's just made it into my list of apps that can really help an enterprise out.

Why? Well, I think in the Web 2.0 days there's a clear shift away from aggregated data sources to document-driven workflows. But there's still a need to search, run queries, and limit access to these documents.

Plus eXist belongs to the WebDAV world. That means REST: you can add, update and delete documents from eXist just by issuing the right HTTP command. The icing on the cake is that by making a couple of simple changes to an XML 'collection' (think: collection = database) you can turn it into fully fledged Atom feeds with full APP support. Mmmmmm.

Do you want to design an XML schema?

Then check out xFront, and particularly their article XML Schemas: Best Practices.

(UPDATE: Their Design Goals Questionnaire is also really useful.)

Practical advice from the xml-dev mailing group, so these people do it every day.

SharePoint Web Services query

This VBScript code allows you to query and post just about any information to SharePoint using web services. There are two steps involved:

  1. Check the signature of the Web Service you want to invoke. For example, http://sharepoint/_vti_bin/Lists.asmx will give a list of all operations you can perform on SharePoint lists.
  2. Create a VBScript file with the following lines:

    Option Explicit
    
    Dim xmlDoc, SOAPClient
    
    ' Get the root element object
    Set SOAPClient = createobject("MSSOAP.SOAPClient")  

Classes using R3

[For the basics of R3 syntax, see the R3 Draft.]

One of the primary things which makes semantic markup useful is that it allows inferences and deductions based upon knowledge. For example, if I know that John is the father of Susan, and Greg is the brother of Susan, then I can create semantic rules like this:

  A brother is a male sibling
  The father of a sibling is the sibling's father.

and deduce from these rules that John is Greg's father.

R3 allows for these kind of relationships to be expressed through using special nodes that are known to belong to an ontology schema. R3 syntax remains exactly the same except for the introduction of a <template/> tag, which defines spaces for placeholders which need to be filled in accordance with certain critera for a relationship to hold. For example:

Syndicate content