Java 类javax.xml.soap.Text 实例源码

项目:wso2-axis2    文件:SOAPEnvelopeTest.java   
@Validated @Test
public void testNonCommentText() throws Exception {
    SOAPEnvelope envelope = getSOAPEnvelope();
    SOAPBody body = envelope.getBody();
    SOAPElement se = body.addChildElement("Child");
    se.addTextNode("This is text");
    Iterator iterator = se.getChildElements();
    Object o = null;
    while (iterator.hasNext()) {
        o = iterator.next();
        if (o instanceof Text) {
            break;
        }
    }
    assertTrue(o instanceof Text);
    Text t = (Text)o;
    assertTrue(!t.isComment());
}
项目:wso2-axis2    文件:SOAPEnvelopeTest.java   
private void validateBody(Iterator iter) {
    while (iter.hasNext()) {
        final Object obj = iter.next();
        if (obj instanceof Text) {
            final String data = ((Text)obj).getData();
            assertTrue("\n".equals(data) || "GENT".equals(data));
        } else {
            final SOAPElement soapElement = (SOAPElement)obj;
            final Iterator attIter = soapElement.getAllAttributes();
            while (attIter.hasNext()) {
                final Object o = attIter.next();
                assertEquals("test", soapElement.getAttributeValue((Name)o));
            }

            final Iterator childElementIter = soapElement.getChildElements();
            if (childElementIter == null) {
                return;
            }
            validateBody(childElementIter);
        }
    }
}
项目:wso2-axis2    文件:PrefixesTest.java   
private void validateBody(Iterator iter) {
    while (iter.hasNext()) {
        final Object obj = iter.next();
        if (obj instanceof Text) {
            //System.out.println("\n- Text Ignored.");
        } else {
            final SOAPElement soapElement = (SOAPElement)obj;
            final Iterator attIter = soapElement.getAllAttributes();
            while (attIter.hasNext()) {
                final Name name = (Name)attIter.next();
                assertEquals("test", soapElement.getAttributeValue(name));
                assertEquals("t", name.getPrefix());
                assertEquals("t:name", name.getQualifiedName());
                assertEquals("name", name.getLocalName());
                assertEquals("http://test.org/Test", name.getURI());
            }

            final Iterator childElementIter = soapElement.getChildElements();
            if (childElementIter == null) return;
            validateBody(childElementIter);
        }
    }
}
项目:wso2-axis2    文件:TextTest.java   
@Validated @Test
public void testComment() throws SOAPException, IOException {

    String xmlString = "<?xml version='1.0' encoding='utf-8'?> " +
            "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
            "<soapenv:Header></soapenv:Header>" +
            "<soapenv:Body>" +
            "<Node:abc xmlns:Node=\"http://www.simpletest.org\">" +
            "This is some text" +
            "<!--This is comment-->This is other text" +
            "<!--This is another comment-->This is some other text" +
            "</Node:abc>" +
            "</soapenv:Body>" +
            "</soapenv:Envelope>";

    MessageFactory mf = MessageFactory.newInstance();
    SOAPMessage message =
            mf.createMessage(new MimeHeaders(), new ByteArrayInputStream(xmlString.getBytes()));

    SOAPBody body = message.getSOAPBody();
    Node bodyElement = body.getFirstChild();
    NodeList textNodes = bodyElement.getChildNodes();

    assertEquals(5, textNodes.getLength());

    for (int i = 0; i < textNodes.getLength(); i++) {
        Node node = textNodes.item(i);
        boolean isComment;
        isComment = ((Text)node).isComment();
        if (i == 1 || i == 3) {
            assertEquals(true, isComment);
            assertTrue(node instanceof Comment);
        } else {
            assertEquals(false, isComment);
            assertFalse(node instanceof Comment);
        }
    }
}
项目:wso2-axis2    文件:SOAPEnvelopeTest.java   
@Validated @Test
public void testTransform() throws Exception {
    MessageFactory fact = MessageFactory.newInstance();
    SOAPMessage message = fact.createMessage();
    SOAPBody body = message.getSOAPBody();
    Source source = new DOMSource(createDocument());
    Result result = new DOMResult(body);
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    Transformer transformer = transformerFactory.newTransformer();
    transformer.transform(source, result);

    assertEquals(1, body.getChildNodes().getLength());
    Iterator iter = body.getChildElements();
    assertTrue(iter.hasNext()); 
    Object obj = iter.next();
    assertTrue(obj instanceof SOAPBodyElement);  
    SOAPElement soapElement = (SOAPElement)obj;
    assertEquals("http://example.com", soapElement.getNamespaceURI());
    assertEquals("GetLastTradePrice", soapElement.getLocalName());

    iter = soapElement.getChildElements();
    assertTrue(iter.hasNext()); 
    obj = iter.next();
    assertTrue(obj instanceof SOAPElement);  
    soapElement = (SOAPElement)obj;
    assertNull(soapElement.getNamespaceURI());
    assertEquals("symbol", soapElement.getLocalName());
    assertFalse(iter.hasNext());

    iter = soapElement.getChildElements();
    assertTrue(iter.hasNext()); 
    obj = iter.next();
    assertTrue(obj instanceof Text);  
    Text text = (Text)obj;
    assertEquals("DEF", text.getData());
    assertFalse(iter.hasNext());
}
项目:wso2-axis2    文件:SOAPEnvelopeTest.java   
private Element createDocument() throws Exception {
    DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
    documentBuilderFactory.setNamespaceAware(true);
    DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
    Document document = documentBuilder.newDocument();
    Element getLastTradePrice = document.createElementNS("http://example.com", "m:GetLastTradePrice");        
    Element symbol = document.createElement("symbol");
    getLastTradePrice.appendChild(symbol);
    org.w3c.dom.Text def = document.createTextNode("DEF");
    symbol.appendChild(def);
    document.appendChild(getLastTradePrice);
    return getLastTradePrice;
}
项目:wso2-axis2    文件:SOAPElementTest.java   
@Validated @Test
public void testAddTextNode() throws Exception {
    assertNotNull(soapEle);
    String value = "foo";
    soapEle.addTextNode(value);
    assertEquals(value, soapEle.getValue());
    Text text = assertContainsText(soapEle);
    assertEquals(value, text.getValue());
}
项目:wso2-axis2    文件:SOAPElementTest.java   
@Validated @Test
public void testCommentSibling() throws Exception {
    soapEle.addTextNode("foo");
    soapEle.addChildElement("Child1", "ch", "http://test.apache.org/");
    soapEle.addTextNode("<!-- This is a Comment-->");
    soapEle.addChildElement("Child2", "ch", "http://test.apache.org/");

    assertTrue(((Text)soapEle.getFirstChild().getNextSibling().getNextSibling()).isComment());
    assertTrue(((Text)soapEle.getLastChild().getPreviousSibling()).isComment());
}
项目:wso2-axis2    文件:SOAPElementTest.java   
@Validated @Test
public void testCommentSibling2() throws Exception {
    soapEle.addTextNode("foo");
    soapEle.addTextNode("<!-- This is a Comment-->");
    soapEle.addTextNode("bar");
    soapEle.addChildElement("Child1", "ch", "http://test.apache.org/");
    soapEle.addChildElement("Child2", "ch", "http://test.apache.org/");

    assertTrue(((Text)soapEle.getFirstChild().getNextSibling()).isComment());
    assertFalse(((Text)soapEle.getLastChild().getPreviousSibling()
            .getPreviousSibling()).isComment());
    assertFalse(((Text)soapEle.getLastChild().getPreviousSibling()
            .getPreviousSibling()).isComment());
}
项目:wso2-axis2    文件:SOAPElementTest.java   
@Validated @Test
public void testAddTextNode2() throws Exception {
    SOAPMessage msg = MessageFactory.newInstance().createMessage();
    SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
    SOAPBody body = envelope.getBody();
    Iterator iStart = envelope.getChildElements();
    int countStart = getIteratorCount(iStart);
    SOAPElement se = envelope.addTextNode("<txt>This is text</txt>");
    if (se == null) {
        fail("addTextNode() did not return SOAPElement");
    } else if (!envelope.getValue().equals("<txt>This is text</txt>")) {
        String s = body.getValue();
        fail("addTextNode() did not return expected text, Returned " + s +
                ", Expected <txt>This is text</txt>");
    }
    Iterator i = envelope.getChildElements();
    int count = getIteratorCount(i);
    i = envelope.getChildElements();
    if (count != ++countStart) {
        fail("Wrong iterator count returned of " +
                count + ", expected " + countStart);
    } else {
        Object obj = null;
        while (i.hasNext()) {
            obj = i.next();
            if (obj instanceof Text) {
                break;
            }
        }
        if (!(obj instanceof Text)) {
            fail("obj is not instanceof Text");
        }
    }
}
项目:wso2-axis2    文件:SOAPElementTest.java   
private Text assertContainsText(SOAPElement soapElem) {
    assertTrue(soapElem.hasChildNodes());
    List childElems = toList(soapElem.getChildElements());
    assertTrue(childElems.size() == 1);
    Node node = (Node)childElems.get(0);
    assertTrue(node instanceof Text);
    return (Text)node;
}
项目:wso2-axis2    文件:SOAPElementTest.java   
@Validated @Test
public void testRemoveChild() throws Exception {
    MessageFactory fact = MessageFactory.newInstance();
    SOAPMessage message = fact.createMessage();
    SOAPBody soapBody = message.getSOAPBody();

    assertFalse(soapBody.getChildElements().hasNext());

    QName qname1 = new QName("http://wombat.ztrade.com",
                             "GetLastTradePrice", "ztrade");
    SOAPElement child = soapBody.addChildElement(qname1);
    child.addTextNode("foo");

    assertTrue(child.getChildElements().hasNext());

    Node textNode = (Node)child.getChildElements().next();
    assertTrue(textNode instanceof Text);

    /* 
    child.removeChild(textNode);

    assertFalse(child.getChildElements().hasNext());
    */

    assertTrue(soapBody.getChildElements().hasNext());

    soapBody.removeChild(child);

    assertFalse(soapBody.getChildElements().hasNext());
}
项目:nutch-typo3-cms    文件:AccessRootlineIndexingFilter.java   
/**
 * Adds the Solr TYPO3 Access information to the document based on the
 * typo3.access.rootline parameter
 */
