CDATA для значения в XML - PullRequest
       0

CDATA для значения в XML

2 голосов
/ 30 марта 2010

Как добавить CDATA в ViolationInfo в этом ниже XML

<Violations ViolationNo="1" ViolationCD="10G" ConditionCode="" SectionCd="NYCHC 81.35" severity="0" ViolationInfo="Cold holding equipment not properly maintained in that two door reach-in refrigerator in kitchen observed holding potentially hazardous milk and operating at an internal temperature of 48°F.. All potentially hazardous foods were discarded as per violation 2G" Point="5" Occurence="0" ViolationDate="2/17/2010 7:58:00 AM"></Violations>

Когда я пытался поставить, как показано ниже, я получаю сообщение об ошибке, в котором не может быть <в значении </p>

<![CDATA[Facility conditions conducive to the existence of pest life in that several holes, approximately 2-3 inches in diameter noted in ceiling throughout rear food storage area and throughout basement.]]>

Ответы [ 2 ]

1 голос
/ 30 марта 2010

Удалите CDATA и экранируйте текст атрибута или переместите информацию о нарушении в свой собственный тег.

<Violations>
 <ViolationInfo><![CDATA[Facility conditions conducive to the existence of pest life in that several holes, approximately 2-3 inches in diameter noted in ceiling throughout rear food storage area and throughout basement.]]></ViolationInfo>
</Violations>
0 голосов
/ 30 марта 2010

Нельзя помещать раздел CDATA внутри значения, и это не имеет смысла - значения уже могут содержать только текстовые данные, вам не нужно заключать их в раздел CDATA.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...