March 30, 2010

XML namespaces intro

XML:
Simple example without schema involvement
FILL IN

XML Schema:
targetNamespace

"targetNamespace is used in a schema to specify the namespace that the schema is intended to define" -David Peterson, at JavaRanch

"Each schema document has exactly one target namespace." -XML in a Nutshell

default namespace

noNamespaceSchemaLocation
noNamespaceSchemaLocation: schema to reference for elements that have no namespace prefix?
"The noNamespaceSchemaLocation attribute references an XML Schema document that does not have a target namespace. "

schemaLocation

Interface between XML document and its schema:
FILL IN

Note from w3schools:
The namespace URI is not used by the parser to look up information.

The purpose is to give the namespace a unique name. However, often companies use the namespace as a pointer to a web page containing namespace information.

March 16, 2010

Getting started with Groovy

http://docs.codehaus.org/display/GROOVY/Install+Groovy-Eclipse+Plugin
http://docs.codehaus.org/display/GROOVY/Create+Your+First+Groovy+Project

CSS positioning

http://stackoverflow.com/questions/2451043/change-an-absolutely-positioned-webpage-into-a-centered-one/2451067#2451067

FINISH POST

Groovy intro: range operator and looping

The operator .. in Groovy is called the range operator, not the dot-dot operator or two-dot operator. It's used to define ranges for things like loops; for(1..8){foo()} will loop eight times.

Ref: http://groovy.codehaus.org/Collections#Collections-Ranges

New Groovy-style loops are a little more powerful than Java loops, too:
http://groovy.codehaus.org/Looping

javadoc.exe man page

http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html

Generating Javadoc using MyEclipse

It seems that some versions of MyEclipse don't have the "Generate Javadoc..." option under the main Project menu that "regular" Eclipse does, at least MyEclipse 7.5. The facility for generating Javadoc is still somewhere; one workaround way to access it is by opening the help menu, searching for "javadoc" and opening the second result, "Javadoc Generation." That help file has a link to the Javadoc Generation wizard.

March 15, 2010

soapUI is powerful

soapUI (on SO) has its own API of built-in methods. It allows for scripting in Groovy.

Bonus link: soapUI tips and tricks, including a runTestStepByName-esque method.

Intro to Groovy

http://www.javalobby.org/articles/groovy-intro1/

March 8, 2010

Setting Eclipse diff tool to ignore whitespace

Open Window > Preferences from the menu bar
Select General > Compare/Patch in the left-side tree menu
Check "Ignore white space"
Press Apply, then OK

(from http://masa-paris.spaces.live.com/Blog/cns!F61AACB5DACD22A7!884.entry)

March 5, 2010

XML targetNamespace

"When we want to [validate an XML doc], we need to identify which element and attribute declarations and type definitions in the schemas should be used to check which elements and attributes in the instance document. The target namespace plays an important role in the identification process."
-from w3c here

Qualified and qualified elements are discussed on this page under the section "Qualified or Unqualified."

Qualified: "all the elements and attributes in the instance must have a namespace, which ... adds namespace complexity"
Unqualified: "only the globally declared elements and attributes in the instance must have a namespace, which ... hides the namespace complexity from the instance"

The meaning of global is described on this page:

"When an element declaration is a child of the xs:schema element, the declared element is global. Global elements can be referenced by other element declarations, allowing for element reuse."

More on global vs. local here.

March 2, 2010

Validating XML against schemas in Java

XML validation with namespaces will not work properly unless the DocumentBuilderFactory has namespace awareness turned on manually, via setNamespaceAware.