本文整理匯總了Java中org.w3c.dom.ls.LSInput.setBaseURI方法的典型用法代碼示例。如果您正苦於以下問題:Java LSInput.setBaseURI方法的具體用法?Java LSInput.setBaseURI怎麽用?Java LSInput.setBaseURI使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.w3c.dom.ls.LSInput
的用法示例。
在下文中一共展示了LSInput.setBaseURI方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: resolveResource
import org.w3c.dom.ls.LSInput; //導入方法依賴的package包/類
@Override
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
try {
InputStream inputStream = new URL(new URL(baseURI), systemId).openStream();
LSInput retval = new DefaultLSInput();
retval.setByteStream(inputStream);
retval.setBaseURI(baseURI);
retval.setSystemId(systemId);
retval.setPublicId(publicId);
return retval;
} catch(IOException e) {
return null;
}
}
示例2: resolveResource
import org.w3c.dom.ls.LSInput; //導入方法依賴的package包/類
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI)
{
LOGGER.debug("==== Resolving '" + type + "' '" + namespaceURI + "' '" + publicId + "' '" + systemId + "' '" +
baseURI + "'");
LSInput lsInput = domImplementationLS.createLSInput();
InputStream is = getXSDStream(systemId);
if(is==null)return null;
lsInput.setByteStream(is);
lsInput.setSystemId(systemId);
lsInput.setBaseURI(baseURI);
lsInput.setPublicId(publicId);
LOGGER.debug("==== Resolved ====");
return lsInput;
}
示例3: resolveResource
import org.w3c.dom.ls.LSInput; //導入方法依賴的package包/類
public LSInput resolveResource( String type, String namespaceURI, String publicId, String systemId, String baseURI )
{
String resourceName = local.getProperty( systemId );
if( resourceName == null )
{
System.out.println( "type: " + type );
System.out.println( "namespaceURI: " + namespaceURI );
System.out.println( "publicId: " + publicId );
System.out.println( "systemId: " + systemId );
System.out.println( "baseURI: " + baseURI );
return null;
}
InputStream resource = getClass().getClassLoader().getResourceAsStream( resourceName );
LSInput input;
try
{
input = getLSInput();
}
catch( Exception e )
{
throw new UnsupportedOperationException( "Internal problem. Please report to [email protected] mailing list.", e );
}
input.setBaseURI( baseURI );
input.setByteStream( resource );
input.setPublicId( publicId );
input.setSystemId( systemId );
return input;
}
示例4: parseWithContext
import org.w3c.dom.ls.LSInput; //導入方法依賴的package包/類
public Node parseWithContext(LSInput input, Node context, short action)
throws DOMException, LSException
{
Document doc = (context.getNodeType() == Node.DOCUMENT_NODE) ?
(Document) context : context.getOwnerDocument();
input.setBaseURI(doc.getDocumentURI());
// TODO use namespaces defined on context node
Document ret = parse(input);
Node root = ret.getDocumentElement();
root = doc.adoptNode(root);
switch (action)
{
case ACTION_APPEND_AS_CHILDREN:
context.appendChild(root);
break;
case ACTION_REPLACE_CHILDREN:
Node c1 = context.getFirstChild();
while (c1 != null)
{
Node next = c1.getNextSibling();
context.removeChild(c1);
c1 = next;
}
context.appendChild(root);
break;
case ACTION_INSERT_BEFORE:
Node p1 = context.getParentNode();
p1.insertBefore(root, context);
break;
case ACTION_INSERT_AFTER:
Node p2 = context.getParentNode();
Node r1 = context.getNextSibling();
if (r1 == null)
{
p2.appendChild(root);
}
else
{
p2.insertBefore(root, r1);
}
break;
case ACTION_REPLACE:
Node p3 = context.getParentNode();
Node r2 = context.getNextSibling();
p3.removeChild(context);
if (r2 == null)
{
p3.appendChild(root);
}
else
{
p3.insertBefore(root, r2);
}
break;
}
return root;
}