@Override
public NutchDocument filter(NutchDocument doc, Parse parse, Text url,
        CrawlDatum datum, Inlinks inlinks) throws IndexingException {

    // Index the access rootline
    doc.add(INDEXING_FIELD, conf.get(CONF_ACCESS_PROPERTY, "c:0"));

    return doc;
}
项目:wso2-axis2    文件:TextImplEx.java   
public org.w3c.dom.Text replaceWholeText(String content) throws DOMException {
    // TODO - Fixme.
    throw new UnsupportedOperationException("TODO");
}
项目:wso2-axis2    文件:CommentImpl.java   
public short getNodeType() {
    return Text.COMMENT_NODE;
}
项目:wso2-axis2    文件:SOAPEnvelopeTest.java   
@Validated @Test
public void testTransformWithComments() throws Exception {
    MessageFactory fact = MessageFactory.newInstance();
    SOAPMessage message = fact.createMessage();
    SOAPBody body = message.getSOAPBody();
    Source source = new SAXSource(new InputSource(new StringReader(XML_INPUT_1)));
    DOMResult result = new DOMResult(body);
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    Transformer transformer = transformerFactory.newTransformer();
    transformer.transform(source, result);

    // test DOM
    org.w3c.dom.Node rootNode = result.getNode();
    org.w3c.dom.Node node = rootNode.getFirstChild();
    assertTrue(node instanceof Element);
    assertEquals("root", node.getNodeName());

    node = node.getFirstChild();
    assertTrue(node instanceof Element);
    assertEquals("a", node.getNodeName());

    node = node.getFirstChild();
    assertTrue(node instanceof Comment);
    assertEquals("this is a test with a comment node", node.getNodeValue().trim());

    // test SAAJ
    assertEquals(1, body.getChildNodes().getLength());
    Iterator iter = body.getChildElements();
    assertTrue(iter.hasNext()); 
    Object obj = iter.next();
    assertTrue(obj instanceof SOAPBodyElement);  
    SOAPElement soapElement = (SOAPElement)obj;
    assertEquals("root", soapElement.getLocalName());

    iter = soapElement.getChildElements();
    assertTrue(iter.hasNext()); 
    obj = iter.next();
    assertTrue(obj instanceof SOAPElement);  
    soapElement = (SOAPElement)obj;
    assertEquals("a", soapElement.getLocalName());
    assertFalse(iter.hasNext());

    iter = soapElement.getChildElements();
    assertTrue(iter.hasNext()); 
    obj = iter.next();
    assertTrue(obj instanceof Text);  
    Text text = (Text)obj;
    assertTrue(text.isComment());
    assertEquals("this is a test with a comment node", text.getData().trim());
    assertFalse(iter.hasNext());        
}
项目:wso2-axis2    文件:SOAPElementTest.java   
@Validated @Test
public void testChildren() throws Exception {
    soapEle.addTextNode("foo");
    SOAPElement childEle1 =
            SOAPFactoryImpl.newInstance().createElement("Child1",
                                                        "ch",
                                                        "http://test.apache.org/");
    SOAPElement childEle2 =
            SOAPFactoryImpl.newInstance().createElement("Child2",
                                                        "ch",
                                                        "http://test.apache.org/");
    soapEle.addChildElement(childEle1);
    soapEle.addChildElement(childEle2);

    Object o = soapEle.getChildElements().next();
    Object o2 = soapEle.getChildElements().next();

    assertSame(o, o2); // both elements should be the same SAAJ Node
    assertEquals(((javax.xml.soap.Text)o).getValue(),
                 ((javax.xml.soap.Text)o2).getValue());

    int childrenCount = 0;
    for (Iterator iter = soapEle.getChildElements(); iter.hasNext();) {
        iter.next();
        childrenCount ++;
    }
    assertEquals(3, childrenCount);

    Object z1 = soapEle.getChildNodes().item(0);
    Object z2 = soapEle.getFirstChild();

    assertSame(o, z1);   // should be same SAAJ Node
    assertSame(z1, z2);  // should be same SAAJ Node

    assertEquals(((javax.xml.soap.Text)z1).getValue(),
                 ((javax.xml.soap.Text)z2).getValue());

    Node lastChildNode = (Node)soapEle.getLastChild();
    SOAPElement lastChildSOAPEle = (SOAPElement)lastChildNode;

    assertEquals("Child2", lastChildSOAPEle.getLocalName());
    assertEquals("http://test.apache.org/", lastChildSOAPEle.getNamespaceURI());
    assertEquals("ch", lastChildSOAPEle.getPrefix());
}
项目:wso2-axis2    文件:SOAPElementTest.java   
@Validated @Test
public void testChildrenAndSiblings() throws Exception {
    soapEle.addTextNode("foo");
    soapEle.addChildElement("Child1", "ch", "http://test.apache.org/");
    soapEle.addChildElement("Child2", "ch", "http://test.apache.org/");

    Object o = soapEle.getChildElements().next();
    Object o2 = soapEle.getChildElements().next();
    assertSame(o, o2); // both elements should be the same SAAJ Node
    assertEquals(((javax.xml.soap.Text)o).getValue(),
                 ((javax.xml.soap.Text)o2).getValue());

    int childrenCount = 0;
    for (Iterator iter = soapEle.getChildElements(); iter.hasNext();) {
        iter.next();
        childrenCount ++;
    }
    assertEquals(3, childrenCount);

    Object z1 = soapEle.getChildNodes().item(0);
    Object z2 = soapEle.getFirstChild();
    assertSame(o, z1);   // should be same SAAJ Node
    assertSame(z1, z2);  // should be same SAAJ Node
    assertEquals(((javax.xml.soap.Text)z1).getValue(),
                 ((javax.xml.soap.Text)z2).getValue());

    SOAPElement lastChildSOAPEle = (SOAPElement)soapEle.getLastChild();

    assertEquals("Child2", lastChildSOAPEle.getLocalName());
    assertEquals("ch:Child2", lastChildSOAPEle.getNodeName());
    assertEquals("http://test.apache.org/", lastChildSOAPEle.getNamespaceURI());
    assertEquals("ch", lastChildSOAPEle.getPrefix());
    assertNotNull(lastChildSOAPEle.getParentNode());
    assertTrue(lastChildSOAPEle.getPreviousSibling() instanceof javax.xml.soap.SOAPElement);
    assertNull(lastChildSOAPEle.getNextSibling());

    javax.xml.soap.Node firstChild = (javax.xml.soap.Node)soapEle.getFirstChild();
    javax.xml.soap.Node nextSibling = (javax.xml.soap.Node)(firstChild.getNextSibling());
    assertNull(firstChild.getPreviousSibling());

    assertTrue(firstChild instanceof javax.xml.soap.Text);
    assertTrue(nextSibling instanceof javax.xml.soap.SOAPElement);
    assertTrue(nextSibling.getPreviousSibling() instanceof javax.xml.soap.Text);
    assertEquals("Child1", nextSibling.getLocalName());
    assertEquals("ch:Child1", nextSibling.getNodeName());
    assertEquals("http://test.apache.org/", nextSibling.getNamespaceURI());
    assertEquals("ch", nextSibling.getPrefix());

    javax.xml.soap.Node nextSibling2 = (javax.xml.soap.Node)nextSibling.getNextSibling();
    assertEquals("Child2", nextSibling2.getLocalName());
    assertEquals("ch:Child2", nextSibling2.getNodeName());
    assertEquals("http://test.apache.org/", lastChildSOAPEle.getNamespaceURI());
    assertEquals("ch", nextSibling2.getPrefix());
    assertNull(nextSibling2.getNextSibling());
}
项目:wso2-axis2    文件:SOAPElementTest.java   
@Validated @Test
public void testAppendChild() throws Exception {
    MessageFactory fact = MessageFactory.newInstance();
    SOAPMessage message = fact.createMessage();
    SOAPBody soapBody = message.getSOAPBody();

    QName qname1 = new QName("http://wombat.ztrade.com",
                             "GetLastTradePrice", "ztrade");
    SOAPElement child = soapBody.addChildElement(qname1);

    assertFalse(child.getChildElements().hasNext());

    Document doc = child.getOwnerDocument();        
    String namespace = "http://example.com";
    String localName = "GetLastTradePrice";
    Element getLastTradePrice = doc.createElementNS(namespace, localName);        
    Element symbol = doc.createElement("symbol");
    symbol.setAttribute("foo", "bar");
    getLastTradePrice.appendChild(symbol);
    org.w3c.dom.Text def = doc.createTextNode("DEF");
    symbol.appendChild(def);

    child.appendChild(getLastTradePrice);

    Iterator iter = child.getChildElements();
    assertTrue(iter.hasNext()); 
    Object obj = iter.next();
    assertTrue(obj instanceof SOAPElement);  
    SOAPElement soapElement = (SOAPElement)obj;
    assertEquals(namespace, soapElement.getNamespaceURI());
    assertEquals(localName, soapElement.getLocalName());
    assertFalse(iter.hasNext());

    iter = soapElement.getChildElements();
    assertTrue(iter.hasNext()); 
    obj = iter.next();
    assertTrue(obj instanceof SOAPElement);  
    soapElement = (SOAPElement)obj;
    assertEquals(null, soapElement.getNamespaceURI());
    assertEquals("symbol", soapElement.getLocalName());
    assertFalse(iter.hasNext());

    iter = soapElement.getChildElements();
    assertTrue(iter.hasNext()); 
    obj = iter.next();
    assertTrue(obj instanceof Text);  
    Text text = (Text)obj;
    assertEquals("DEF", text.getData());
    assertFalse(iter.hasNext());               
}
项目:wso2-axis2    文件:SOAPBodyTest.java   
@Validated @Test
public void testAppendChild() throws Exception {
    MessageFactory fact = MessageFactory.newInstance();
    SOAPMessage message = fact.createMessage();
    SOAPBody soapBody = message.getSOAPBody();

    assertEquals(0, soapBody.getChildNodes().getLength());
    assertFalse(soapBody.getChildElements().hasNext());

    Document doc = soapBody.getOwnerDocument();        
    String namespace = "http://example.com";
    String localName = "GetLastTradePrice";
    Element getLastTradePrice = doc.createElementNS(namespace, localName);        
    Element symbol = doc.createElement("symbol");
    symbol.setAttribute("foo", "bar");
    getLastTradePrice.appendChild(symbol);
    org.w3c.dom.Text def = doc.createTextNode("DEF");
    symbol.appendChild(def);

    soapBody.appendChild(getLastTradePrice);

    assertEquals(1, soapBody.getChildNodes().getLength());
    Iterator iter = soapBody.getChildElements();
    assertTrue(iter.hasNext()); 
    Object obj = iter.next();
    // must be SOAPBodyElement
    assertTrue(obj instanceof SOAPBodyElement);  
    SOAPElement soapElement = (SOAPElement)obj;
    assertEquals(namespace, soapElement.getNamespaceURI());
    assertEquals(localName, soapElement.getLocalName());
    assertFalse(iter.hasNext());

    iter = soapElement.getChildElements();
    assertTrue(iter.hasNext()); 
    obj = iter.next();
    assertTrue(obj instanceof SOAPElement);  
    soapElement = (SOAPElement)obj;
    assertEquals(null, soapElement.getNamespaceURI());
    assertEquals("symbol", soapElement.getLocalName());
    assertFalse(iter.hasNext());

    iter = soapElement.getChildElements();
    assertTrue(iter.hasNext()); 
    obj = iter.next();
    assertTrue(obj instanceof Text);  
    Text text = (Text)obj;
    assertEquals("DEF", text.getData());
    assertFalse(iter.hasNext());   
}
项目:wso2-axis2    文件:SOAPHeaderTest.java   
@Validated @Test
public void testAppendChild() throws Exception {
    MessageFactory fact = MessageFactory.newInstance();
    SOAPMessage message = fact.createMessage();
    SOAPHeader soapHeader = message.getSOAPHeader();

    assertEquals(0, soapHeader.getChildNodes().getLength());
    assertFalse(soapHeader.getChildElements().hasNext());

    Document doc = soapHeader.getOwnerDocument();        
    String namespace = "http://example.com";
    String localName = "GetLastTradePrice";
    Element getLastTradePrice = doc.createElementNS(namespace, localName);        
    Element symbol = doc.createElement("symbol");
    symbol.setAttribute("foo", "bar");
    getLastTradePrice.appendChild(symbol);
    org.w3c.dom.Text def = doc.createTextNode("DEF");
    symbol.appendChild(def);

    soapHeader.appendChild(getLastTradePrice);

    assertEquals(1, soapHeader.getChildNodes().getLength());
    Iterator iter = soapHeader.getChildElements();
    assertTrue(iter.hasNext()); 
    Object obj = iter.next();
    // must be SOAPHeaderElement
    assertTrue(obj instanceof SOAPHeaderElement);  
    SOAPElement soapElement = (SOAPElement)obj;
    assertEquals(namespace, soapElement.getNamespaceURI());
    assertEquals(localName, soapElement.getLocalName());

    iter = soapElement.getChildElements();
    assertTrue(iter.hasNext()); 
    obj = iter.next();
    assertTrue(obj instanceof SOAPElement);  
    soapElement = (SOAPElement)obj;
    assertEquals(null, soapElement.getNamespaceURI());
    assertEquals("symbol", soapElement.getLocalName());
    assertFalse(iter.hasNext());

    iter = soapElement.getChildElements();
    assertTrue(iter.hasNext()); 
    obj = iter.next();
    assertTrue(obj instanceof Text);  
    Text text = (Text)obj;
    assertEquals("DEF", text.getData());
    assertFalse(iter.hasNext());   
}
项目:nutch-typo3-cms    文件:SiteHashIndexingFilter.java   
/**
 * Gets the sitehash for the domain from the Solr Typo3 Api and index it
 */
