![]() |
XPathException
Hallo zusammen,
ich bekomme an einer Stelle meines Programms eine XPathException mit folgendem Text:
Code:
Kann einer von euch mir sagen welches Token hier ungültig ist (ich vermute mal das es das Zeichen à ist) ?
************** Exception Text **************
System.Xml.XPath.XPathException: 'companies/company[displayName=Monterey Holdings I Sàrl]' has an invalid token. at MS.Internal.Xml.XPath.XPathParser.CheckToken(LexKind t) at MS.Internal.Xml.XPath.XPathParser.ParsePredicate(AstNode qyInput) at MS.Internal.Xml.XPath.XPathParser.ParseStep(AstNode qyInput) at MS.Internal.Xml.XPath.XPathParser.ParseRelativeLocationPath(AstNode qyInput) at MS.Internal.Xml.XPath.XPathParser.ParseRelativeLocationPath(AstNode qyInput) at MS.Internal.Xml.XPath.XPathParser.ParseLocationPath(AstNode qyInput) at MS.Internal.Xml.XPath.XPathParser.ParsePathExpr(AstNode qyInput) at MS.Internal.Xml.XPath.XPathParser.ParseUnionExpr(AstNode qyInput) at MS.Internal.Xml.XPath.XPathParser.ParseUnaryExpr(AstNode qyInput) at MS.Internal.Xml.XPath.XPathParser.ParseMultiplicativeExpr(AstNode qyInput) at MS.Internal.Xml.XPath.XPathParser.ParseAdditiveExpr(AstNode qyInput) at MS.Internal.Xml.XPath.XPathParser.ParseRelationalExpr(AstNode qyInput) at MS.Internal.Xml.XPath.XPathParser.ParseEqualityExpr(AstNode qyInput) at MS.Internal.Xml.XPath.XPathParser.ParseAndExpr(AstNode qyInput) at MS.Internal.Xml.XPath.XPathParser.ParseOrExpr(AstNode qyInput) at MS.Internal.Xml.XPath.XPathParser.ParseXPathExpresion(String xpathExpresion) at MS.Internal.Xml.XPath.QueryBuilder.Build(String query, Boolean allowVar, Boolean allowKey) at MS.Internal.Xml.XPath.QueryBuilder.Build(String query, Boolean& needContext) at System.Xml.XPath.XPathExpression.Compile(String xpath, IXmlNamespaceResolver nsResolver) at System.Xml.XPath.XPathNavigator.Compile(String xpath) at PDFViewer.FormSaveAs.cb_action_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) |
AW: XPathException
Versuch mal:
Code:
companies/company[displayName=Monterey Holdings I Sàrl]
|
AW: XPathException
Der Kunde sagte mir gerade, dass sie in den XML Dateien nichts ändern können. Ausserdem wird diese XML Datei automatisiert erzeugt und auch noch in anderen Programmen weiterverwendet. Und nu?
|
AW: XPathException
Sagt mal, es müsste doch meines Erachtens eine Funktion oder API oder sonstwas geben, die einen String in einen gültigen XPath Ausdruck umwandelt. Ansonsten hätten doch alle Franzosen oder Chinesen Probleme. Kennt einer von euch so eine Funktion?
|
AW: XPathException
Ich vergeß immer wie die heißt, aber ja, gibt es.
Scheu mal beim HTML, wie dort diese Sonderzeichen kodiert werden. :angle2: |
AW: XPathException
Zitat:
|
AW: XPathException
In PHP gibt es htmlentities, vielleicht existiert eine Funktion mit ähnlichem Namen?
[edit] Oder hilft Dir vielleicht HTTPUtil.HTMLEscape weiter? [/edit] [edit2] *Oops*, es geht ja gar nicht um Delphi :oops: [/edit2] |
AW: XPathException
HttpUtility.EncodeHtml() im System.Web assembly dürfte da helfen.
Du darfst das aber nicht über das komplette XML laufen lassen sondern nur über die XPath-Ausdrücke. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:52 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz