Xml Dom解析器返回null

Xml Dom解析器返回null,xml,saxparser,domparser,Xml,Saxparser,Domparser,我正在尝试解析xml字符串,我的xml如下所示: xmlString= <Resources> <Resource> <ResourceMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:anyURI-equal"> <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">http://m

我正在尝试解析xml字符串,我的xml如下所示:

xmlString=    <Resources>
    <Resource>
    <ResourceMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:anyURI-equal">
    <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">http://medico.com/record/patient/BartSimpson</AttributeValue><ResourceAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#anyURI"/>
    </ResourceMatch>
    </Resource>
    </Resources>

文档将为空。

请过账堆栈跟踪我没有发现错误我遵循了以下示例:,即使如此,我也发现为空您正在从文件中读取xml?可能是重复的
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(xmlString));

Document doc = db.parse(is);