@Override
public NutchDocument filter(NutchDocument doc, Parse parse, Text url,
        CrawlDatum datum, Inlinks inlinks) throws IndexingException {

    // if wasn't able to connect to the Solr TYPO3 API, don't retry it for
    // every document
    if (siteHashApiConnectionError) {
        return null;
    }

    // get the base domain for the document url
    String requestedDomain = null;
    try {
        requestedDomain = new URL(url.toString()).getHost();
    } catch (MalformedURLException e) {
        LOG.error("ERROR! Could not get Domain Name for requested url: "
                + url.toString());
        throw (new IndexingException(e));
    }

    // lookup in the hashCache if there is already a siteHash for the
    // requested Domain
    String siteHash = hashCache.get(requestedDomain);

    if (siteHash == null) {

        LOG.info("Getting siteHash for domain: " + requestedDomain);

        InputStream stream = getApiInputStream(
                conf.get(CONF_BASEURL_PROPERTY, ""), requestedDomain,
                conf.get(CONF_APIKEY_PROPERTY, ""));
        siteHash = getSiteHashFromJsonStream(stream);

        // Cache the siteHash
        hashCache.put(requestedDomain, siteHash);
    }

    // Index the siteHash
    doc.add(INDEXING_FIELD_SITEHASH, siteHash.toString());

    // Index the id (siteHash + nutch_external + url)
    doc.add(INDEXING_FIELD_ID,
            siteHash + "/tx_nutch_external/" + url.toString());

    return doc;
}
项目:wso2-axis2    文件:TextImplEx.java   
/**
 * Breaks this node into two nodes at the specified <code>offset</code>, keeping both in the
 * tree as siblings. After being split, this node will contain all the content up to the
 * <code>offset</code> point. A new node of the same type, which contains all the content at and
 * after the <code>offset</code> point, is returned. If the original node had a parent node, the
 * new node is inserted as the next sibling of the original node. When the <code>offset</code>
 * is equal to the length of this node, the new node has no data.
 *
 * @param offset The 16-bit unit offset at which to split, starting from <code>0</code>.
 * @return The new node, of the same type as this node.
 * @throws DOMException INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
 *                      than the number of 16-bit units in <code>data</code>.
 *                      <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
 */
public org.w3c.dom.Text splitText(int offset) throws DOMException {
    return textNode.splitText(offset);
}