org.dom4j.ProcessingInstruction Java Examples

The following examples show how to use org.dom4j.ProcessingInstruction. 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: JellyTestSuiteBuilder.java    From jenkins-test-harness with MIT License 5 votes vote down vote up
@Override
protected void runTest() throws Exception {
    jct.createContext().compileScript(jelly);
    Document dom = new SAXReader().read(jelly);
    checkLabelFor(dom);
    if (requirePI) {
        ProcessingInstruction pi = dom.processingInstruction("jelly");
        if (pi==null || !pi.getText().contains("escape-by-default"))
            throw new AssertionError("<?jelly escape-by-default='true'?> is missing in "+jelly);

    }
    // TODO: what else can we check statically? use of taglibs?
}
 
Example #2
Source File: VersionedXmlDoc.java    From onedev with MIT License 4 votes vote down vote up
public void add(ProcessingInstruction pi) {
	getWrapped().add(pi);
}
 
Example #3
Source File: VersionedXmlDoc.java    From onedev with MIT License 4 votes vote down vote up
public ProcessingInstruction processingInstruction(String target) {
	return getWrapped().processingInstruction(target);
}
 
Example #4
Source File: VersionedXmlDoc.java    From onedev with MIT License 4 votes vote down vote up
public List<ProcessingInstruction> processingInstructions() {
	return getWrapped().processingInstructions();
}
 
Example #5
Source File: VersionedXmlDoc.java    From onedev with MIT License 4 votes vote down vote up
public List<ProcessingInstruction> processingInstructions(String target) {
	return getWrapped().processingInstructions(target);
}
 
Example #6
Source File: VersionedXmlDoc.java    From onedev with MIT License 4 votes vote down vote up
public boolean remove(ProcessingInstruction pi) {
	return getWrapped().remove(pi);
}
 
Example #7
Source File: VersionedXmlDoc.java    From onedev with MIT License 4 votes vote down vote up
public void setProcessingInstructions(List<ProcessingInstruction> listOfPIs) {
	getWrapped().setProcessingInstructions(listOfPIs);
}
 
Example #8
Source File: ElementWrapper.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ProcessingInstruction processingInstruction(String name) {
	return element.processingInstruction( name );
}
 
Example #9
Source File: ElementWrapper.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void add(ProcessingInstruction processingInstruction) {
	element.add( processingInstruction );
}
 
Example #10
Source File: ElementWrapper.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public boolean remove(ProcessingInstruction processingInstruction) {
	return element.remove( processingInstruction );
}
 
Example #11
Source File: Dom4jProxy.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public ProcessingInstruction processingInstruction(String name) {
	return target().processingInstruction( name );
}
 
Example #12
Source File: Dom4jProxy.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void add(ProcessingInstruction processingInstruction) {
	target().add( processingInstruction );
}
 
Example #13
Source File: Dom4jProxy.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public boolean remove(ProcessingInstruction processingInstruction) {
	return target().remove( processingInstruction );
}
 
Example #14
Source File: XMLVisitor.java    From compiler with Apache License 2.0 4 votes vote down vote up
private void visit(DOMElement node) {
	Element.Builder b = Element.newBuilder();
	b.setKind(ElementKind.XML_ELEMENT);
	b.setTag(node.getQualifiedName());
	Namespace ns = node.getNamespace();
	if (!ns.getURI().equals("")){
		Ast.Attribute.Builder ab = Ast.Attribute.newBuilder();
		ab.setKey(ns.getPrefix() + " URI");
		ab.setValue(ns.getURI());
		b.addAttributes(ab.build());
	}
	DOMAttributeNodeMap attr = (DOMAttributeNodeMap) node.getAttributes();
	for (int i = 0; i < attr.getLength(); i++) {
		DOMAttribute a = (DOMAttribute) attr.item(i);
		visit(a);
		b.addAttributes(Attributes.pop());
	}
	elements.push(new ArrayList<boa.types.Ast.Element>());
	NodeList children = node.getChildNodes();
	for (int i = 0; i < children.getLength(); i++){
		Node n = (Node) children.item(i);
		switch (n.getNodeType()){
			case(org.dom4j.Node.ELEMENT_NODE):
				visit((org.dom4j.dom.DOMElement)n);
				break;
			case(org.dom4j.Node.TEXT_NODE):
				String t = ((DOMText) n).getText();
				String check = t.replaceAll(" ", "");
				if (!check.equals("") && !check.equals("\n") && !check.equals("\n\n") && !check.equals("\n  ") && !check.equals("\n    ") )
					b.addText(t);
				break;
		}
	}
	
	for (ProcessingInstruction pi : node.processingInstructions()){
		visit((DOMProcessingInstruction)pi);
		b.addProcessingInstruction(Attributes.pop());
	}
	
	
	for (Ast.Element e : elements.pop())
		b.addElements(e);
	elements.peek().add(b.build());
	
}