Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/validate/SMUtil.java')
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/validate/SMUtil.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/validate/SMUtil.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/validate/SMUtil.java
new file mode 100644
index 0000000000..6bf6fede41
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/validate/SMUtil.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.html.core.internal.validate;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+final class SMUtil {
+
+ private SMUtil() {
+ super();
+ }
+
+ /* get an ancestor element ignoring implicit ones. */
+ public static Element getParentElement(Node child) {
+ if (child == null)
+ return null;
+
+ Node p = child.getParentNode();
+ while (p != null) {
+ if (p.getNodeType() == Node.ELEMENT_NODE) {
+ return (Element) p;
+ }
+ p = p.getParentNode();
+ }
+ return null;
+ }
+} \ No newline at end of file

Back to the top