本文整理汇总了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;
}