Java Code Examples for org.w3c.dom.Element#getUserData()
The following examples show how to use
org.w3c.dom.Element#getUserData() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WidgetDocumentInfo.java From scipio-erp with Apache License 2.0 | 6 votes |
/** * Makes description for an element, including tag name, location, and column/line, * for log/error messages. * FIXME: seems redundant, there is another utility somewhere that does this? */ public static String getElementDescriptor(Element element) { String desc = "element: " + element.getTagName(); String location = getResourceLocation(element); if (location != null) { desc += ", location: " + location; } Integer startLine = (Integer) element.getUserData("startLine"); if (startLine != null) { desc += ", line: " + startLine; } Integer startColumn = (Integer) element.getUserData("startColumn"); if (startColumn != null) { desc += ", column: " + startColumn; } return desc; }
Example 2
Source File: PositionalXmlHandlerTest.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
@Test public void testStartElement() throws SAXException { handler.startDocument(); Locator2 locator = Mockito.mock(Locator2.class); handler.setDocumentLocator(locator); Mockito.when(locator.getLineNumber()).thenReturn(1); Mockito.when(locator.getColumnNumber()).thenReturn(7); handler.startElement("", "", "element", new AttributesImpl()); assertEquals(1, handler.getElementStack().size()); Element element = handler.getElementStack().pop(); DocumentLocation location = (DocumentLocation) element.getUserData("location"); assertEquals(1, location.getLineNumber()); assertEquals(7, location.getColumnNumber()); }
Example 3
Source File: WebXmlValidator.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
/** * Validates that web.xml specifies a compatible deployment descriptor version. */ private void validateServletVersion() { NodeList webAppList = document.getElementsByTagName("web-app"); for (int i = 0; i < webAppList.getLength(); i++) { Element webApp = (Element) webAppList.item(i); String namespace = webApp.getNamespaceURI(); String version = (String) webApp.getUserData("version"); if ("http://xmlns.jcp.org/xml/ns/javaee".equals(namespace) || "http://java.sun.com/xml/ns/javaee".equals(namespace)) { // Check that web.xml version is compatible with our supported Dynamic Web Project versions if (!servletApiSupportChecker.test(resource.getProject(), version)) { DocumentLocation location = (DocumentLocation) webApp.getUserData("location"); ElementProblem element = new JavaServletElement(location, 0); problems.add(element); } } } }
Example 4
Source File: StatementSourceReferenceHandler.java From yangtools with Eclipse Public License 1.0 | 5 votes |
static StatementSourceReference extractRef(final Element element) { final Object value = element.getUserData(USER_DATA_KEY); if (value instanceof StatementSourceReference) { return (StatementSourceReference) value; } if (value != null) { LOG.debug("Ignoring {} attached to key {}", value, USER_DATA_KEY); } return null; }
Example 5
Source File: EntityConfig.java From scipio-erp with Apache License 2.0 | 4 votes |
public static String createConfigFileLineNumberText(Element element) { if (element.getUserData("startLine") != null) { return " [" + ENTITY_ENGINE_XML_FILENAME + " line " + element.getUserData("startLine") + "]"; } return ""; }
Example 6
Source File: JdbcElement.java From scipio-erp with Apache License 2.0 | 4 votes |
protected JdbcElement(Element element) throws GenericEntityConfException { this.isolationLevel = element.getAttribute("isolation-level").intern(); Object lineNumber = element.getUserData("startLine"); this.lineNumber = lineNumber == null ? "unknown" : lineNumber.toString(); }
Example 7
Source File: MiniLangElement.java From scipio-erp with Apache License 2.0 | 4 votes |
public MiniLangElement(Element element, SimpleMethod simpleMethod) { this.lineNumber = element.getUserData("startLine"); this.simpleMethod = simpleMethod; this.tagName = element.getTagName().intern(); }
Example 8
Source File: ModelWidget.java From scipio-erp with Apache License 2.0 | 2 votes |
/** * XML constructor. SCIPIO: now supports explicit/custom name override; use empty string for explicit empty. * @param widgetElement The XML Element for the widget * @param name The widget name, or null to read from "name" attribute (SCIPIO: improved behavior/checks) */ public WidgetMetaInfo(Element widgetElement, String name) { this((name != null) ? name : widgetElement.getAttribute("name"), (String) widgetElement.getUserData("systemId"), (Integer) widgetElement.getUserData("startColumn"), (Integer) widgetElement.getUserData("startLine")); }