Main Content

matlab.io.xml.dom.resourceistifierclass

包裹:matlab.io.xml.dom

XML资源标识符

描述

一个对象matlab.io.xml.dom.resourceistifier类标识实体解析器识别的资源类型。

当您配置matlab.io.xml.dom.parser对象通过使用从matlab.io.xml.dom.entityResolver类,解析器遇到一个实体,解析器创建一个matlab.io.xml.dom.resourceistifier目的。您可以访问资源识别剂object in the解决method of your entity resolver. Use the资源识别剂目的确定实体的分辨率。

matlab.io.xml.dom.resourceistifierclass is a处理班级。

类属性

constructonload
true
兼容
true

有关类属性的信息,请参阅类属性

特性

展开全部

资源的公共ID,指定为字符串标量。

属性:

GetAccess
public
setAccess
私人的
getobservable
true
setObservable
true

资源的系统ID, specified as a string scalar.

属性:

GetAccess
public
setAccess
私人的
getobservable
true
setObservable
true

模式的位置,指定为字符串标量。

属性:

GetAccess
public
setAccess
私人的
getobservable
true
setObservable
true

URI of the namespace for the entities to be resolved, specified as a string scalar.

属性:

GetAccess
public
setAccess
私人的
getobservable
true
setObservable
true

资源的基础URI,指定为字符串标量。

属性:

GetAccess
public
setAccess
私人的
getobservable
true
setObservable
true

Methods

展开全部

例子

全部收缩

此示例创建一个实体解析器,配置解析器以使用解析器,并解析包含实体参考的XML文件。

该示例使用以下文件:

  • 章节包含一章的标记。

<?xml版本=“ 1.0” encoding =“ utf-8”?>  简介




 
                 
  • book.xml包含实体参考&章节;并声明实体的资源是章节

<?xml版本=“ 1.0” encoding =“ utf-8”?> <!doctype book [<!ENTITY CHASTION CHASTION SYSTEM'Chapter.XML“>]>]> &Chapter;
  • begentityresolver是抽象类的子类matlab.io.xml.dom.entityResolver

ClassDefBookentityResolver properties基于结尾方法functionobj = bookentityResolver(基于)obj@matlab.io.xml.dom.entityresolver()obj.basedir =基于;结尾functionres =解决方案(OBJ,RI)导入matlab.io.xml.dom.resourceIdentifiertype如果getResourceIdentIfiertype(ri)== resourceDistififiertype.externalentity res = fullfile(obj.basedir,ri.systemid);结尾结尾结尾结尾

创建一个实体解析器作为实例begentityresolver班级。

进口matlab.io.xml.dom。*Resolver = BookentityResolver(PWD);

创建一个解析器和配置它se the resolver.

p = Parser(); p.Configuration.EntityResolver = resolver;

解析文件book.xmlinto amatlab.io.xml.dom.document目的。

domdoc = parsefile(p,“ book.xml”);

看到章节实体已解决,找到章节文档中的元素节点。

nl = getElementsbytagname(domdoc,“章节”);CH =节点(NL,1)
ch =带有属性的元素:tagname:'章节'hasAttributes:0 textcontent:'rutiest''儿童:[1x1 matlab.io.xml.dom.dom.element]
在R2021a中引入