Tuesday, August 18, 2009

Move from xml.core to xsd.core

In the past few weeks, I have looked into org.eclipse.wst.xsd.core, and find the following line of code in DOMNamespaceHelper.java calculating the name space of an element/attribute.

String qualification = (String)cmNode.getProperty("http://org.eclipse.wst/cm/properties/nsPrefixQualification");

The computerName() method from which I got the above line of code is called from the following line of code in DOMContentBuilderImpl.java, visitCMAttributeDeclaration().

String value = valueHelper.getValue(ad, namespaceTable);

ad is an instance of CMAttributeDeclaration, but it is really with the data type of XSDAttrubuteUseAdapter defined in org.eclipse.wst.xsd.core, XSDImpl.java. However, as it is shown in the line of code calculating the name space of an element/attribute, any CMNode object(in this case it is ad) is converted to a CMDocument first before the getProperty() method is invoked in DOMNamespaceHelper.java, computeName().

As a result of that, the getProperty() method invoked is the one under XSDSchemaAdapter class in XSDImpl.java, and the following lines of code are calculating the name space of element/attribute by calling getTargetNamespace().

     result = xsdSchema.getTargetNamespace();

xsdSchema is an instance of org.eclipse.xsd.XSDSchema, which is defined in org.eclipse.xsd_2.5.0.v200905041408.jar in the plug-in dependencies folder.

No comments:

Post a Comment