XPath frage

Status
Nicht offen für weitere Antworten.
B

bygones

Gast
Hi,

ich will eine eigene PMD Regel ueber XPath schreiben.

Dachte erstmal an ein simples, unsinniges bsp... PMD soll mir alle String.valueOf anmeckern, bei denen man eine Konstante und kein literal verwendet.

also [c]String.valueOf(1);[/c] is ok - [c]int c = 1; String.valueOf(c)[/c] soll gemeckert werden

Sinn oder unsinn mal beiseite gelassen

Ich habe mir den AST erzeugen lassen - unter //PrimaryPrefix/Name bekomme ich String.valueOf und wenn eine Konstante genutzt wurde auch diese (also 2 matches).

Erste Frage: wie komm ich an "String.valueOf" wenn ich //PrimaryPrefix/Name abfrage... ich will ja den Knoten der String.valueOf hat und nicht andere....

Zweite Frage: wie baue ich eine Bedingung, dass er matcht wenn String.valueOf vorhanden ist UND die expression dann ein Literal ist ?

Kann mir wer helfen / tipps geben ?

Danke
 
B

bygones

Gast
ok bedingung habe ich schonmal... vll nicht huebsch, aber es klappt

fehlt nur noch wie ich testen kann dass PrimaryPrefix/Name den wert (?) String.valueOf hat...
 
B

bygones

Gast
und selber gefunden...

@Image ist es...

interessanter name dafuer
 
Status
Nicht offen für weitere Antworten.
Ähnliche Java Themen
  Titel Forum Antworten Datum
R XPath - frage zur Adressierung XML & JSON 3
G XPATH-Frage XML & JSON 2
F XPath frage XML & JSON 4
T Frage zu XQuery (XQJ) / XPath XML & JSON 2
G Frage zu XPath XML & JSON 2
Kirby.exe Probleme mit XML XPATH Select XML & JSON 3
B XPath soll XML liefern XML & JSON 7
O XPATH Problem - Anfänger XML & JSON 4
M dom4j unberechtigte Invalid XPath expression XML & JSON 12
W XPath schreiben XML & JSON 1
P HTML XPath XML & JSON 1
S Ersatz für die veraltete Klasse XPath XML & JSON 1
C XPath: Alle Kinder in einer Schleife auslesen XML & JSON 2
P Xpath zugriff auf Attribute XML & JSON 3
P "XPath is deprecated" XML eclipse XML & JSON 3
G HtmlUnit XPath XML & JSON 5
D XPath-Query XML & JSON 2
I XPath Namensräume und auslesen einzelner Knoten XML & JSON 3
AMStyles XPATH Befehl SVG Java XML & JSON 2
G xpath: in Kindelement zwei Attribut-Werte auslesen XML & JSON 2
G xpath: Inhalt eines Kindelements auslesen XML & JSON 2
H ChildNode via XPath ansprechen XML & JSON 2
G JDOM - aus Children-Liste ein Child direkt ansprechen ohne XPath? XML & JSON 9
S Attribute von Elementen auslesen mit XPath XML & JSON 2
T Xpath & JDOM Element Pfad ausgeben XML & JSON 2
W XPath + Inhalt aus <td> XML & JSON 2
reibi XPath XML & JSON 14
M xPath liefert leeres Nodeset XML & JSON 2
M Probleme mit XPath bei Java XML & JSON 5
W Element mit XPath @id ermitteln wenn nur ein teil der id bekannt ist XML & JSON 2
F XPath-Problem mit DOM4J XML & JSON 8
T XPath Problem: finden einer Node nach Attributswert XML & JSON 2
O XPATH gesucht XML & JSON 6
L Element manipulieren in einem DOMResult per XPath XML & JSON 10
P XPath und Namespaces XML & JSON 3
G XPath - replace function funktioniert nicht XML & JSON 3
E XPATH-Ausdruck mit not XML & JSON 4
E Wieso liefert dieser XPATH-Ausdruck nicht die richtige Anzahl Treffer? XML & JSON 8
M XPath Ausdruck validieren XML & JSON 2
N XPath Adressierung XML & JSON 7
B Optionaler XPath pfad XML & JSON 2
P XPath Problem XML & JSON 2
S Problem mit XPath XML & JSON 4
T Mit XPATH finden und dann änder XML & JSON 2
T EXSD auslesen mit XPath und JDOM XML & JSON 8
G XPath gesucht für Tag mit konkretem Content XML & JSON 2
A XPath Problem XML & JSON 2
C XPath in JDOM klappt nicht XML & JSON 2
T Prbolem XPath XML & JSON 2
X Xpath, alle Element die mit "user" beginnen auswäh XML & JSON 2
loadbrain XPath Problem XML & JSON 2
M brauche große XML-Datei für XPath-Tests XML & JSON 4
M JDOM und XPath, zu Element zugehörigen XPath-Ausdruck XML & JSON 5
F JDOM und XPath - Problem mit Namespace ohne Prefix XML & JSON 5
F hilfe bei xpath-ausdruck XML & JSON 2
K java + xpath -> performanceproblem XML & JSON 9
H Xpath kindelemente auslesen XML & JSON 2
S Xml zurück in xpath wandeln XML & JSON 8
flashfactor Filtern mittels XPATH XML & JSON 4
M XSL/XPath - Nur ersten Wert mit selben Attribut XML & JSON 4
M XPath Problem im Zusammenhang mit document() XML & JSON 2
M Frag zu xsl:when beziehungsweise XPath XML & JSON 3
F JDom und XPath XML & JSON 12
C xpath funktioniert nicht XML & JSON 5
M XPATH und RSS (Problem namespaces) XML & JSON 7
P nochmal XPath :-) XML & JSON 22
P XPath . XML & JSON 2
T Rekursiver Verzeichniss Baum in XML & XPath XML & JSON 4
clemson xpath mit jdom XML & JSON 2
Wildcard xpath Parser XML & JSON 8
W Design Frage zum Geld Protokoll des App Stores XML & JSON 0
K Frage zu der Ausgabe von XML Knotentypen XML & JSON 2
mananana Frage zu JSON XML & JSON 3
pkm Frage zu org.w3c.dom.Node.getNextSibling() und org.w3c.dom.Node.getNextChild() XML & JSON 1
F Frage zu XML Validation XML & JSON 5
B Frage zu Tree Traversal XML & JSON 2
L Frage zu ListViews XML & JSON 1
A Frage zu bestehender XML Datei XML & JSON 6
S XQuery - Frage zur Ausgabe XML & JSON 5
T Frage zu getContent unter jdom XML & JSON 6
K XSLT Frage XML & JSON 4
M Frage zu Erklärung im Online book "Java ist auch eine I XML & JSON 4
G web.xml frage XML & JSON 4
G Newbe - Frage.XML - Datei einlesen und speichern XML & JSON 2
T Newbie Frage. CSS Stylesheet einlesen und suchen nach Tags XML & JSON 6
O Frage zu JaxMe2! XML & JSON 3
E @pp workaround frage ;-) XML & JSON 3
T Newbie Frage.aus Java eine XML Datei erstellen? XML & JSON 7
Z Frage zu XML Schema XML & JSON 3
G Frage zu erreichen von Elementen XML & JSON 3
S [Frage] iterator bei jdom bricht ab XML & JSON 4

Ähnliche Java Themen

Neue Themen


Oben