// Parses attribute fields private void ParseAttributeField(URTNamespace parsingNamespace, URTComplexType parsingComplexType) { Util.Log("WsdlParser.ParseAttributeField NS "+parsingNamespace); // Lookup field name String attrTypeName, attrTypeNS; String attrName = LookupAttribute(s_nameString, null, true); // Check if the field is optional bool bOptional = false; String minOccurs = LookupAttribute(s_minOccursString, null, false); if (MatchingStrings(minOccurs, s_zeroString)) bOptional = true; // Handle anonymous types bool bEmbedded, bPrimitive; if (_XMLReader.IsEmptyElement == true) { // Non-anonymous type case and type has to present attrTypeName = LookupAttribute(s_typeString, null, true); ResolveTypeAttribute(ref attrTypeName, out attrTypeNS, out bEmbedded, out bPrimitive); // Read next element ReadNextXmlElement(); // Check for xsd:ID type if (MatchingStrings(attrTypeName, s_idString) && MatchingSchemaStrings(attrTypeNS)) { parsingComplexType.IsStruct = false; return; } } else { // Anonymous type case attrTypeNS = parsingNamespace.Namespace; attrTypeName = parsingNamespace.GetNextAnonymousName(); bPrimitive = false; bEmbedded = true; int curDepth = _XMLReader.Depth; ReadNextXmlElement(); // Parse the type String elementName; while (_XMLReader.Depth > curDepth) { elementName = _XMLReader.LocalName; if (MatchingStrings(elementName, s_simpleTypeString)) { URTSimpleType simpleType = ParseSimpleType(parsingNamespace, attrTypeName); if (simpleType.IsEmittableFieldType) { attrTypeNS = simpleType.FieldNamespace; attrTypeName = simpleType.FieldName; bPrimitive = simpleType.PrimitiveField; parsingNamespace.RemoveSimpleType(simpleType); } } else { // Ignore others elements such as annotations SkipXmlElement(); } } } // Add field to the type being parsed parsingComplexType.AddField(new URTField(attrName, attrTypeName, attrTypeNS, this, bPrimitive, bEmbedded, true, bOptional, false, null, parsingNamespace)); return; }
private void ParseElementField(URTNamespace parsingNamespace, URTComplexType parsingComplexType, int fieldNum) { string nextAnonymousName; string fieldNamespace; bool flag3; bool primitiveField; string name = this.LookupAttribute(s_nameString, null, true); string left = this.LookupAttribute(s_minOccursString, null, false); string str5 = this.LookupAttribute(s_maxOccursString, null, false); bool bOptional = false; if (MatchingStrings(left, s_zeroString)) { bOptional = true; } bool bArray = false; string arraySize = null; if (!MatchingStrings(str5, s_emptyString) && !MatchingStrings(str5, s_oneString)) { if (MatchingStrings(str5, s_unboundedString)) { arraySize = string.Empty; } else { arraySize = str5; } bArray = true; } if (this._XMLReader.IsEmptyElement) { nextAnonymousName = this.LookupAttribute(s_typeString, null, false); this.ResolveTypeAttribute(ref nextAnonymousName, out fieldNamespace, out flag3, out primitiveField); this.ReadNextXmlElement(); } else { fieldNamespace = parsingNamespace.Namespace; nextAnonymousName = parsingNamespace.GetNextAnonymousName(); primitiveField = false; flag3 = true; int depth = this._XMLReader.Depth; this.ReadNextXmlElement(); while (this._XMLReader.Depth > depth) { string localName = this._XMLReader.LocalName; if (MatchingStrings(localName, s_complexTypeString)) { URTComplexType type = this.ParseComplexType(parsingNamespace, nextAnonymousName); if (type.IsEmittableFieldType) { fieldNamespace = type.FieldNamespace; nextAnonymousName = type.FieldName; primitiveField = type.PrimitiveField; parsingNamespace.RemoveComplexType(type); } } else { if (MatchingStrings(localName, s_simpleTypeString)) { URTSimpleType type2 = this.ParseSimpleType(parsingNamespace, nextAnonymousName); if (type2.IsEmittableFieldType) { fieldNamespace = type2.FieldNamespace; nextAnonymousName = type2.FieldName; primitiveField = type2.PrimitiveField; parsingNamespace.RemoveSimpleType(type2); } continue; } this.SkipXmlElement(); } } } parsingComplexType.AddField(new URTField(name, nextAnonymousName, fieldNamespace, this, primitiveField, flag3, false, bOptional, bArray, arraySize, parsingNamespace)); }
// Parses element fields private void ParseElementField(URTNamespace parsingNamespace, URTComplexType parsingComplexType, int fieldNum) { Util.Log("WsdlParser.ParseElementField NS "+parsingNamespace+" fieldNum "+fieldNum); // Determine the field name String fieldTypeName, fieldTypeXmlNS; String fieldName = LookupAttribute(s_nameString, null, true); // Look for array bounds String minOccurs = LookupAttribute(s_minOccursString, null, false); String maxOccurs = LookupAttribute(s_maxOccursString, null, false); // Check if the field is optional bool bOptional = false; if (MatchingStrings(minOccurs, s_zeroString)) bOptional = true; // Check if the field is an inline array bool bArray = false; String arraySize = null; if (!MatchingStrings(maxOccurs, s_emptyString) && !MatchingStrings(maxOccurs, s_oneString)) { if (MatchingStrings(maxOccurs, s_unboundedString)) arraySize = String.Empty; else arraySize = maxOccurs; bArray = true; } // Handle anonymous types bool bEmbedded, bPrimitive; if (_XMLReader.IsEmptyElement == true) { // Non-anonymous type case fieldTypeName = LookupAttribute(s_typeString, null, false); // Handle the absense of type attribute (Object case) ResolveTypeAttribute(ref fieldTypeName, out fieldTypeXmlNS, out bEmbedded, out bPrimitive); // Read next element ReadNextXmlElement(); } else { // Anonymous type case fieldTypeXmlNS = parsingNamespace.Namespace; fieldTypeName = parsingNamespace.GetNextAnonymousName(); bPrimitive = false; bEmbedded = true; int curDepth = _XMLReader.Depth; ReadNextXmlElement(); // Parse the type String elementName; while (_XMLReader.Depth > curDepth) { elementName = _XMLReader.LocalName; if (MatchingStrings(elementName, s_complexTypeString)) { URTComplexType complexType = ParseComplexType(parsingNamespace, fieldTypeName); if (complexType.IsEmittableFieldType) { fieldTypeXmlNS = complexType.FieldNamespace; fieldTypeName = complexType.FieldName; bPrimitive = complexType.PrimitiveField; parsingNamespace.RemoveComplexType(complexType); } } else if (MatchingStrings(elementName, s_simpleTypeString)) { URTSimpleType simpleType = ParseSimpleType(parsingNamespace, fieldTypeName); if (simpleType.IsEmittableFieldType) { fieldTypeXmlNS = simpleType.FieldNamespace; fieldTypeName = simpleType.FieldName; bPrimitive = simpleType.PrimitiveField; parsingNamespace.RemoveSimpleType(simpleType); } } else { // Ignore others elements such as annotations SkipXmlElement(); } } } // Add field to the type being parsed parsingComplexType.AddField(new URTField(fieldName, fieldTypeName, fieldTypeXmlNS, this, bPrimitive, bEmbedded, false, bOptional, bArray, arraySize, parsingNamespace)); return; }
private void ParseAttributeField(URTNamespace parsingNamespace, URTComplexType parsingComplexType) { string nextAnonymousName; string fieldNamespace; bool flag2; bool primitiveField; string name = this.LookupAttribute(s_nameString, null, true); bool bOptional = false; if (MatchingStrings(this.LookupAttribute(s_minOccursString, null, false), s_zeroString)) { bOptional = true; } if (this._XMLReader.IsEmptyElement) { nextAnonymousName = this.LookupAttribute(s_typeString, null, true); this.ResolveTypeAttribute(ref nextAnonymousName, out fieldNamespace, out flag2, out primitiveField); this.ReadNextXmlElement(); if (MatchingStrings(nextAnonymousName, s_idString) && this.MatchingSchemaStrings(fieldNamespace)) { parsingComplexType.IsStruct = false; return; } } else { fieldNamespace = parsingNamespace.Namespace; nextAnonymousName = parsingNamespace.GetNextAnonymousName(); primitiveField = false; flag2 = true; int depth = this._XMLReader.Depth; this.ReadNextXmlElement(); while (this._XMLReader.Depth > depth) { if (MatchingStrings(this._XMLReader.LocalName, s_simpleTypeString)) { URTSimpleType type = this.ParseSimpleType(parsingNamespace, nextAnonymousName); if (type.IsEmittableFieldType) { fieldNamespace = type.FieldNamespace; nextAnonymousName = type.FieldName; primitiveField = type.PrimitiveField; parsingNamespace.RemoveSimpleType(type); } } else { this.SkipXmlElement(); } } } parsingComplexType.AddField(new URTField(name, nextAnonymousName, fieldNamespace, this, primitiveField, flag2, true, bOptional, false, null, parsingNamespace)); }