1 /*
2 * Copyright (c) 2002-2026 Gargoyle Software Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 * https://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 package org.htmlunit;
16
17 /**
18 * An exception that is thrown when a specified XML element cannot be found in the DOM model.
19 *
20 * @author Mike Bowler
21 * @author Ronald Brill
22 */
23 public class ElementNotFoundException extends RuntimeException {
24
25 private final String elementName_;
26 private final String attributeName_;
27 private final String attributeValue_;
28
29 /**
30 * Creates an instance from the variables that were used to search for the XML element.
31 *
32 * @param elementName the name of the element
33 * @param attributeName the name of the attribute
34 * @param attributeValue the value of the attribute
35 */
36 public ElementNotFoundException(
37 final String elementName, final String attributeName, final String attributeValue) {
38 super("elementName=[" + elementName
39 + "] attributeName=[" + attributeName
40 + "] attributeValue=[" + attributeValue + "]");
41
42 elementName_ = elementName;
43 attributeName_ = attributeName;
44 attributeValue_ = attributeValue;
45 }
46
47 /**
48 * Returns the name of the element.
49 *
50 * @return the name of the element
51 */
52 public String getElementName() {
53 return elementName_;
54 }
55
56 /**
57 * Returns the name of the attribute.
58 *
59 * @return the name of the attribute
60 */
61 public String getAttributeName() {
62 return attributeName_;
63 }
64
65 /**
66 * Returns the value of the attribute.
67 *
68 * @return the value of the attribute
69 */
70 public String getAttributeValue() {
71 return attributeValue_;
72 }
73 }
74