private void ParseElementDecl(URTNamespace parsingNamespace)
{
Util.Log("SdlParser.ParseElementDecl");
// Obtain element name and its type
String elmName = LookupAttribute(s_nameString, null, true);
String elmNS = parsingNamespace.Name;
String typeName = LookupAttribute(s_typeString, null, false);
// Handle the anonymous types
String typeNS;
bool bEmbedded, bPrimitive;
if(_XMLReader.IsEmptyElement == true)
{
// Non-anonymous type case
// We cannot assert that the type attribute must have been present
// due to the Object/ur-type case
ResolveTypeAttribute(ref typeName, out typeNS, out bEmbedded, out bPrimitive);
// Position to the next element
ReadNextXmlElement();
}
else
{
// Anonymous type case
typeNS = parsingNamespace.Name;
typeName = parsingNamespace.GetNextAnonymousName();
bEmbedded = true;
bPrimitive = false;
// Parse the type
int curDepth = _XMLReader.Depth;
ReadNextXmlElement();
String elementName;
while(_XMLReader.Depth > curDepth)
{
elementName = _XMLReader.LocalName;
if(MatchingStrings(elementName, s_complexTypeString))
{
ParseComplexType(parsingNamespace, typeName);
}
else if(MatchingStrings(elementName, s_simpleTypeString))
{
ParseSimpleType(parsingNamespace, typeName);
}
else
{
// Ignore others elements such as annotations
SkipXmlElement();
}
}
}
// Create a new global element under the current namespace
parsingNamespace.AddElementDecl(new ElementDecl(elmName, elmNS, typeName, typeNS,
bPrimitive));
return;
}