OpenKeyWord  Build_ID: 457, Datum: 01.02.2020 07:45:48
Dont repeat yourself. - Do it once and only once!
okw.OKW_XmlReader Klassenreferenz
+ Zusammengehörigkeiten von okw.OKW_XmlReader:

Öffentliche Methoden

String getXMLFile ()
 
 OKW_XmlReader (String fpsXMLFile) throws JAXBException, ParserConfigurationException, SAXException, IOException
 
String getTextContentSingleValue (String fpsXPathExpression)
 Liest den TextContent eines Tag. Mehr ...
 
ArrayList< String > getTextContentAsList (String fpsXPathExpression)
 Interne Kernfunktion holt die Log-Meldung mit Platzhaltern aus der XML-Datei. Mehr ...
 

Private Methoden

void Init () throws JAXBException, ParserConfigurationException, SAXException, IOException
 Initialisiert die Klasse: Mehr ...
 

Private Attribute

Document myXMLDocument
 
DocumentBuilderFactory mydbFactory
 
DocumentBuilder mydBuilder
 
XPath myXPath
 
String myXMLFile
 

Ausführliche Beschreibung

Definiert in Zeile 24 der Datei OKW_XmlReader.java.

Dokumentation der Elementfunktionen

◆ getTextContentAsList()

ArrayList<String> okw.OKW_XmlReader.getTextContentAsList ( String  fpsXPathExpression)

Interne Kernfunktion holt die Log-Meldung mit Platzhaltern aus der XML-Datei.

"ClassName", "MethodName" and "TextKey" and Actual language from ini-file.

Parameter
ClassNameName of the Class.
MethodNameName of the Method.
TextKeyKey for the Text-Message.
Autor
Zoltan Hrabovszki
Datum
2013_12_22

Definiert in Zeile 164 der Datei OKW_XmlReader.java.

165  {
166 
167  ArrayList<String> lvALReturn = new ArrayList<String>();
168 
169  try
170  {
171 
172  NodeList myNodeList = (NodeList) myXPath.compile(fpsXPathExpression).evaluate(this.myXMLDocument,
173  XPathConstants.NODESET);
174 
175  int lviCount = myNodeList.getLength();
176 
177  if (lviCount >= 1)
178  {
179  for( int i = 0; i < lviCount; i++ )
180  {
181  Node myNode = myNodeList.item(i);
182  lvALReturn.add( myNode.getTextContent() );
183  }
184  }
185  else
186  {
187  throw new OKWMessageNotFoundException("TextContent not Found!");
188  }
189  }
190 
191  catch (OKWMessageNotFoundException | XPathExpressionException e)
192  {
193  OKW_HandleException.StopRunning(e, this.getClass());
194  }
195 
196  return lvALReturn;
197  }

◆ getTextContentSingleValue()

String okw.OKW_XmlReader.getTextContentSingleValue ( String  fpsXPathExpression)

Liest den TextContent eines Tag.

Parameter
fpsXPathExpressionXPath des Tags, welches gelesen werden soll
Rückgabe
Ausnahmebehandlung
OKWMessageNotFoundExceptionWird ausgelöst wenn nicht genau ein Wert gefunden wird.
Autor
Zoltan Hrabovszki
Datum
2016_02_07

Definiert in Zeile 103 der Datei OKW_XmlReader.java.

104  {
105  String lvsReturn = "Message Not Found!";
106 
107  try
108  {
109 
110  NodeList myNodeList = (NodeList) myXPath.compile(fpsXPathExpression).evaluate(this.myXMLDocument,
111  XPathConstants.NODESET);
112 
113 
114  if (myNodeList.getLength() == 1)
115  {
116  Node myNode = myNodeList.item(0);
117  lvsReturn = myNode.getTextContent();
118  }
119  else if (myNodeList.getLength() < 1)
120  {
121  throw new OKWMessageNotFoundException("TextContent not Found!: " + fpsXPathExpression );
122  }
123  else
124  {
125  throw new OKWMessageNotFoundException("TextContent not Unique!: " + fpsXPathExpression );
126  }
127  }
128  // OKWMessageNotFoundException
129  catch (XPathExpressionException e)
130  {
131  OKW_HandleException.StopRunning(e, this.getClass());
132  }
133 
134  return lvsReturn;
135  }
+ Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird:

◆ Init()

void okw.OKW_XmlReader.Init ( ) throws JAXBException, ParserConfigurationException, SAXException, IOException
private

Initialisiert die Klasse:

  • LM- Dateinamen als ermitteln
Autor
Zoltan Hrabovszki
Datum
2013_12_22

Definiert in Zeile 60 der Datei OKW_XmlReader.java.

61  {
62  InputStream is = OKW_XmlReader.class.getResourceAsStream( myXMLFile.toString() );
63 
64  if ( is == null )
65  {
66  System.out.println(
67  "============================================================================================================");
68  System.out.println("OKW Exception: File not found! -> '" + myXMLFile.toString() + "'");
69  System.out.println(
70  "============================================================================================================");
71 
72  throw new FileNotFoundException("File not found! The File was: '" + this.myXMLFile.toString() + "'");
73  }
74  else
75  {
76  this.mydbFactory = DocumentBuilderFactory.newInstance();
77  this.mydBuilder = mydbFactory.newDocumentBuilder();
78  this.myXMLDocument = mydBuilder.parse(is);
79  this.myXPath = XPathFactory.newInstance().newXPath();
80  }
81  }

Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei: