Search in sources :

Example 26 with Attr

use of org.w3c.dom.Attr in project robovm by robovm.

the class GetAttributeNodeNS method testGetAttributeNodeNS1.

/**
     * Runs the test case.
     *
     * @throws Throwable
     *             Any uncaught exception causes test to fail
     */
public void testGetAttributeNodeNS1() throws Throwable {
    String namespaceURI = "http://www.nist.gov";
    String localName = "invalidlocalname";
    Document doc;
    NodeList elementList;
    Element testAddr;
    Attr attribute;
    doc = (Document) load("staffNS", builder);
    elementList = doc.getElementsByTagName("emp:address");
    testAddr = (Element) elementList.item(0);
    assertNotNull("empAddrNotNull", testAddr);
    attribute = testAddr.getAttributeNodeNS(namespaceURI, localName);
    assertNull("throw_Null", attribute);
}
Also used : NodeList(org.w3c.dom.NodeList) Element(org.w3c.dom.Element) Document(org.w3c.dom.Document) Attr(org.w3c.dom.Attr)

Example 27 with Attr

use of org.w3c.dom.Attr in project robovm by robovm.

the class GetNamedItemNS method testGetNamedItemNS1.

/**
     * Runs the test case.
     *
     * @throws Throwable
     *             Any uncaught exception causes test to fail
     */
public void testGetNamedItemNS1() throws Throwable {
    Document doc;
    NodeList elementList;
    Node testEmployee;
    NamedNodeMap attributes;
    Attr domesticAttr;
    String attrName;
    doc = (Document) load("staffNS", builder);
    elementList = doc.getElementsByTagName("address");
    testEmployee = elementList.item(1);
    attributes = testEmployee.getAttributes();
    domesticAttr = (Attr) attributes.getNamedItemNS("http://www.usa.com", "domestic");
    attrName = domesticAttr.getNodeName();
    assertEquals("attrName", "dmstc:domestic", attrName);
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) Document(org.w3c.dom.Document) Attr(org.w3c.dom.Attr)

Example 28 with Attr

use of org.w3c.dom.Attr in project robovm by robovm.

the class GetNamedItemNS method testGetNamedItemNS2.

public void testGetNamedItemNS2() throws Throwable {
    String namespaceURI = "http://www.usa.com";
    String localName = "domest";
    Document doc;
    NodeList elementList;
    Node testEmployee;
    NamedNodeMap attributes;
    Attr newAttr;
    doc = (Document) load("staffNS", builder);
    elementList = doc.getElementsByTagName("address");
    testEmployee = elementList.item(1);
    attributes = testEmployee.getAttributes();
    newAttr = (Attr) attributes.getNamedItemNS(namespaceURI, localName);
    assertNull("throw_Null", newAttr);
}
Also used : NamedNodeMap(org.w3c.dom.NamedNodeMap) NodeList(org.w3c.dom.NodeList) Node(org.w3c.dom.Node) Document(org.w3c.dom.Document) Attr(org.w3c.dom.Attr)

Example 29 with Attr

use of org.w3c.dom.Attr in project robovm by robovm.

the class ElementHasAttribute method testHasAttribute4.

public void testHasAttribute4() throws Throwable {
    Document doc;
    Element element;
    boolean state;
    Attr attribute;
    doc = (Document) load("staff", builder);
    element = doc.createElement("address");
    attribute = doc.createAttribute("domestic");
    element.setAttributeNode(attribute);
    state = element.hasAttribute("domestic");
    assertTrue("elementhasattribute04", state);
}
Also used : Element(org.w3c.dom.Element) Document(org.w3c.dom.Document) Attr(org.w3c.dom.Attr)

Example 30 with Attr

use of org.w3c.dom.Attr in project robovm by robovm.

the class ElementHasAttributeNS method testHasAttributeNS3.

public void testHasAttributeNS3() throws Throwable {
    Document doc;
    Element element;
    boolean state;
    Attr attribute;
    String nullNS = null;
    doc = (Document) load("staff", builder);
    element = doc.createElementNS("http://www.w3.org/DOM", "address");
    assertNotNull("createElementNotNull", element);
    attribute = doc.createAttributeNS(nullNS, "domestic");
    element.setAttributeNode(attribute);
    state = element.hasAttributeNS(nullNS, "domestic");
    assertTrue("elementhasattributens03", state);
}
Also used : Element(org.w3c.dom.Element) Document(org.w3c.dom.Document) Attr(org.w3c.dom.Attr)

Aggregations

Attr (org.w3c.dom.Attr)385 Element (org.w3c.dom.Element)178 NamedNodeMap (org.w3c.dom.NamedNodeMap)160 Document (org.w3c.dom.Document)134 Node (org.w3c.dom.Node)126 NodeList (org.w3c.dom.NodeList)80 DOMException (org.w3c.dom.DOMException)30 ArrayList (java.util.ArrayList)25 DocumentBuilder (javax.xml.parsers.DocumentBuilder)16 HashMap (java.util.HashMap)12 Text (org.w3c.dom.Text)12 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)11 CanonicalizationException (com.sun.org.apache.xml.internal.security.c14n.CanonicalizationException)10 RubyString (org.jruby.RubyString)10 SAML2Exception (com.sun.identity.saml2.common.SAML2Exception)8 File (java.io.File)8 QName (javax.xml.namespace.QName)8 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)7 ParseException (java.text.ParseException)6 NokogiriHelpers.rubyStringToString (nokogiri.internals.NokogiriHelpers.rubyStringToString)6