PBDOM_PROCESSINGINSTRUCTION:
SetData method
Description
Sets
the raw data for the PBDOM_PROCESSINGINSTRUCTION object.
Syntax
1 |
<span>pbdom_pi_name</span>.SetData(string <span>strData</span>) |
Argument |
Description |
---|---|
pbdom_pi_name |
The name of a PBDOM_PROCESSINGINSTRUCTION object |
strData |
New data for the PBDOM_PROCESSINGINSTRUCTION |
Return Values
PBDOM_PROCESSINGINSTRUCTION. The PBDOM_PROCESSINGINSTRUCTION
object modified with the new data.
Throws
EXCEPTION_INVALID_STRING – The
input data is invalid. This can happen in the following circumstances:
-
The input data contains the
sub-string “?>”. This violates the requirements for
the data of a processing instruction. -
If the processing instruction target name is
xml
,
making this PBDOM_PROCESSINGINSTRUCTION object an XML declaration processing
instruction, this exception is thrown if the input data string does not
conform to the following criteria:-
The data
must contain a name/value pair for the nameversion
. -
The data can contain a name/value pair
for the nameencoding
. -
The data can contain a name/value pair
for the namestandalone
. If it
does, the value forstandalone
must
either beyes
orno
. -
The data must not contain any other data in the
form of name/value pairs or in any other form.
-

The strings xml
, version
, encoding
, standalone
, yes
,
and no
are all case sensitive
and must be in lowercase.
Examples
Suppose there is a PBDOM_PROCESSINGINSTRUCTION
object as follows:
1 |
<?xml-stylesheet href="simple-ie5.xsl" type="text/xsl" ?> |
Then, SetData("href=new.xsl")
results
in the PBDOM_PROCESSINGINSTRUCTION object being transformed
into the following:
1 |
<?xml-stylesheet href=new.xsl" ?> |
The entire data for the PBDOM_PROCESSINGINSTRUCTION
object is now reset.
Usage
Special processing is performed when the name of the processing
instruction’s target is xml, which
indicates that it is an XML declaration. The valid instructions
allowed in the input Data as part of the name in the name/value pairs
are version
, encoding
,
and standalone
. The version
instruction is mandatory before the processing instruction can be
added to a document.
The XML specification expects the instructions to be in the
specific order version
, encoding
, standalone
.
This function reorders the input data to conform to the specification,
for example:
1 |
<? xml version="1.0" encoding="utf-8" standalone="yes"?> |