オプション

オプション – すべてのXML_Beautifierオプションの一覧

オプションの導入

Options let you influence the beautifiying process. They are passed to the renderer and thus, you have to check, whether the renderer you are using supports the options you want to use.

As there currently is only one renderer (Plain) available, you should not worry about this too much.

オプションは、XML_Beautifierのコンストラクタ への連想配列として渡すことが出来ます。 You may also use setOption(), or setOptions() to set one or more options after the instance of XML_Beautifier has been created.

すべての有効なオプション

ここに、 XML_Beautifierでサポートされたすべてのオプションの一覧があります。

XML_Beautifierオプション
オプション 可能な値 デフォルト 説明
removeLineBreaks TRUE or FALSE TRUE Sets, whether linebreaks should be stripped from cdata sections
indent any string " " (4つの半角空白) The string passed to this option will be used to indent the tags in one level.
linebreak any string "\n" The string passed to this option will be used for linebreaks You should use "\n" or "\r\n".
caseFolding TRUEFALSE FALSE Disable or enable case folding for tags and attributes
caseFoldingTo "uppercase"か"lowercase" "uppercase" Can be used, if caseFolding is set to TRUE to define whether tags and attributes should be converted to upper- or lowercase
normalizeComments FALSE or TRUE FALSE If set to true, all adjacent whitespaces in an XML comment will be converted to one space. This will convert comments with more than one line to a comment with one line.
maxCommentLine integer -1 コメント行の最大長です。 コメントがこの限度を越えれば、それは自動的にラッピングされるでしょう。 もし-1にセットされれば、行長は無制限になります。
multilineTags TRUEFALSE FALSE If set to true, a linebreak will be added inside the tags after each attribute and attributes will be indeted.

オプション例

次の例は、XML_Beautifierのためにオプションを設定する方法の手引きです。

setOptions()とsetOption()の使用例

<?php
require_once "XML/Beautifier.php";
$options = array(
                    
"caseFolding"       => true,
                    
"caseFoldingTo"     => "uppercase",
                    
"normalizeComments" => true
                
);

$fmt = new XML_Beautifier($options);
$result $fmt->formatFile('originalFile.xml''outputFile.xml');
?>

Options example setting options at a later point

インスタンスが既に作成されている場合、 次の例はXML_Beautifierのオプションを設定する方法手引きです。

XML_Beautifierオプション

<?php
require_once "XML/Beautifier.php";
$fmt = new XML_Beautifier();
$options = array(
                    
"caseFolding"       => true,
                    
"caseFoldingTo"     => "uppercase",
                    
"normalizeComments" => true
                
);

$fmt->setOptions($options);
$fmt->setOption("indent""\t");
$result $fmt->formatFile('originalFile.xml''outputFile.xml');
?>
NPO法人の設立はお任せ下さい

NPO法人とはという基本的内容から実際のNPO法人設立まで広くお手伝いいたします。これからNPO法人をお考えの方はオススメ。NPO法人とはNon Profit Organizationの略であり、特定非営利活動法人を指します。法人なので当然に登記され、独立した人格として活動ができるようになります。

これから引越しや転勤等で賃貸物件を探すなら、賃貸大阪homeへ
アクセスカウンター
アルバイトをお探しならアルバイトスタイルへ。アルバイトを探したい方、アルバイトを探している方は必見です。
NPO法人をこれから設立したいとお考えなら自分で設立するNPO法人へ。都道府県ごとのNPO法人設立情報などを提供。NPO法人証明書も発行
株式会社をこれから設立したいとお考えなら会社設立webへ。都道府県ごとの会社設立専門家を紹介しております。
メールフォームを製作するならメールフォームbizへ。納品できるメールフォームを製作