How do I format and read XML processing instructions using Java StAX?

后端 未结 3 1483
旧巷少年郎
旧巷少年郎 2021-01-21 10:53

First, how do I format the XML processing instruction, is it:


Usi

3条回答
  •  迷失自我
    2021-01-21 11:44

    1.Is the XML formatting correct?

    Yes, however do note that a processing instruction does not have attributes -- only data. What looks like attributes are part of the data and some people call them "pseudo-attributes".

    2.Is this the proper way to go about parsing processing instructions using the StAX XMLStreamReader APIs?

    Yes.

    3.How do I use getPITarget() and getPIData() to return multiple arguments?

    If by "multiple arguments" you mean the possibly more than one pseudo-attributes contained in the data, the answer is that your code must parse the data (using some standard string methods as the C# split(), and retrieve the set of name-value pairs for all pseudo-attributes.

提交回复
热议问题