// Record starting position
startLine = locator.getLineNumber();
startColumn = locator.getColumnNumber();
// Check the current parent
IFXGNode parent = null;
if (stack.size() > 0)
{
parent = stack.peek();
if(parent == null)
{
//If the parent is invalid, then there is no need to look into the children
return;
}
}
// Switch to special GroupDefinitionNode for Definition child
if (isFXGNamespace(uri))
{
if (parent instanceof DefinitionNode && FXG_GROUP_ELEMENT.equals(localName))
localName = FXG_GROUP_DEFINITION_ELEMENT;
}
// Create a node for this element
IFXGNode node = createNode(uri, localName);
try
{
if (node == null)
{
if (root != null)
{
if (root.isVersionGreaterThanCompiler())
{
// Warning: Minor version of this FXG file is greater than minor
// version supported by this compiler. Log a warning for an
// unknown element.
//TODO FXGLOG
//FXGLog.getLogger().log(IFXGLogger.WARN, "UnknownElement", null, documentName, startLine, startColumn);
unknownElement = localName;
}
else
{
problems.add(new FXGUnknownElementInVersionProblem(documentPath, startLine, startColumn, localName, root.getFileVersion().asDouble()));
}
}
else
{
problems.add(new FXGInvalidRootNodeProblem(documentPath, startLine, startColumn));
}
return;
}
// Provide access to the root document node used for querying version
// for non-root elements
if (root != null)
{
node.setDocumentNode(root);
}
// Set node name if it is a delegate node. This allows proper error
// message to be reported.
if (node instanceof DelegateNode)
{
DelegateNode propertyNode = (DelegateNode)node;
propertyNode.setName(localName);
}
// Set attributes on the current node
for (int i = 0; i < attributes.getLength(); i++)
{
String attributeURI = attributes.getURI(i);
if (attributeURI == null || attributeURI == "" || isFXGNamespace(attributeURI))
{
String attributeName = attributes.getLocalName(i);
String attributeValue = attributes.getValue(i);
node.setAttribute(attributeName, attributeValue, problems);
}
}
// Associate child with parent node (and handle any special
// relationships)
if (parent != null)
{
if (node instanceof DelegateNode)
{
DelegateNode propertyNode = (DelegateNode)node;
propertyNode.setDelegate(parent, problems);
}
else
{
parent.addChild(node, problems);
}
}
else if (node instanceof GraphicNode)
{
root = (GraphicNode)node;
// Provide access to the root document node
node.setDocumentNode(root);
if (root.getVersion() == null)
{
for(ICompilerProblem problem : problems)
{
if(problem instanceof FXGInvalidVersionProblem)