本文整理汇总了C#中IXmlLineInfo.HasLineInfo方法的典型用法代码示例。如果您正苦于以下问题:C# IXmlLineInfo.HasLineInfo方法的具体用法?C# IXmlLineInfo.HasLineInfo怎么用?C# IXmlLineInfo.HasLineInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IXmlLineInfo
的用法示例。
在下文中一共展示了IXmlLineInfo.HasLineInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateParseException
protected virtual Exception CreateParseException(IXmlLineInfo lineInfo, string format, params object[] args) {
if (lineInfo != null && lineInfo.HasLineInfo())
return new HttpParseException(String.Format(CultureInfo.InvariantCulture, format, args), null, this.VirtualPath, null, lineInfo.LineNumber);
else
return new HttpParseException(String.Format(CultureInfo.InvariantCulture, format, args));
}
示例2: SetLineInfo
private void SetLineInfo(IXmlLineInfo lineInfo, SearchResult searchResult)
{
if(lineInfo.HasLineInfo())
{
searchResult.LineNumber = lineInfo.LineNumber;
searchResult.LinePosition = lineInfo.LinePosition;
}
}
示例3: Attribute
public Attribute(string name, IXmlLineInfo lineInfo)
{
this.name = name;
_hasLineInfo = lineInfo.HasLineInfo();
_lineNumber = lineInfo.LineNumber;
_linePosition = lineInfo.LinePosition;
}
示例4: BuildMessage
static string BuildMessage (string message, IXmlLineInfo li, string sourceUri)
{
if (li != null && li.HasLineInfo ()) {
message = String.Format ("{0}. Location: {1} ({2}, {3}).", message, sourceUri, li.LineNumber, li.LinePosition);
}
else if (sourceUri != null)
message = String.Format ("{0}. Location: {1}", message, sourceUri);
return message;
}
示例5: ParseErrorEventArgs
protected internal ParseErrorEventArgs(string message, IXmlLineInfo lineInfo)
{
this._message = message;
if (lineInfo != null) {
this._hasLineInfo = lineInfo.HasLineInfo();
this._lineNumber = lineInfo.LineNumber;
this._linePosition = lineInfo.LinePosition;
}
}
示例6: FormatMessage
internal static string FormatMessage (string message,
IXmlLineInfo lineInfo)
{
NvdlElementBase source = lineInfo as NvdlElementBase;
XmlReader reader = lineInfo as XmlReader;
if (source != null && source.HasLineInfo ())
return String.Format ("{0}. {1} ({2},{3})",
message, source.SourceUri,
source.LineNumber, source.LinePosition);
else if (lineInfo != null && lineInfo.HasLineInfo ())
return String.Format ("{0}. {3}({1},{2})",
message,
lineInfo.LineNumber,
lineInfo.LinePosition,
reader != null ? reader.BaseURI + ' ' : String.Empty);
else
return message;
}
示例7: SetIdentityField
// Return false if there is already the same key.
public bool SetIdentityField (object identity, bool isXsiNil, XsdAnySimpleType type, int depth, IXmlLineInfo li)
{
FieldFoundDepth = depth;
Identity = identity;
IsXsiNil = isXsiNil;
FieldFound |= isXsiNil;
FieldType = type;
Consuming = false;
Consumed = true;
if (li != null && li.HasLineInfo ()) {
FieldHasLineInfo = true;
FieldLineNumber = li.LineNumber;
FieldLinePosition = li.LinePosition;
}
if (!(this.entry.OwnerSequence.SourceSchemaIdentity is XmlSchemaKeyref)) {
for (int i = 0; i < entry.OwnerSequence.FinishedEntries.Count; i++) {
XsdKeyEntry other = (XsdKeyEntry) entry.OwnerSequence.FinishedEntries [i];
if (this.entry.CompareIdentity (other))
return false;
}
}
return true;
}
示例8: ProcessMatch
// In this method, attributes are ignored.
// It might throw Exception.
public void ProcessMatch (bool isAttribute, ArrayList qnameStack, object sender, XmlNameTable nameTable, string sourceUri, object schemaType, NSResolver nsResolver, IXmlLineInfo li, int depth, string attrName, string attrNS, object attrValue, bool isXsiNil, ArrayList currentKeyFieldConsumers)
{
for (int i = 0; i < KeyFields.Count; i++) {
XsdKeyEntryField keyField = KeyFields [i];
XsdIdentityPath path = keyField.Matches (isAttribute, sender, nameTable, qnameStack, sourceUri, schemaType, nsResolver, li, depth, attrName, attrNS, attrValue);
if (path == null)
continue;
if (keyField.FieldFound) {
// HACK: This is not logical by nature. Attributes never be cosuming,
// so I used it as a temporary mark to sign it is *just* validated now.
if (!keyField.Consuming)
throw new ValException ("Two or more matching field was found.",
sender, sourceUri, this.OwnerSequence.SourceSchemaIdentity, null);
else
keyField.Consuming = false;
}
if (keyField.Consumed)
continue;
if (isXsiNil && !keyField.SetIdentityField (Guid.Empty, true, XsdAnySimpleType.Instance, depth, li))
throw new ValException ("Two or more identical field was found.", sender, sourceUri, OwnerSequence.SourceSchemaIdentity, null);
XmlSchemaComplexType ct = schemaType as XmlSchemaComplexType;
if (ct != null &&
(ct.ContentType == XmlSchemaContentType.Empty || ct.ContentType == XmlSchemaContentType.ElementOnly) &&
schemaType != XmlSchemaComplexType.AnyType)
throw new ValException ("Specified schema type is complex type, which is not allowed for identity constraints.", sender, sourceUri, OwnerSequence.SourceSchemaIdentity, null);
keyField.FieldFound = true;
keyField.FieldFoundPath = path;
keyField.FieldFoundDepth = depth;
keyField.Consuming = true;
if (li != null && li.HasLineInfo ()) {
keyField.FieldHasLineInfo = true;
keyField.FieldLineNumber = li.LineNumber;
keyField.FieldLinePosition = li.LinePosition;
}
currentKeyFieldConsumers.Add (keyField);
}
}
示例9: Init
private void Init (XsdKeyTable keyseq, int depth, IXmlLineInfo li)
{
OwnerSequence = keyseq;
KeyFields = new XsdKeyEntryFieldCollection ();
for (int i = 0; i < keyseq.Selector.Fields.Length; i++)
KeyFields.Add (new XsdKeyEntryField (this, keyseq.Selector.Fields [i]));
StartDepth = depth;
if (li != null) {
if (li.HasLineInfo ()) {
this.SelectorHasLineInfo = true;
this.SelectorLineNumber = li.LineNumber;
this.SelectorLinePosition = li.LinePosition;
}
}
}
示例10: XamlXmlNodeInfo
public XamlXmlNodeInfo (XamlNodeType nodeType, object nodeValue, IXmlLineInfo lineInfo)
{
NodeType = nodeType;
NodeValue = nodeValue;
if (lineInfo != null && lineInfo.HasLineInfo ()) {
HasLineInfo = true;
LineNumber = lineInfo.LineNumber;
LinePosition = lineInfo.LinePosition;
} else {
HasLineInfo = false;
LineNumber = 0;
LinePosition = 0;
}
}
示例11: LineInfo
internal LineInfo(IXmlLineInfo lineInfo)
{
m_hasLineInfo = lineInfo.HasLineInfo();
m_lineNumber = lineInfo.LineNumber;
m_linePosition = lineInfo.LinePosition;
}
示例12: VerifyLineInfo
private void VerifyLineInfo(IXmlLineInfo l1, IXmlLineInfo l2, string uri)
{
TestLog.Equals(l1.HasLineInfo(), l2.HasLineInfo(), "HasLineInfo ::: " + uri);
TestLog.Equals(l1.LineNumber, l2.LineNumber, "LineNumber ::: " + uri);
TestLog.Equals(l1.LinePosition, l2.LinePosition, "LinePosition ::: " + uri);
}
示例13: SetLineNumbers
/// <summary>
/// Takes one of the xml line number so the numbers are now zero
/// based instead of one based.
/// </summary>
/// <remarks>A namespace query (e.g. //namespace::*) will return
/// a line info of -1, -1 for the xml namespace. Which looks like
/// a bug in the XPathDocument class.</remarks>
void SetLineNumbers(IXmlLineInfo lineInfo)
{
if (lineInfo.HasLineInfo() && lineInfo.LineNumber > 0) {
lineNumber = lineInfo.LineNumber - 1;
linePosition = lineInfo.LinePosition - 1;
}
}
示例14: Proceed
void Proceed(IXmlLineInfo li)
{
if (li == null || !li.HasLineInfo ())
return;
tw.ProceedTo (li.LineNumber, li.LinePosition);
}
示例15: FormatMessage
static string FormatMessage(string message, IXmlLineInfo xmlinfo)
{
if (xmlinfo == null || !xmlinfo.HasLineInfo())
return message;
return string.Format("Position {0}:{1}. {2}", xmlinfo.LineNumber, xmlinfo.LinePosition, message);
}