private static bool TryGetDefinedPrefix(IXmlNode node, string namespaceUri, out string prefix) { var definedPrefix = node.LookupPrefix(namespaceUri); return(string.IsNullOrEmpty(definedPrefix) ? Try.Failure(out prefix) : Try.Success(out prefix, definedPrefix)); }
private bool TryGetXmlMetadata(Type clrType, out XmlMetadata metadata) { var kind = XmlTypeSerializer.For(clrType).Kind; return(kind == XmlTypeKind.Complex && clrType.GetTypeInfo().IsInterface ? Try.Success(out metadata, GetXmlMetadata(clrType)) : Try.Failure(out metadata)); }
private bool IsMatch() { IXmlKnownType knownType; return(knownTypes.TryGet(this, out knownType) ? Try.Success(out type, knownType.ClrType) : Try.Failure(out type)); }
private static bool ParseName(Tokenizer source, out string name) { if (source.Token != Token.Name) { return(Try.Failure(out name)); } name = source.Text; source.Consume(); return(true); }
private bool TryGetPreferredPrefix(IXmlNode node, string namespaceUri, out string prefix) { prefix = this.LookupPrefix(namespaceUri); if (string.IsNullOrEmpty(prefix)) { return(Try.Failure(out prefix)); // No preferred prefix } namespaceUri = node.LookupNamespaceUri(prefix); return(string.IsNullOrEmpty(namespaceUri) ? true // Can use preferred prefix : Try.Failure(out prefix)); // Preferred prefix already in use }
private bool TryGetAccessor(string key, PropertyDescriptor property, bool requireVolatile, out XmlAccessor accessor) { accessor = property.HasAccessor() ? property.GetAccessor() : CreateAccessor(key, property); if (accessor.IsIgnored) { return(Try.Failure(out accessor)); } if (requireVolatile && !accessor.IsVolatile) { return(Try.Failure(out accessor)); } return(true); }
private static bool ParseValue(Tokenizer source, out XPathExpression value) { var start = source.Index; var parsed = Consume(source, Token.StringLiteral) || (Consume(source, Token.VariableStart) && ParseQualifiedName(source, null)); if (!parsed) { return(Try.Failure(out value)); } var xpath = source.GetConsumedText(start); value = XPathExpression.Compile(xpath); return(true); }
public bool TryGet(XmlName xsiType, out IXmlIncludedType includedType) { if (xsiType == XmlName.Empty || xsiType == this.XsiType) { return(Try.Success(out includedType, this)); } if (!includedTypes.TryGet(xsiType, out includedType)) { return(false); } if (!ClrType.IsAssignableFrom(includedType.ClrType)) { return(Try.Failure(out includedType)); } return(true); }
public bool TryGet(Type clrType, out IXmlKnownType knownType) { return(IsMatch(clrType) ? Try.Success(out knownType, this) : Try.Failure(out knownType)); }
public bool TryGet(IXmlIdentity xmlName, out IXmlKnownType knownType) { return(IsMatch(xmlName) ? Try.Success(out knownType, this) : Try.Failure(out knownType)); }
public bool TryGet(Type clrType, out IXmlIncludedType includedType) { return(clrType == this.clrType ? Try.Success(out includedType, this) : Try.Failure(out includedType)); }
public bool TryGet(XmlName xsiType, out IXmlIncludedType includedType) { return(xsiType == XmlName.Empty || xsiType == this.XsiType ? Try.Success(out includedType, this) : Try.Failure(out includedType)); }