use of org.w3c.dom.Element in project qksms by moezbhatti.
the class SmilContentHandler method startElement.
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) {
if (LOCAL_LOGV)
Log.v(TAG, "SmilContentHandler.startElement. Creating element " + localName);
Element element = mSmilDocument.createElement(localName);
if (attributes != null) {
for (int i = 0; i < attributes.getLength(); i++) {
if (LOCAL_LOGV)
Log.v(TAG, "Attribute " + i + " lname = " + attributes.getLocalName(i) + " value = " + attributes.getValue(i));
element.setAttribute(attributes.getLocalName(i), attributes.getValue(i));
}
}
if (LOCAL_LOGV)
Log.v(TAG, "Appending " + localName + " to " + mCurrentNode.getNodeName());
mCurrentNode.appendChild(element);
mCurrentNode = element;
}
use of org.w3c.dom.Element in project OpenAttestation by OpenAttestation.
the class ReadXmlTest method getTagSelectionFromXml.
public TagSelection getTagSelectionFromXml(String xml) throws ParserConfigurationException, SAXException, IOException {
TagSelection ret = new TagSelection();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
InputSource is = new InputSource(new StringReader(xml));
Document doc = builder.parse(is);
ArrayList<tag> tagList = new ArrayList<tag>();
int cnt = 0;
NodeList nodeList = doc.getElementsByTagName("attribute");
for (int s = 0; s < nodeList.getLength(); s++) {
Node fstNode = nodeList.item(s);
if (fstNode.getNodeType() == Node.ELEMENT_NODE) {
Element fstElmnt = (Element) fstNode;
String idValue = fstElmnt.getAttribute("oid");
Element lstNmElmnt = (Element) nodeList.item(cnt++);
NodeList lstNm = lstNmElmnt.getChildNodes();
String currentAction = ((Node) lstNm.item(0)).getNodeValue();
if (currentAction != null) {
tagList.add(new tag("", idValue, currentAction));
}
}
}
nodeList = doc.getElementsByTagName("selection");
Node fstNode = nodeList.item(0);
Element e = (Element) fstNode;
ret.id = e.getAttribute("id");
ret.name = e.getAttribute("name");
ret.tagList = tagList;
return ret;
}
use of org.w3c.dom.Element in project OpenAttestation by OpenAttestation.
the class TrustAssertion method readXml.
/**
* See also {@code XML.parseDocumentElement} in mtwilson-util-xml
*/
private Element readXml(String xmlDocument) throws ParserConfigurationException, SAXException, IOException {
XML xml = new XML();
xml.setSchemaPackageName("xsd");
xml.addSchemaLocation("http://docs.oasis-open.org/security/saml/v2.0/saml-schema-protocol-2.0.xsd");
xml.addSchemaLocation("http://docs.oasis-open.org/security/saml/v2.0/saml-schema-assertion-2.0.xsd");
xml.addSchemaLocation("http://www.w3.org/TR/2002/REC-xmlenc-core-20021210/xenc-schema.xsd");
xml.addSchemaLocation("http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd");
Element myXml = xml.parseDocumentElement(xmlDocument);
return myXml;
}
use of org.w3c.dom.Element in project Openfire by igniterealtime.
the class MonitoringDWR method buildCreator.
/**
* Builds a create element within the DWR servlet.
* @param javascriptID the javascript variable name to use.
* @param qualifiedClassName the fully qualified class name.
* @return the Element.
*/
private Element buildCreator(String javascriptID, String qualifiedClassName) {
Element element = document.createElement("create");
element.setAttribute("creator", "new");
element.setAttribute("javascript", javascriptID);
Element parameter = document.createElement("param");
parameter.setAttribute("name", "class");
parameter.setAttribute("value", qualifiedClassName);
element.appendChild(parameter);
return element;
}
use of org.w3c.dom.Element in project Openfire by igniterealtime.
the class GatewayDWR method configure.
@Override
public void configure(ServletConfig servletConfig, Configuration configuration) throws ServletException {
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = dbf.newDocumentBuilder();
document = builder.newDocument();
Element root = document.createElement("dwr");
document.appendChild(root);
Element allowElement = document.createElement("allow");
allowElement.appendChild(buildCreator("ConfigManager", "net.sf.kraken.web.ConfigManager"));
allowElement.appendChild(buildCreator("ConnectionTester", "net.sf.kraken.web.ConnectionTester"));
root.appendChild(allowElement);
} catch (ParserConfigurationException e) {
Log.error("Error configuring DWR for gateway plugin: ", e);
}
configuration.addConfig(document);
// Specify the path for the js files
Object bean = container.getBean("interface");
if (bean instanceof DefaultInterfaceProcessor) {
DefaultInterfaceProcessor processor = (DefaultInterfaceProcessor) bean;
processor.setOverridePath("/plugins/kraken/dwr");
}
}
Aggregations